diff --git a/.copier-answers.yml b/.copier-answers.yml index 1c8c2273bd7445e0dc88bca3229b7090e1051027..db9b273686e38e9d9a0006efda089f32bb7ef312 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.2.3 +_commit: v0.3.3 _src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git description: Software Heritage datastore scrubber distribution_name: swh-scrubber diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96512ea6cd1c0b6a1f8ee92964702310b7f548fe..aa66426e227d390806a91436fcaf2d540be69c0d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: check-json - id: check-yaml - repo: https://github.com/python/black - rev: 24.8.0 + rev: 25.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.0 hooks: - id: isort @@ -20,16 +20,16 @@ repos: rev: 7.1.1 hooks: - id: flake8 - additional_dependencies: [flake8-bugbear==24.4.26] + additional_dependencies: [flake8-bugbear==24.12.12, flake8-pyproject] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell name: Check source code spelling additional_dependencies: - tomli - stages: [commit] + stages: [pre-commit] - id: codespell name: Check commit message spelling additional_dependencies: diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 676925ac58e65a726e0e9bdc3bc77dd855f578b4..0000000000000000000000000000000000000000 --- a/mypy.ini +++ /dev/null @@ -1,23 +0,0 @@ -[mypy] -namespace_packages = True -warn_unused_ignores = True -explicit_package_bases = True -# ^ Needed for mypy to detect py.typed from swh packages installed -# in editable mode - -# 3rd party libraries without stubs (yet) - -[mypy-dulwich.*] -ignore_missing_imports = True - -[mypy-msgpack.*] -ignore_missing_imports = True - -[mypy-pkg_resources.*] -ignore_missing_imports = True - -[mypy-psycopg2.*] -ignore_missing_imports = True - -# [mypy-add_your_lib_here.*] -# ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index ffbad94e7c63f4a6d90410fa8c3b364ca04bc3d6..384bc8ec612de512c12e084abaa00d6a056a75dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,3 +60,36 @@ known_first_party = ['swh'] [tool.codespell] ignore-words-list = "mor" + +[tool.mypy] +namespace_packages = true +warn_unused_ignores = true +explicit_package_bases = true +# ^ Needed for mypy to detect py.typed from swh packages installed +# in editable mode + +plugins = [] + +# 3rd party libraries without stubs (yet) +# [[tool.mypy.overrides]] +# module = [ +# "package1.*", +# "package2.*", +# ] +# ignore_missing_imports = true + +[tool.flake8] +select = ["C", "E", "F", "W", "B950"] +ignore = [ + "E203", # whitespaces before ':' <https://github.com/psf/black/issues/315> + "E231", # missing whitespace after ',' + "E501", # line too long, use B950 warning from flake8-bugbear instead + "W503", # line break before binary operator <https://github.com/psf/black/issues/52> + "E704", # multiple statements on one line (def) +] +max-line-length = 88 + +[tool.pytest.ini_options] +norecursedirs = "build docs .*" +asyncio_mode = "strict" +consider_namespace_packages = true diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index fe398a0babf5a774f332240c7ce22d38f7330ba1..0000000000000000000000000000000000000000 --- a/pytest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[pytest] -norecursedirs = build docs .* -asyncio_mode = strict -consider_namespace_packages = true diff --git a/requirements-test.txt b/requirements-test.txt index 2e569e9859fe6c56600c79354569227eea63dbff..183919e003e6cdd8bb6cebe3e026ab808b0fcc90 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -4,3 +4,4 @@ pytest-mock pyyaml swh.core[testing] >= 3.0.0 swh.graph +msgpack-types diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index adf9af3e48c7da13135e5dfb6505a1909bc26066..0000000000000000000000000000000000000000 --- a/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[flake8] -# E203: whitespaces before ':' <https://github.com/psf/black/issues/315> -# E231: missing whitespace after ',' -# E501: line too long, use B950 warning from flake8-bugbear instead -# W503: line break before binary operator <https://github.com/psf/black/issues/52> -select = C,E,F,W,B950 -ignore = E203,E231,E501,E704,W503 -max-line-length = 88 diff --git a/swh/scrubber/cli.py b/swh/scrubber/cli.py index 7cb27b7678c3d3e555d23fda53848d34fcad4b1e..739cc4e54639b5ae3dcee3021b6fbe19a63b9702 100644 --- a/swh/scrubber/cli.py +++ b/swh/scrubber/cli.py @@ -321,7 +321,7 @@ def scrubber_check_stalled( for partition, stuck_since in in_flight: click.echo( f"{partition}:\tstuck since {naturaldate(stuck_since)} " - f"({naturaldelta(now-stuck_since)})" + f"({naturaldelta(now - stuck_since)})" ) if reset: if db.checked_partition_reset(config_id, partition): @@ -374,7 +374,7 @@ def scrubber_check_running(ctx, name: str, config_id: int): for partition, running_since in in_flight: click.echo( f"{partition}:\trunning since {naturaldate(running_since)} " - f"({naturaldelta(now-running_since)})" + f"({naturaldelta(now - running_since)})" ) else: click.echo( diff --git a/tox.ini b/tox.ini index ed5e64993f16560f865cbd897c6c1d97d3213f61..cf07be984d935dfc7ed00e9356efe9a43ba89891 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ commands = [testenv:black] skip_install = true deps = - black==24.8.0 + black==25.1.0 commands = {envpython} -m black --check swh @@ -33,8 +33,10 @@ commands = skip_install = true deps = flake8==7.1.1 - flake8-bugbear==24.4.26 + flake8-bugbear==24.12.12 + flake8-pyproject==1.2.3 pycodestyle==2.12.1 + commands = {envpython} -m flake8 @@ -42,7 +44,7 @@ commands = extras = testing deps = - mypy==1.11.1 + mypy==1.15.0 commands = mypy swh