diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94bd6dce..38f377f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/kynan/nbstripout @@ -22,12 +22,12 @@ repos: args: ["--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'"] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.252' + rev: 'v0.0.284' hooks: - id: ruff args: ["--fix"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.5 hooks: - id: codespell additional_dependencies: diff --git a/requirements/base.txt b/requirements/base.txt index f1b65d73..606cd943 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -13,39 +13,43 @@ cffi==1.15.1 # via # cryptography # pynacl -charset-normalizer==3.1.0 +charset-normalizer==3.2.0 # via requests cryptography==41.0.3 # via paramiko decorator==5.1.1 # via fabric -dnspython==2.3.0 +deprecated==1.2.14 + # via fabric +dnspython==2.4.2 # via email-validator email-validator==2.0.0.post2 - # via -r base.in -fabric==3.1.0 - # via -r base.in + # via -r requirements/base.in +fabric==3.2.1 + # via -r requirements/base.in idna==3.4 # via # email-validator # requests -invoke==2.1.3 +invoke==2.2.0 # via fabric -paramiko==3.2.0 +paramiko==3.3.1 # via fabric pycparser==2.21 # via cffi -pydantic==1.10.11 - # via -r base.in +pydantic==1.10.12 + # via -r requirements/base.in pynacl==1.5.0 # via paramiko python-dateutil==2.8.2 - # via -r base.in + # via -r requirements/base.in requests==2.31.0 - # via -r base.in + # via -r requirements/base.in six==1.16.0 # via python-dateutil typing-extensions==4.7.1 # via pydantic -urllib3==2.0.3 +urllib3==2.0.4 # via requests +wrapt==1.15.0 + # via deprecated diff --git a/requirements/ci.txt b/requirements/ci.txt index df196524..9eb1c122 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -7,11 +7,11 @@ # cachetools==5.3.1 # via tox -chardet==5.1.0 +chardet==5.2.0 # via tox colorama==0.4.6 # via tox -distlib==0.3.6 +distlib==0.3.7 # via virtualenv filelock==3.12.2 # via @@ -21,15 +21,15 @@ packaging==23.1 # via # pyproject-api # tox -platformdirs==3.8.0 +platformdirs==3.10.0 # via # tox # virtualenv pluggy==1.2.0 # via tox -pyproject-api==1.5.2 +pyproject-api==1.5.3 # via tox -tox==4.6.3 +tox==4.9.0 # via -r requirements/ci.in -virtualenv==20.23.1 +virtualenv==20.24.3 # via tox diff --git a/requirements/dev.in b/requirements/dev.in index 96a6053f..e813f490 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -6,7 +6,8 @@ -r wheels.in black jinja2 -jupyterlab == 3.5.3 # newer has broken dependency on y-py +jupyterlab +mypy pip-compile-multi pre-commit pyyaml diff --git a/requirements/dev.txt b/requirements/dev.txt index 8b62aa28..ce049f20 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -# SHA1:31304de61247705152d0b8ea537e673329d56cc6 +# SHA1:b62c9a475aba9d9670699cc82bd70677b04f2c52 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -13,76 +13,68 @@ -r wheels.txt anyio==3.7.1 # via jupyter-server -argon2-cffi==21.3.0 - # via - # jupyter-server - # nbclassic - # notebook +argon2-cffi==23.1.0 + # via jupyter-server argon2-cffi-bindings==21.2.0 # via argon2-cffi arrow==1.2.3 # via isoduration -black==23.3.0 +async-lru==2.0.4 + # via jupyterlab +black==23.7.0 # via -r requirements/dev.in -click==8.1.3 +click==8.1.6 # via # black # pip-compile-multi # pip-tools fqdn==1.5.1 # via jsonschema -ipython-genutils==0.2.0 - # via - # nbclassic - # notebook isoduration==20.11.0 # via jsonschema json5==0.9.14 # via jupyterlab-server jsonpointer==2.4 # via jsonschema -jsonschema[format-nongpl]==4.18.0 +jsonschema[format-nongpl]==4.19.0 # via # jupyter-events # jupyterlab-server # nbformat -jupyter-events==0.6.3 +jupyter-events==0.7.0 # via jupyter-server -jupyter-server==2.7.0 +jupyter-lsp==2.2.0 + # via jupyterlab +jupyter-server==2.7.1 # via + # jupyter-lsp # jupyterlab # jupyterlab-server - # nbclassic # notebook-shim jupyter-server-terminals==0.4.4 # via jupyter-server -jupyterlab==3.5.3 +jupyterlab==4.0.5 # via -r requirements/dev.in -jupyterlab-server==2.23.0 +jupyterlab-server==2.24.0 # via jupyterlab +mypy==1.5.1 + # via -r requirements/dev.in mypy-extensions==1.0.0 - # via black -nbclassic==1.0.0 # via - # jupyterlab - # notebook -notebook==6.5.4 - # via jupyterlab + # black + # mypy notebook-shim==0.2.3 - # via nbclassic -overrides==7.3.1 + # via jupyterlab +overrides==7.4.0 # via jupyter-server -pathspec==0.11.1 +pathspec==0.11.2 # via black pip-compile-multi==2.6.3 # via -r requirements/dev.in -pip-tools==6.14.0 +pip-tools==7.3.0 # via pip-compile-multi -prometheus-client==0.17.0 - # via - # jupyter-server - # nbclassic - # notebook +prometheus-client==0.17.1 + # via jupyter-server python-json-logger==2.0.7 # via jupyter-events rfc3339-validator==0.1.4 @@ -94,33 +86,26 @@ rfc3986-validator==0.1.1 # jsonschema # jupyter-events send2trash==1.8.2 - # via - # jupyter-server - # nbclassic - # notebook + # via jupyter-server sniffio==1.3.0 # via anyio terminado==0.17.1 # via # jupyter-server # jupyter-server-terminals - # nbclassic - # notebook -tomli==2.0.1 - # via jupyterlab toposort==1.10 # via pip-compile-multi -types-docutils==0.20.0.1 +types-docutils==0.20.0.3 # via -r requirements/dev.in -types-paramiko==3.2.0.0 +types-paramiko==3.3.0.0 # via -r requirements/dev.in -types-python-dateutil==2.8.19.13 +types-python-dateutil==2.8.19.14 # via -r requirements/dev.in -types-pyyaml==6.0.12.10 +types-pyyaml==6.0.12.11 # via -r requirements/dev.in -types-requests==2.31.0.1 +types-requests==2.31.0.2 # via -r requirements/dev.in -types-urllib3==1.26.25.13 +types-urllib3==1.26.25.14 # via types-requests uri-template==1.3.0 # via jsonschema @@ -128,10 +113,8 @@ webcolors==1.13 # via jsonschema websocket-client==1.6.1 # via jupyter-server -wheel==0.40.0 - # via - # pip-tools - # sphinx-copybutton +wheel==0.41.1 + # via pip-tools # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/docs.in b/requirements/docs.in index cb2534ac..caf08cb3 100644 --- a/requirements/docs.in +++ b/requirements/docs.in @@ -6,7 +6,7 @@ ipython!=8.7.0 # Breaks syntax highlighting in Jupyter code cells. myst-parser nbsphinx pydata-sphinx-theme>=0.13 -sphinx +sphinx==7.1 # 7.2 is not compatible with theme sphinx-autodoc-typehints sphinx-copybutton sphinx-design diff --git a/requirements/docs.txt b/requirements/docs.txt index 5af5f36f..633a4476 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,96 +1,57 @@ -# SHA1:474295e0c4867854b6e88f97999afd837bbf45ed +# SHA1:330f38cb197740f43425c68384e5bd0b8ba57335 # # This file is autogenerated by pip-compile-multi # To update, run: # # pip-compile-multi # +-r base.txt +-r test.txt accessible-pygments==0.0.4 # via pydata-sphinx-theme alabaster==0.7.13 # via sphinx asttokens==2.2.1 # via stack-data -attrs==23.1.0 - # via - # hypothesis - # jsonschema - # referencing autodoc-pydantic==1.9.0 - # via -r docs.in + # via -r requirements/docs.in babel==2.12.1 # via # pydata-sphinx-theme # sphinx backcall==0.2.0 # via ipython -bcrypt==4.0.1 - # via paramiko beautifulsoup4==4.12.2 # via # nbconvert # pydata-sphinx-theme bleach==6.0.0 # via nbconvert -certifi==2023.7.22 - # via requests -cffi==1.15.1 - # via - # cryptography - # pynacl -charset-normalizer==3.1.0 - # via requests -comm==0.1.3 +comm==0.1.4 # via ipykernel -cryptography==41.0.3 - # via paramiko -debugpy==1.6.7 +debugpy==1.6.7.post1 # via ipykernel -decorator==5.1.1 - # via - # fabric - # ipython defusedxml==0.7.1 # via nbconvert -dnspython==2.3.0 - # via email-validator -docutils==0.19 +docutils==0.20.1 # via # myst-parser # nbsphinx # pydata-sphinx-theme # sphinx -email-validator==2.0.0.post2 - # via -r base.in -execnet==1.9.0 - # via pytest-xdist executing==1.2.0 # via stack-data -fabric==3.1.0 - # via -r base.in -fastjsonschema==2.17.1 +fastjsonschema==2.18.0 # via nbformat -filelock==3.12.2 - # via -r test.in -hypothesis==6.80.0 - # via -r test.in -idna==3.4 - # via - # email-validator - # requests imagesize==1.4.1 # via sphinx -iniconfig==2.0.0 - # via pytest -invoke==2.1.3 - # via fabric -ipykernel==6.24.0 - # via -r docs.in +ipykernel==6.25.1 + # via -r requirements/docs.in ipython==8.14.0 # via - # -r docs.in + # -r requirements/docs.in # ipykernel -jedi==0.18.2 +jedi==0.19.0 # via ipython jinja2==3.1.2 # via @@ -98,9 +59,9 @@ jinja2==3.1.2 # nbconvert # nbsphinx # sphinx -jsonschema==4.18.0 +jsonschema==4.19.0 # via nbformat -jsonschema-specifications==2023.6.1 +jsonschema-specifications==2023.7.1 # via jsonschema jupyter-client==8.3.0 # via @@ -134,41 +95,30 @@ mdurl==0.1.2 mistune==3.0.1 # via nbconvert myst-parser==2.0.0 - # via -r docs.in + # via -r requirements/docs.in nbclient==0.8.0 # via nbconvert -nbconvert==7.6.0 +nbconvert==7.7.4 # via nbsphinx -nbformat==5.9.0 +nbformat==5.9.2 # via # nbclient # nbconvert # nbsphinx nbsphinx==0.9.2 - # via -r docs.in -nest-asyncio==1.5.6 + # via -r requirements/docs.in +nest-asyncio==1.5.7 # via ipykernel -packaging==23.1 - # via - # ipykernel - # nbconvert - # pydata-sphinx-theme - # pytest - # sphinx pandocfilters==1.5.0 # via nbconvert -paramiko==3.2.0 - # via fabric parso==0.8.3 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython -platformdirs==3.8.0 +platformdirs==3.10.0 # via jupyter-core -pluggy==1.2.0 - # via pytest prompt-toolkit==3.0.39 # via ipython psutil==5.9.5 @@ -177,72 +127,34 @@ ptyprocess==0.7.0 # via pexpect pure-eval==0.2.2 # via stack-data -pycparser==2.21 - # via cffi -pydantic==1.10.11 - # via - # -r base.in - # autodoc-pydantic pydata-sphinx-theme==0.13.3 - # via -r docs.in -pyfakefs==5.2.2 - # via -r test.in -pygments==2.15.1 + # via -r requirements/docs.in +pygments==2.16.1 # via # accessible-pygments # ipython # nbconvert # pydata-sphinx-theme # sphinx -pynacl==1.5.0 - # via paramiko -pytest==7.4.0 - # via - # -r test.in - # pytest-randomly - # pytest-xdist -pytest-randomly==3.12.0 - # via -r test.in -pytest-xdist==3.3.1 - # via -r test.in -python-dateutil==2.8.2 - # via - # -r base.in - # jupyter-client -pyyaml==6.0 - # via - # -r test.in - # myst-parser -pyzmq==25.1.0 +pyzmq==25.1.1 # via # ipykernel # jupyter-client -referencing==0.29.1 +referencing==0.30.2 # via # jsonschema # jsonschema-specifications -requests==2.31.0 - # via - # -r base.in - # sphinx -rpds-py==0.8.7 +rpds-py==0.9.2 # via # jsonschema # referencing -six==1.16.0 - # via - # asttokens - # bleach - # python-dateutil snowballstemmer==2.2.0 # via sphinx -sortedcontainers==2.4.0 - # via hypothesis soupsieve==2.4.1 # via beautifulsoup4 -sphinx==6.2.1 +sphinx==7.1.0 # via - # -r docs.in + # -r requirements/docs.in # autodoc-pydantic # myst-parser # nbsphinx @@ -250,23 +162,28 @@ sphinx==6.2.1 # sphinx-autodoc-typehints # sphinx-copybutton # sphinx-design -sphinx-autodoc-typehints==1.23.0 - # via -r docs.in + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinx-autodoc-typehints==1.24.0 + # via -r requirements/docs.in sphinx-copybutton==0.5.2 - # via -r docs.in -sphinx-design==0.4.1 - # via -r docs.in -sphinxcontrib-applehelp==1.0.4 + # via -r requirements/docs.in +sphinx-design==0.5.0 + # via -r requirements/docs.in +sphinxcontrib-applehelp==1.0.7 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.4 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.8 # via sphinx stack-data==0.6.2 # via ipython @@ -288,12 +205,6 @@ traitlets==5.9.0 # nbconvert # nbformat # nbsphinx -typing-extensions==4.7.1 - # via - # pydantic - # pydata-sphinx-theme -urllib3==2.0.3 - # via requests wcwidth==0.2.6 # via prompt-toolkit webencodings==0.5.1 diff --git a/requirements/static.txt b/requirements/static.txt index 5a5e1ef4..8362c2f8 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -5,23 +5,23 @@ # # pip-compile-multi # -cfgv==3.3.1 +cfgv==3.4.0 # via pre-commit -distlib==0.3.6 +distlib==0.3.7 # via virtualenv filelock==3.12.2 # via virtualenv -identify==2.5.24 +identify==2.5.26 # via pre-commit nodeenv==1.8.0 # via pre-commit -platformdirs==3.8.0 +platformdirs==3.10.0 # via virtualenv pre-commit==3.3.3 # via -r requirements/static.in -pyyaml==6.0 +pyyaml==6.0.1 # via pre-commit -virtualenv==20.23.1 +virtualenv==20.24.3 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/test.txt b/requirements/test.txt index c5a319eb..1f71a303 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -8,11 +8,11 @@ -r base.txt attrs==23.1.0 # via hypothesis -execnet==1.9.0 +execnet==2.0.2 # via pytest-xdist filelock==3.12.2 # via -r requirements/test.in -hypothesis==6.80.0 +hypothesis==6.82.4 # via -r requirements/test.in iniconfig==2.0.0 # via pytest @@ -20,18 +20,18 @@ packaging==23.1 # via pytest pluggy==1.2.0 # via pytest -pyfakefs==5.2.2 +pyfakefs==5.2.3 # via -r requirements/test.in pytest==7.4.0 # via # -r requirements/test.in # pytest-randomly # pytest-xdist -pytest-randomly==3.12.0 +pytest-randomly==3.15.0 # via -r requirements/test.in pytest-xdist==3.3.1 # via -r requirements/test.in -pyyaml==6.0 +pyyaml==6.0.1 # via -r requirements/test.in sortedcontainers==2.4.0 # via hypothesis diff --git a/src/scitacean/_base_model.py b/src/scitacean/_base_model.py index fed457c8..7906dd73 100644 --- a/src/scitacean/_base_model.py +++ b/src/scitacean/_base_model.py @@ -50,7 +50,7 @@ class BaseModel(pydantic.BaseModel): class Config: extra = pydantic.Extra.forbid - json_encoders = { + json_encoders = { # noqa: RUF012 PID: lambda v: str(v), RemotePath: lambda v: v.posix, } diff --git a/src/scitacean/_internal/docker.py b/src/scitacean/_internal/docker.py index e5b19d6a..efa0772e 100644 --- a/src/scitacean/_internal/docker.py +++ b/src/scitacean/_internal/docker.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 SciCat Project (https://github.com/SciCatProject/scitacean) +# ruff: noqa: S603, S607 """Helpers to manage docker containers. Primarily meant for testing. diff --git a/src/scitacean/file.py b/src/scitacean/file.py index d1f74c40..e9c6079e 100644 --- a/src/scitacean/file.py +++ b/src/scitacean/file.py @@ -230,7 +230,8 @@ def local_is_up_to_date(self) -> bool: "No checksum algorithm has been set, using the default 'blake2b' " f"to check if local file '{self.local_path}' is up to date. " "There is a very low chance that this yields a false positive " - "and the file is incorrect. Set an algorithm manually to avoid this." + "and the file is incorrect. Set an algorithm manually to avoid this.", + stacklevel=2, ) return self._local_is_up_to_date_with_checksum_algorithm("blake2b") return self._local_is_up_to_date_with_checksum_algorithm( diff --git a/src/scitacean/testing/backend/seed.py b/src/scitacean/testing/backend/seed.py index 98460134..42691424 100644 --- a/src/scitacean/testing/backend/seed.py +++ b/src/scitacean/testing/backend/seed.py @@ -277,6 +277,6 @@ def save_seed(target_dir: Path) -> None: def seed_worker(target_dir: Path) -> None: """Load the processed seed from a file.""" with open(target_dir / "seed", "rb") as f: - loaded = pickle.load(f) + loaded = pickle.load(f) # noqa: S301 INITIAL_DATASETS.update(loaded["datasets"]) INITIAL_ORIG_DATABLOCKS.update(loaded["orig_datablocks"]) diff --git a/src/scitacean/testing/ssh/__init__.py b/src/scitacean/testing/ssh/__init__.py index dc37b305..56362547 100644 --- a/src/scitacean/testing/ssh/__init__.py +++ b/src/scitacean/testing/ssh/__init__.py @@ -95,7 +95,7 @@ def test_ssh_upload( of the docker container between processes. This is required when ``pytest-xdist`` is used. Otherwise, those files will not be present. -""" # noqa: E501 +""" from ._pytest_helpers import add_pytest_option, skip_if_not_ssh, ssh_enabled from ._ssh import ( diff --git a/src/scitacean/util/credentials.py b/src/scitacean/util/credentials.py index a4158874..f40501ea 100644 --- a/src/scitacean/util/credentials.py +++ b/src/scitacean/util/credentials.py @@ -122,5 +122,5 @@ def _is_expired(self) -> bool: def __repr__(self) -> str: return ( f"TimeLimitedStr(expires_at={self._expires_at.isoformat()}, " - f"value={repr(self._value)}" + f"value={self._value!r}" ) diff --git a/tests/dataset_fields_test.py b/tests/dataset_fields_test.py index f8221419..7dea8fd7 100644 --- a/tests/dataset_fields_test.py +++ b/tests/dataset_fields_test.py @@ -223,13 +223,13 @@ def test_init_from_models_sets_files(): assert dset.packed_size == 0 assert dset.size == 6123 + 551 - f0 = [f for f in dset.files if f.remote_path.suffix == ".dat"][0] + (f0,) = [f for f in dset.files if f.remote_path.suffix == ".dat"] assert f0.remote_access_path(dset.source_folder) == "/hex/source91/file1.dat" assert f0.local_path is None assert f0.size == 6123 assert f0.make_model().path == "file1.dat" - f1 = [f for f in dset.files if f.remote_path.suffix == ".png"][0] + (f1,) = [f for f in dset.files if f.remote_path.suffix == ".png"] assert f1.remote_access_path(dset.source_folder) == "/hex/source91/sub/file2.png" assert f1.local_path is None assert f1.size == 551 @@ -290,13 +290,13 @@ def test_init_from_models_sets_files_multi_datablocks(): assert dset.packed_size == 0 assert dset.size == 6123 + 992 - f0 = [f for f in dset.files if f.remote_path.suffix == ".dat"][0] + (f0,) = [f for f in dset.files if f.remote_path.suffix == ".dat"] assert f0.remote_access_path(dset.source_folder) == "/hex/source91/file1.dat" assert f0.local_path is None assert f0.size == 6123 assert f0.make_model().path == "file1.dat" - f1 = [f for f in dset.files if f.remote_path.suffix == ".png"][0] + (f1,) = [f for f in dset.files if f.remote_path.suffix == ".png"] assert f1.remote_access_path(dset.source_folder) == "/hex/source91/sub/file2.png" assert f1.local_path is None assert f1.size == 992 diff --git a/tools/model-generation/generate_models.py b/tools/model-generation/generate_models.py index 99098f5f..3d7fd195 100644 --- a/tools/model-generation/generate_models.py +++ b/tools/model-generation/generate_models.py @@ -74,7 +74,8 @@ def format_with_black(path: Path) -> None: # Root of Scitacean repo base_path = Path(__file__).resolve().parent.parent.parent subprocess.check_call( - ["black", path.resolve().relative_to(base_path)], cwd=base_path + ["black", path.resolve().relative_to(base_path)], # noqa: S603, S607 + cwd=base_path, )