From 92e2eb8501eabcf95ad9ebce48d293464cd78c43 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Mon, 19 Oct 2026 11:28:49 +0200 Subject: [PATCH] style: enforce MPL header --- docs/conf.py | 1 + pyproject.toml | 3 +++ scripts/sync_brand_tokens.py | 1 + src/scverse_doc/__init__.py | 1 + src/scverse_doc/_color.py | 1 + src/scverse_doc/autodoc/__init__.py | 1 + src/scverse_doc/config.py | 1 + src/scverse_doc/napoleon.py | 1 + src/scverse_doc/registry.py | 1 + src/scverse_doc/source.py | 1 + src/scverse_doc/theme/__init__.py | 1 + tests/roots/autodoc/apimod.py | 1 + tests/roots/autodoc/apipkg/__init__.py | 1 + tests/roots/autodoc/apipkg/sub/__init__.py | 1 + tests/roots/autodoc/apipkg/sub/deep.py | 1 + tests/roots/autodoc/conf.py | 1 + tests/roots/entry-point/conf.py | 1 + tests/roots/minimal/conf.py | 1 + tests/roots/override/conf.py | 1 + tests/test_build.py | 1 + tests/test_color.py | 1 + tests/test_registry.py | 1 + tests/test_source.py | 1 + 23 files changed, 25 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 3eb2fab..01448d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """Sphinx docs configuration.""" project = "scverse-doc" diff --git a/pyproject.toml b/pyproject.toml index 2794788..8291471 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,6 +125,7 @@ lint.select = [ "B", # flake8-bugbear "BLE", # flake8-blind-except "C4", # flake8-comprehensions + "CPY", # flake8-copyright "D", # pydocstyle "E", # Error detected by Pycodestyle "F", # Errors detected by Pyflakes @@ -149,8 +150,10 @@ lint.ignore = [ "E741", # allow I, O, l as variable names -> I is the identity matrix "TID252", # Allow relative imports ] +lint.per-file-ignores."**/*.ipynb" = [ "CPY001" ] # Missing copyright notice in notebook is fine lint.per-file-ignores."docs/*" = [ "I" ] lint.per-file-ignores."tests/*" = [ "D" ] +lint.flake8-copyright.notice-rgx = "SPDX-License-Identifier: MPL-2\\.0" lint.pydocstyle.convention = "numpy" [tool.mypy] diff --git a/scripts/sync_brand_tokens.py b/scripts/sync_brand_tokens.py index d24b820..124972d 100755 --- a/scripts/sync_brand_tokens.py +++ b/scripts/sync_brand_tokens.py @@ -1,4 +1,5 @@ #!/usr/bin/env -S uv run --script +# SPDX-License-Identifier: MPL-2.0 # /// script # requires-python = ">=3.12" # dependencies = [] diff --git a/src/scverse_doc/__init__.py b/src/scverse_doc/__init__.py index d2d80bf..4e92be3 100644 --- a/src/scverse_doc/__init__.py +++ b/src/scverse_doc/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The scverse Sphinx theme and shared documentation configuration. A package’s `conf.py` needs few lines: diff --git a/src/scverse_doc/_color.py b/src/scverse_doc/_color.py index e8b056e..8231500 100644 --- a/src/scverse_doc/_color.py +++ b/src/scverse_doc/_color.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """Colour maths for deriving accessible accent shades. Package accents are chosen for brand recognition, not for contrast. diff --git a/src/scverse_doc/autodoc/__init__.py b/src/scverse_doc/autodoc/__init__.py index 68de4c8..f6bf3c9 100644 --- a/src/scverse_doc/autodoc/__init__.py +++ b/src/scverse_doc/autodoc/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The layout of the API pages. Ships :mod:`~sphinx.ext.autosummary` templates for modules and classes. diff --git a/src/scverse_doc/config.py b/src/scverse_doc/config.py index b58d440..5489f78 100644 --- a/src/scverse_doc/config.py +++ b/src/scverse_doc/config.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The extension stack and the shared defaults. Sets up the extensions in :data:`EXTENSIONS`, so `conf.py` lists only ``scverse_doc``, diff --git a/src/scverse_doc/napoleon.py b/src/scverse_doc/napoleon.py index 886b9a2..9e3e894 100644 --- a/src/scverse_doc/napoleon.py +++ b/src/scverse_doc/napoleon.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """Prose return sections in NumPy-style docstrings. :mod:`sphinx.ext.napoleon` reads a NumPy-style ``Returns`` section as a list of ``name : type`` entries. diff --git a/src/scverse_doc/registry.py b/src/scverse_doc/registry.py index 2c5fb9d..5d8a145 100644 --- a/src/scverse_doc/registry.py +++ b/src/scverse_doc/registry.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The scverse package registry. :data:`packages` and :func:`core_packages` give the `listed packages`_ as :class:`Package` objects; diff --git a/src/scverse_doc/source.py b/src/scverse_doc/source.py index b07ad5c..dd7d1a9 100644 --- a/src/scverse_doc/source.py +++ b/src/scverse_doc/source.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """Links into the source repository: the repository icon, “edit this page”, and ``[source]``. Declare the repository with :confval:`source_repository`. diff --git a/src/scverse_doc/theme/__init__.py b/src/scverse_doc/theme/__init__.py index 269d909..10e5e26 100644 --- a/src/scverse_doc/theme/__init__.py +++ b/src/scverse_doc/theme/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The scverse theme: brand chrome, the per-package accent, and the ecosystem dropdown. :mod:`scverse_doc` selects this theme; on its own, set ``html_theme = "scverse"``. diff --git a/tests/roots/autodoc/apimod.py b/tests/roots/autodoc/apimod.py index 510700e..cd33e87 100644 --- a/tests/roots/autodoc/apimod.py +++ b/tests/roots/autodoc/apimod.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """A module to document.""" from typing import Generic, TypeVar diff --git a/tests/roots/autodoc/apipkg/__init__.py b/tests/roots/autodoc/apipkg/__init__.py index 30b87bc..c9c700b 100644 --- a/tests/roots/autodoc/apipkg/__init__.py +++ b/tests/roots/autodoc/apipkg/__init__.py @@ -1 +1,2 @@ +# SPDX-License-Identifier: MPL-2.0 """A package to document recursively.""" diff --git a/tests/roots/autodoc/apipkg/sub/__init__.py b/tests/roots/autodoc/apipkg/sub/__init__.py index f379e87..3190815 100644 --- a/tests/roots/autodoc/apipkg/sub/__init__.py +++ b/tests/roots/autodoc/apipkg/sub/__init__.py @@ -1 +1,2 @@ +# SPDX-License-Identifier: MPL-2.0 """A subpackage.""" diff --git a/tests/roots/autodoc/apipkg/sub/deep.py b/tests/roots/autodoc/apipkg/sub/deep.py index 9423a2e..831d9d0 100644 --- a/tests/roots/autodoc/apipkg/sub/deep.py +++ b/tests/roots/autodoc/apipkg/sub/deep.py @@ -1 +1,2 @@ +# SPDX-License-Identifier: MPL-2.0 """A module two levels down.""" diff --git a/tests/roots/autodoc/conf.py b/tests/roots/autodoc/conf.py index e2ccef5..df3d886 100644 --- a/tests/roots/autodoc/conf.py +++ b/tests/roots/autodoc/conf.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 import sys from pathlib import Path diff --git a/tests/roots/entry-point/conf.py b/tests/roots/entry-point/conf.py index 355fbfa..1a1b67e 100644 --- a/tests/roots/entry-point/conf.py +++ b/tests/roots/entry-point/conf.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 project = "pertpy" # ``scverse_doc`` is not listed: Sphinx must load the theme from its entry point, # and the theme must bring ``scverse_doc.source`` with it – late enough that diff --git a/tests/roots/minimal/conf.py b/tests/roots/minimal/conf.py index 47f9beb..4152546 100644 --- a/tests/roots/minimal/conf.py +++ b/tests/roots/minimal/conf.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 project = "pertpy" extensions = ["scverse_doc", "sphinx.ext.linkcode"] source_repository = "https://github.com/scverse/pertpy" diff --git a/tests/roots/override/conf.py b/tests/roots/override/conf.py index 51b815c..4e0d389 100644 --- a/tests/roots/override/conf.py +++ b/tests/roots/override/conf.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 project = "not-an-scverse-package" extensions = ["scverse_doc"] html_theme_options = {"show_toc_level": 4, "announcement": ""} diff --git a/tests/test_build.py b/tests/test_build.py index 744a000..58d3587 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """End-to-end builds of the fixture documentation trees.""" from __future__ import annotations diff --git a/tests/test_color.py b/tests/test_color.py index af7cddb..18f20b9 100644 --- a/tests/test_color.py +++ b/tests/test_color.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """Contrast guarantees for the derived accents.""" from __future__ import annotations diff --git a/tests/test_registry.py b/tests/test_registry.py index a3adf8d..97ebba4 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The fetched registry and the intersphinx mapping built from it.""" from __future__ import annotations diff --git a/tests/test_source.py b/tests/test_source.py index ef0f8a1..bc9bcf6 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 """The repository description derived from the ``source_*`` config values.""" from __future__ import annotations