From 7eb9f7f24752a468b829026fc57f77718dca198e Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 12 Mar 2024 23:40:35 +0100 Subject: [PATCH 1/4] (actions) one file --- .github/workflows/python-3.8.yml | 32 ------------------- .github/workflows/python-3.9.yml | 32 ------------------- .../workflows/{python-3.10.yml => python.yml} | 20 ++++++------ tests/actions_requirements.txt | 23 +++++++------ 4 files changed, 20 insertions(+), 87 deletions(-) delete mode 100644 .github/workflows/python-3.8.yml delete mode 100644 .github/workflows/python-3.9.yml rename .github/workflows/{python-3.10.yml => python.yml} (62%) diff --git a/.github/workflows/python-3.8.yml b/.github/workflows/python-3.8.yml deleted file mode 100644 index dfaa1505..00000000 --- a/.github/workflows/python-3.8.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Python 3.8 - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.8"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r tests/actions_requirements.txt - - name: Test with pytest - run: | - python3 --version || python --version - echo "import tests.actions_test" > test.py - coverage run --source models,examples test.py && coverage report diff --git a/.github/workflows/python-3.9.yml b/.github/workflows/python-3.9.yml deleted file mode 100644 index 0a20744e..00000000 --- a/.github/workflows/python-3.9.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Python 3.9 - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.9"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r tests/actions_requirements.txt - - name: Test with pytest - run: | - python3 --version || python --version - echo "import tests.actions_test" > test.py - coverage run --source models,examples test.py && coverage report diff --git a/.github/workflows/python-3.10.yml b/.github/workflows/python.yml similarity index 62% rename from .github/workflows/python-3.10.yml rename to .github/workflows/python.yml index fab5051b..87d0df80 100644 --- a/.github/workflows/python-3.10.yml +++ b/.github/workflows/python.yml @@ -1,10 +1,6 @@ -name: Python 3.10 +name: Python -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +on: [pull_request, push, workflow_dispatch] jobs: build: @@ -13,12 +9,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -27,9 +23,11 @@ jobs: pip install -r tests/actions_requirements.txt - name: Test with pytest run: | - python3 --version || python --version + python --version echo "import tests.actions_test" > test.py - coverage run --source models,examples test.py && coverage report + coverage run --source models,examples test.py + coverage report coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + if: ${{ matrix.python-version == '3.12' }} diff --git a/tests/actions_requirements.txt b/tests/actions_requirements.txt index ece7a30e..355f79ea 100644 --- a/tests/actions_requirements.txt +++ b/tests/actions_requirements.txt @@ -1,14 +1,13 @@ -numpy==1.23.3 -requests==2.25.1 -torch==1.13.1 -torchvision==0.14.1 -Pillow==9.4.0 -opencv-python>=4.1.0 -scipy==1.9.1 -pandas==1.4.4 -coverage==4.5.3 -codecov==2.0.15 +numpy>=1.24.4,<2.0.0 +requests==2.31.0 +torch==2.2.1 +torchvision==0.17.1 +Pillow==10.2.0 +opencv-python>=4.9.0 +scipy==1.12.0 +pandas==2.2.1 +coverage==7.4.3 +codecov==2.1.13 jupyter>=1.0.0 -tensorboard>=1.14.0 -future>=0.17.1 +tensorboard>=2.16.2 ./ From 59643e4b461d066f80980dea2ae1cba13b40881e Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Wed, 13 Mar 2024 00:36:45 +0100 Subject: [PATCH 2/4] Update actions requirements --- tests/actions_requirements.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/actions_requirements.txt b/tests/actions_requirements.txt index 355f79ea..b74924a5 100644 --- a/tests/actions_requirements.txt +++ b/tests/actions_requirements.txt @@ -1,13 +1,14 @@ -numpy>=1.24.4,<2.0.0 -requests==2.31.0 -torch==2.2.1 -torchvision==0.17.1 -Pillow==10.2.0 +numpy>=1.24.0,<2.0.0 +requests>=2.0.0,<3.0.0 +torch>=2.2.0,<2.3.0 +torchvision>=0.17.0,<0.18.0 +Pillow>=10.2.0,<10.3.0 opencv-python>=4.9.0 -scipy==1.12.0 -pandas==2.2.1 -coverage==7.4.3 -codecov==2.1.13 +scipy>=1.10.0,<2.0.0 +tqdm>=4.0.0,<5.0.0 +pandas>=2.0.0,<3.0.0 +coverage>=7.0.0,<8.0.0 +codecov>=2.0.0,<3.0.0 jupyter>=1.0.0 -tensorboard>=2.16.2 +tensorboard>=2.0.0,<3.0.0 ./ From b041d4e43916456b0534ed091589fe1ce504b2f3 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Wed, 13 Mar 2024 00:50:32 +0100 Subject: [PATCH 3/4] Restrict dep versions --- setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index a884c1fd..c52ee104 100644 --- a/setup.py +++ b/setup.py @@ -36,9 +36,10 @@ "Operating System :: OS Independent", ], install_requires=[ - 'numpy', - 'requests', - 'torchvision', - 'pillow', + 'numpy>=1.24.0,<2.0.0', + 'Pillow>=10.2.0,<10.3.0', + 'requests>=2.0.0,<3.0.0', + 'torch>=2.2.0,<2.3.0', + 'torchvision>=0.17.0,<0.18.0', ], ) From 37a27811c14dc4c08fdd4d26b926942b31be523c Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Wed, 13 Mar 2024 00:50:45 +0100 Subject: [PATCH 4/4] Depend on tqdm --- models/utils/download.py | 33 +-------------------------------- setup.py | 1 + 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/models/utils/download.py b/models/utils/download.py index 4943ffe4..328684f2 100644 --- a/models/utils/download.py +++ b/models/utils/download.py @@ -9,38 +9,7 @@ try: from tqdm.auto import tqdm # automatically select proper tqdm submodule if available except ImportError: - try: - from tqdm import tqdm - except ImportError: - # fake tqdm if it's not installed - class tqdm(object): # type: ignore - - def __init__(self, total=None, disable=False, - unit=None, unit_scale=None, unit_divisor=None): - self.total = total - self.disable = disable - self.n = 0 - # ignore unit, unit_scale, unit_divisor; they're just for real tqdm - - def update(self, n): - if self.disable: - return - - self.n += n - if self.total is None: - sys.stderr.write("\r{0:.1f} bytes".format(self.n)) - else: - sys.stderr.write("\r{0:.1f}%".format(100 * self.n / float(self.total))) - sys.stderr.flush() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if self.disable: - return - - sys.stderr.write('\n') + from tqdm import tqdm def download_url_to_file(url, dst, hash_prefix=None, progress=True): diff --git a/setup.py b/setup.py index c52ee104..9af91e06 100644 --- a/setup.py +++ b/setup.py @@ -41,5 +41,6 @@ 'requests>=2.0.0,<3.0.0', 'torch>=2.2.0,<2.3.0', 'torchvision>=0.17.0,<0.18.0', + 'tqdm>=4.0.0,<5.0.0', ], )