Skip to content

Commit

Permalink
Use functools.lru_cache instead of functools.cache (for python 3.8) a…
Browse files Browse the repository at this point in the history
…nd 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
  • Loading branch information
kaczmarj authored Jul 14, 2023
1 parent 7b94e20 commit 7435271
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: ci

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install wsinfer-zoo
run: python -m pip install -e .[dev]
- name: Check style (flake8)
run: python -m flake8 wsinfer_zoo/
- name: Check style (black)
run: python -m black --check wsinfer_zoo/
- name: Check types
run: python -m mypy --install-types --non-interactive wsinfer_zoo/
- name: Run the command line
run: |
wsinfer-zoo --help
wsinfer-zoo ls
- name: Attempt to download a model
run: wsinfer-zoo get prostate-tumor-resnet34.tcga-prad
6 changes: 5 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers =
packages = find:
python_requires = >= 3.7
install_requires =
click>=8.0,<9
click>=8.0,<9,!=8.1.4,!=8.1.5
huggingface_hub
jsonschema
tabulate
Expand All @@ -58,6 +58,10 @@ max-line-length = 88
extend-ignore = E203
exclude = wsinfer_zoo/_version.py

[mypy]
[mypy-huggingface_hub]
ignore_missing_imports = True

[versioneer]
VCS = git
style = pep440
Expand Down
2 changes: 1 addition & 1 deletion wsinfer_zoo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def from_dict(cls, config: Dict) -> "ModelRegistry":
return cls(models=models)


@functools.cache
@functools.lru_cache()
def load_registry(registry_file: Optional[Union[str, Path]] = None) -> ModelRegistry:
"""Load model registry.
Expand Down

0 comments on commit 7435271

Please sign in to comment.