Skip to content

Commit 8ee5326

Browse files
authoredApr 5, 2024
Update CI and dependencies (#221)
* (actions) one file * Update actions requirements * Restrict dep versions * Depend on tqdm
1 parent 4e6eec5 commit 8ee5326

File tree

6 files changed

+28
-123
lines changed

6 files changed

+28
-123
lines changed
 

‎.github/workflows/python-3.8.yml

-32
This file was deleted.

‎.github/workflows/python-3.9.yml

-32
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
name: Python 3.10
1+
name: Python
22

3-
on:
4-
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
3+
on: [pull_request, push, workflow_dispatch]
84

95
jobs:
106
build:
@@ -13,12 +9,12 @@ jobs:
139
strategy:
1410
fail-fast: false
1511
matrix:
16-
python-version: ["3.10"]
12+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1713

1814
steps:
19-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
2016
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v5
2218
with:
2319
python-version: ${{ matrix.python-version }}
2420
- name: Install dependencies
@@ -27,9 +23,11 @@ jobs:
2723
pip install -r tests/actions_requirements.txt
2824
- name: Test with pytest
2925
run: |
30-
python3 --version || python --version
26+
python --version
3127
echo "import tests.actions_test" > test.py
32-
coverage run --source models,examples test.py && coverage report
28+
coverage run --source models,examples test.py
29+
coverage report
3330
coverage xml
3431
- name: Upload coverage to Codecov
3532
uses: codecov/codecov-action@v3
33+
if: ${{ matrix.python-version == '3.12' }}

‎models/utils/download.py

+1-32
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,7 @@
99
try:
1010
from tqdm.auto import tqdm # automatically select proper tqdm submodule if available
1111
except ImportError:
12-
try:
13-
from tqdm import tqdm
14-
except ImportError:
15-
# fake tqdm if it's not installed
16-
class tqdm(object): # type: ignore
17-
18-
def __init__(self, total=None, disable=False,
19-
unit=None, unit_scale=None, unit_divisor=None):
20-
self.total = total
21-
self.disable = disable
22-
self.n = 0
23-
# ignore unit, unit_scale, unit_divisor; they're just for real tqdm
24-
25-
def update(self, n):
26-
if self.disable:
27-
return
28-
29-
self.n += n
30-
if self.total is None:
31-
sys.stderr.write("\r{0:.1f} bytes".format(self.n))
32-
else:
33-
sys.stderr.write("\r{0:.1f}%".format(100 * self.n / float(self.total)))
34-
sys.stderr.flush()
35-
36-
def __enter__(self):
37-
return self
38-
39-
def __exit__(self, exc_type, exc_val, exc_tb):
40-
if self.disable:
41-
return
42-
43-
sys.stderr.write('\n')
12+
from tqdm import tqdm
4413

4514

4615
def download_url_to_file(url, dst, hash_prefix=None, progress=True):

‎setup.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
"Operating System :: OS Independent",
3737
],
3838
install_requires=[
39-
'numpy',
40-
'requests',
41-
'torchvision',
42-
'pillow',
39+
'numpy>=1.24.0,<2.0.0',
40+
'Pillow>=10.2.0,<10.3.0',
41+
'requests>=2.0.0,<3.0.0',
42+
'torch>=2.2.0,<2.3.0',
43+
'torchvision>=0.17.0,<0.18.0',
44+
'tqdm>=4.0.0,<5.0.0',
4345
],
4446
)

‎tests/actions_requirements.txt

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
numpy==1.23.3
2-
requests==2.25.1
3-
torch==1.13.1
4-
torchvision==0.14.1
5-
Pillow==9.4.0
6-
opencv-python>=4.1.0
7-
scipy==1.9.1
8-
pandas==1.4.4
9-
coverage==4.5.3
10-
codecov==2.0.15
1+
numpy>=1.24.0,<2.0.0
2+
requests>=2.0.0,<3.0.0
3+
torch>=2.2.0,<2.3.0
4+
torchvision>=0.17.0,<0.18.0
5+
Pillow>=10.2.0,<10.3.0
6+
opencv-python>=4.9.0
7+
scipy>=1.10.0,<2.0.0
8+
tqdm>=4.0.0,<5.0.0
9+
pandas>=2.0.0,<3.0.0
10+
coverage>=7.0.0,<8.0.0
11+
codecov>=2.0.0,<3.0.0
1112
jupyter>=1.0.0
12-
tensorboard>=1.14.0
13-
future>=0.17.1
13+
tensorboard>=2.0.0,<3.0.0
1414
./

0 commit comments

Comments
 (0)