From 513a3e8c5c4698f4375accc3e70fe56112d6e6ae Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Thu, 13 Feb 2025 18:42:58 +0100 Subject: [PATCH 1/4] Apply swh-py-template v0.3.3 with copier Bump development tools: mypy, codespell, isort, ... Move all tools configuration in pyproject.toml. Remove no longer needed mypy overrides. --- .copier-answers.yml | 2 +- .pre-commit-config.yaml | 12 ++++++------ mypy.ini | 14 -------------- pyproject.toml | 32 ++++++++++++++++++++++++++++++++ pytest.ini | 4 ---- setup.cfg | 8 -------- tox.ini | 6 ++++-- 7 files changed, 43 insertions(+), 35 deletions(-) delete mode 100644 mypy.ini delete mode 100644 pytest.ini delete mode 100644 setup.cfg diff --git a/.copier-answers.yml b/.copier-answers.yml index 97226e4d..a6e23626 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 Documentation distribution_name: swh-docs diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96512ea6..aa66426e 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 7823a866..00000000 --- a/mypy.ini +++ /dev/null @@ -1,14 +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-sphinx.*] -ignore_missing_imports = True - -# [mypy-add_your_lib_here.*] -# ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 8203425e..dd9d4e21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,3 +55,35 @@ known_first_party = ['swh'] [tool.codespell] ignore-words-list = "aks,crate" + +[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> +] +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 fe398a0b..00000000 --- a/pytest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[pytest] -norecursedirs = build docs .* -asyncio_mode = strict -consider_namespace_packages = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index adf9af3e..00000000 --- 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/tox.ini b/tox.ini index 71d171d7..7ea5b49e 100644 --- a/tox.ini +++ b/tox.ini @@ -40,7 +40,7 @@ commands = [testenv:black] skip_install = true deps = - black==24.8.0 + black==25.1.0 commands = {envpython} -m black --check swh @@ -48,7 +48,9 @@ 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 -- GitLab From 0d05bd733260e3beacc61eb221cf6020bb1315c3 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Thu, 13 Feb 2025 18:44:30 +0100 Subject: [PATCH 2/4] devel/contributing/gitlab: Remove trailing white space --- docs/devel/contributing/gitlab.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel/contributing/gitlab.rst b/docs/devel/contributing/gitlab.rst index 7a1961d0..e40dbba2 100644 --- a/docs/devel/contributing/gitlab.rst +++ b/docs/devel/contributing/gitlab.rst @@ -188,7 +188,7 @@ indicating that the release process is ongoing. Next, deployment container images are updated. -And finally a new merge request will automatically be created in +And finally a new merge request will automatically be created in `Helm charts for swh packages`_ so that the devops team can proceed with deployment. .. _Helm charts for swh packages: https://gitlab.softwareheritage.org/swh/infra/sysadm-environment -- GitLab From b96a8c97e99da13682f9125cc5c8044251d7a827 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Thu, 13 Feb 2025 18:44:57 +0100 Subject: [PATCH 3/4] software_origins: Fix black formatting --- swh/docs/software_origins.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swh/docs/software_origins.py b/swh/docs/software_origins.py index d29c9a96..0a49d4e9 100644 --- a/swh/docs/software_origins.py +++ b/swh/docs/software_origins.py @@ -3,8 +3,7 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -"""Parser for :file:`docs/devel/software-origins-support.yml` -""" +"""Parser for :file:`docs/devel/software-origins-support.yml`""" import collections from pathlib import Path -- GitLab From 80a7e46544d8b46b5116acd4fec1303a9797bcf4 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Thu, 13 Feb 2025 18:45:43 +0100 Subject: [PATCH 4/4] devel/index: Fix typo detected by codespell --- docs/devel/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel/index.rst b/docs/devel/index.rst index a3241cb0..c05bd864 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -88,7 +88,7 @@ Components Here is brief overview of the most relevant software components in the Software Heritage stack, in alphabetical order. For a better introduction to the architecture, see the :ref:`architecture-overview`, -which presents each of them in a didactical order. +which presents each of them in a didactic order. Each component name is linked to the development documentation of the corresponding Python module. -- GitLab