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/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 a884c1fd..9af91e06 100644 --- a/setup.py +++ b/setup.py @@ -36,9 +36,11 @@ "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', + 'tqdm>=4.0.0,<5.0.0', ], ) diff --git a/tests/actions_requirements.txt b/tests/actions_requirements.txt index ece7a30e..b74924a5 100644 --- a/tests/actions_requirements.txt +++ b/tests/actions_requirements.txt @@ -1,14 +1,14 @@ -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.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.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>=1.14.0 -future>=0.17.1 +tensorboard>=2.0.0,<3.0.0 ./