Skip to content

Commit 7435271

Browse files
authored
Use functools.lru_cache instead of functools.cache (for python 3.8) and add github actions CI (#7)
* use functools.lru_cache to please python 3.8 fixes #6 * ignore mypy huggingface-hub * add basic tests for ci * limit click versions to please mypy related to pallets/click#2558
1 parent 7b94e20 commit 7435271

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

.github/workflows/ci.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install wsinfer-zoo
22+
run: python -m pip install -e .[dev]
23+
- name: Check style (flake8)
24+
run: python -m flake8 wsinfer_zoo/
25+
- name: Check style (black)
26+
run: python -m black --check wsinfer_zoo/
27+
- name: Check types
28+
run: python -m mypy --install-types --non-interactive wsinfer_zoo/
29+
- name: Run the command line
30+
run: |
31+
wsinfer-zoo --help
32+
wsinfer-zoo ls
33+
- name: Attempt to download a model
34+
run: wsinfer-zoo get prostate-tumor-resnet34.tcga-prad

setup.cfg

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ classifiers =
3131
packages = find:
3232
python_requires = >= 3.7
3333
install_requires =
34-
click>=8.0,<9
34+
click>=8.0,<9,!=8.1.4,!=8.1.5
3535
huggingface_hub
3636
jsonschema
3737
tabulate
@@ -58,6 +58,10 @@ max-line-length = 88
5858
extend-ignore = E203
5959
exclude = wsinfer_zoo/_version.py
6060

61+
[mypy]
62+
[mypy-huggingface_hub]
63+
ignore_missing_imports = True
64+
6165
[versioneer]
6266
VCS = git
6367
style = pep440

wsinfer_zoo/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def from_dict(cls, config: Dict) -> "ModelRegistry":
285285
return cls(models=models)
286286

287287

288-
@functools.cache
288+
@functools.lru_cache()
289289
def load_registry(registry_file: Optional[Union[str, Path]] = None) -> ModelRegistry:
290290
"""Load model registry.
291291

0 commit comments

Comments
 (0)