Skip to content

Commit

Permalink
Update CI and dependencies (#221)
Browse files Browse the repository at this point in the history
* (actions) one file

* Update actions requirements

* Restrict dep versions

* Depend on tqdm
  • Loading branch information
MatthijsBurgh authored Apr 5, 2024
1 parent 4e6eec5 commit 8ee5326
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 123 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/python-3.8.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/python-3.9.yml

This file was deleted.

20 changes: 9 additions & 11 deletions .github/workflows/python-3.10.yml → .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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' }}
33 changes: 1 addition & 32 deletions models/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
)
24 changes: 12 additions & 12 deletions tests/actions_requirements.txt
Original file line number Diff line number Diff line change
@@ -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
./

0 comments on commit 8ee5326

Please sign in to comment.