Skip to content

Commit

Permalink
Merge branch 'develop' into dev-define-engines-abc
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneahmed authored Feb 12, 2024
2 parents aaff1f8 + 23fb2a7 commit af05d15
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 120 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/mypy-type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ jobs:
tiatoolbox/__main__.py \
tiatoolbox/typing.py \
tiatoolbox/tiatoolbox.py \
tiatoolbox/utils/*.py
tiatoolbox/utils/*.py \
tiatoolbox/tools/__init__.py \
tiatoolbox/tools/stainextract.py \
tiatoolbox/tools/pyramid.py \
tiatoolbox/tools/tissuemask.py \
tiatoolbox/tools/graph.py
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
sudo apt update
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
python -m pip install --upgrade pip
python -m pip install ruff==0.1.13 pytest pytest-cov pytest-runner
python -m pip install ruff==0.2.1 pytest pytest-cov pytest-runner
pip install -r requirements/requirements.txt
- name: Cache tiatoolbox static assets
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ repos:
language: python
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.14
rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/annotation_nquery.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"from shapely.geometry import Polygon\n",
"\n",
"sys.path.append(\"..\") # If running locally without pypi installed tiatoolbox\n",
"from tiatoolbox.annotation.storage import ( # noqa: E402\n",
"from tiatoolbox.annotation.storage import (\n",
" Annotation,\n",
" AnnotationStore,\n",
" DictionaryStore,\n",
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/annotation_store.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@
"\n",
"sys.path.append(\"..\") # If running locally without pypi installed tiatoolbox\n",
"\n",
"from tiatoolbox import logger # noqa: E402\n",
"from tiatoolbox.annotation.storage import ( # noqa: E402\n",
"from tiatoolbox import logger\n",
"from tiatoolbox.annotation.storage import (\n",
" Annotation,\n",
" DictionaryStore,\n",
" SQLiteStore,\n",
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/annotation_store_alloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ def __exit__(self: memray, *args: object) -> None:
# Intentionally blank.


import numpy as np # noqa: E402
import psutil # noqa: E402
from shapely.geometry import Polygon # noqa: E402
from tqdm import tqdm # noqa: E402
import numpy as np
import psutil
from shapely.geometry import Polygon
from tqdm import tqdm

from tiatoolbox.annotation.storage import ( # noqa: E402
from tiatoolbox.annotation.storage import (
Annotation,
DictionaryStore,
SQLiteStore,
Expand Down
2 changes: 1 addition & 1 deletion examples/full-pipelines/slide-graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
"# https://docs.gdc.cancer.gov/Encyclopedia/pages/TCGA_Barcode/\n",
"wsi_patient_codes = np.array([\"-\".join(v.split(\"-\")[:3]) for v in wsi_names])\n",
"wsi_labels = np.array(\n",
" [clinical_info[v] if v in clinical_info else np.nan for v in wsi_patient_codes],\n",
" [clinical_info.get(v, np.nan) for v in wsi_patient_codes],\n",
")\n",
"\n",
"# * Filter the WSIs and paths that do not have labels\n",
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ search = 'TOOLBOX_VER: {current_version}'
replace = 'TOOLBOX_VER: {new_version}'

[tool.ruff]
select = [
lint.select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"D", # pydocstyle, need to enable for docstrings check.
Expand Down Expand Up @@ -126,13 +126,13 @@ select = [
"SLOT", # flake8-slots
"ASYNC", # flake8-async
]
ignore = []
lint.ignore = []
# Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []
lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
lint.unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
Expand All @@ -149,27 +149,27 @@ exclude = [
]

# Ignore `F401` (import violations) in all `__init__.py` files.
per-file-ignores = {"__init__.py" = ["F401"], "tests/*" = ["T201", "PGH001", "SLF001", "S101", "PLR2004"], "benchmarks/*" = ["T201", "INP001"], "pre-commit/*" = ["T201", "INP001"], "tiatoolbox/cli/*" = ["PLR0913"]}
lint.per-file-ignores = {"__init__.py" = ["F401"], "tests/*" = ["T201", "PGH001", "SLF001", "S101", "PLR2004"], "benchmarks/*" = ["T201", "INP001"], "pre-commit/*" = ["T201", "INP001"], "tiatoolbox/cli/*" = ["PLR0913"]}

# Same as Black.
line-length = 88

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Minimum Python version 3.8.
target-version = "py38"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 14

# need to enable for docstrings check.
[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-args = 10

[tool.mypy]
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pytest>=7.2.0
pytest-cov>=4.0.0
pytest-runner>=6.0
pytest-xdist[psutil]
ruff==0.1.13 # This will be updated by pre-commit bot to latest version
ruff==0.2.1 # This will be updated by pre-commit bot to latest version
toml>=0.10.2
twine>=4.0.1
wheel>=0.37.1
Loading

0 comments on commit af05d15

Please sign in to comment.