diff --git a/.github/scripts/override_constraints.py b/.github/scripts/override_constraints.py new file mode 100644 index 00000000000..69f42a8269a --- /dev/null +++ b/.github/scripts/override_constraints.py @@ -0,0 +1,41 @@ +# Copyright (c) 2025 Intel Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import sys +from pathlib import Path + +CONSTRAINTS_FILE = "constraints.txt" + + +def main(): + arg = sys.argv[1] + overrided_requirements = [r.strip() for r in arg.split(",")] + + print("overrided_requirements: ", arg) + + file = Path(CONSTRAINTS_FILE) + content = file.read_text() + + for new_requirement in overrided_requirements: + new_requirement = new_requirement.strip() + package_name = new_requirement.split("==")[0] + content = re.sub(f"^{package_name}\s*[=><].*", "", content, flags=re.MULTILINE) + content += f"\n{new_requirement}" + + print("New constraints:") + print(content) + + file.write_text(content) + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/call_precommit.yml b/.github/workflows/call_precommit.yml index 24eb6116a29..11098e693af 100644 --- a/.github/workflows/call_precommit.yml +++ b/.github/workflows/call_precommit.yml @@ -13,6 +13,11 @@ on: type: boolean default: false required: true + override_requirements: + description: 'Override requirements' + default: '' + type: string + required: false jobs: common: @@ -29,8 +34,12 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-common-test + run: pip install . -r tests/common/requirements.txt - name: Print installed modules run: pip list - name: Run common precommit test scope @@ -51,8 +60,12 @@ jobs: - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: ${{ inputs.python_version }} + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-onnx-test + run: pip install . -r tests/onnx/requirements.txt - name: Print installed modules run: pip list - name: Run ONNX precommit test scope @@ -74,8 +87,12 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-openvino-test + run: pip install . -r tests/openvino/requirements.txt - name: Print installed modules run: pip list - name: Run OV precommit test scope @@ -108,8 +125,12 @@ jobs: run: | cat /etc/*release cat /proc/cpuinfo + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-torch-test + run: pip install . -r tests/torch/requirements.txt - name: Print installed modules run: pip list - name: Run PyTorch precommit test scope @@ -151,8 +172,12 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-torch-test + run: pip install . -r tests/torch/requirements.txt - name: Print installed modules run: pip list - name: Check CUDA @@ -181,8 +206,12 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements - run: make install-tensorflow-test + run: pip install . -r tests/tensorflow/requirements.txt - name: Print installed modules run: pip list - name: Run TensorFlow precommit test scope @@ -204,7 +233,7 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip - - name: Install NNCF and test requirements + - name: Install test requirements run: pip install -r tests/tools/requirements.txt - name: Print installed modules run: pip list @@ -225,9 +254,13 @@ jobs: with: python-version: ${{ inputs.python_version }} cache: pip + - name: Override constraints + if: ${{ inputs.override_requirements != '' }} + run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}" + shell: bash - name: Install NNCF and test requirements run: | - pip install -r tests/torch2/requirements.txt -e . + pip install . -r tests/torch2/requirements.txt - name: Print installed modules run: pip list - name: Run torch2 precommit test scope diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index f478667f256..8c6556c9014 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -12,10 +12,15 @@ jobs: strategy: fail-fast: false matrix: - python_version: ["3.9", "3.11", "3.12"] + include: + - python_version: "3.9" + override_requirements: "numpy==1.24.0" + - python_version: "3.11" + - python_version: "3.12" uses: ./.github/workflows/call_precommit.yml with: python_version: ${{ matrix.python_version }} + override_requirements: ${{ matrix.override_requirements || '' }} gpu_enabled: false macos: diff --git a/pyproject.toml b/pyproject.toml index 439807c1fe6..d2dff390a79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "natsort>=7.1.0", "networkx>=2.6, <=3.3", "ninja>=1.10.0.post2, <1.12", - "numpy>=1.19.1, <2.2.0", + "numpy>=1.24.0, <2.2.0", "openvino-telemetry>=2023.2.0", "packaging>=20.0", "pandas>=1.1.5,<2.3",