diff options
-rw-r--r-- | .github/dependabot.yml | 6 | ||||
-rw-r--r-- | .github/release.yml | 5 | ||||
-rw-r--r-- | .github/workflows/cd.yml | 6 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 40 | ||||
-rw-r--r-- | .pre-commit-config.yaml | 24 | ||||
-rw-r--r-- | debian/changelog | 10 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/patches/0001-Do-not-fail-on-DeprecationWarning.patch (renamed from debian/patches/0002-Do-not-fail-on-DeprecationWarning.patch) | 10 | ||||
-rw-r--r-- | debian/patches/0001-Use-pathlib-instead-of-sphinx.testing.path.patch | 25 | ||||
-rw-r--r-- | debian/patches/0002-Fix-sphinx.testing.path-deprecation-check.patch | 21 | ||||
-rw-r--r-- | debian/patches/series | 4 | ||||
-rw-r--r-- | noxfile.py | 13 | ||||
-rw-r--r-- | pyproject.toml | 100 | ||||
-rw-r--r-- | sphinxcontrib/moderncmakedomain/__init__.py | 4 | ||||
-rw-r--r-- | tests/conftest.py | 26 | ||||
-rw-r--r-- | tests/test_basic.py | 7 | ||||
-rw-r--r-- | tests/test_version.py | 3 |
17 files changed, 209 insertions, 97 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2c7d170..6c4b369 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,8 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" + groups: + actions: + patterns: + - "*" diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d1e098 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - pre-commit-ci diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1dabd41..e5edc8c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,12 +11,12 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build SDist and wheel run: pipx run build - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: dist/* @@ -35,7 +35,7 @@ jobs: id-token: write steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact path: dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0aeaf9..fd015fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: branches: - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: FORCE_COLOR: 3 @@ -16,16 +20,40 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: hynek/build-and-inspect-python-package@v1 + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v2 test: name: Run quick tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: wntrblm/nox@2023.04.22 + - uses: actions/checkout@v4 + + - name: Setup uv + uses: yezz123/setup-uv@v4 + + - uses: wntrblm/nox@2024.04.15 with: - python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12-dev" - - run: nox -s tests + python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13" + + - name: Test Python 3.7 + run: nox -s tests -P 3.7 + + - name: Test Python 3.8 + run: nox -s tests -P 3.8 + + - name: Test Python 3.9 + run: nox -s tests -P 3.9 + + - name: Test Python 3.10 + run: nox -s tests -P 3.10 + + - name: Test Python 3.11 + run: nox -s tests -P 3.11 + + - name: Test Python 3.12 + run: nox -s tests -P 3.13 + + - name: Test Python 3.13 + run: nox -s tests -P 3.13 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a10bd4e..660275d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.3.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -16,5 +16,27 @@ repos: - id: mixed-line-ending - id: name-tests-test args: ["--pytest-test-first"] + exclude: "^tests/roots" - id: requirements-txt-fixer - id: trailing-whitespace + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.4 + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + exclude: "$sphinxcontrib/moderncmakedomain/(cmake|colors).py$" + - id: ruff-format + exclude: "$sphinxcontrib/moderncmakedomain/(cmake|colors).py$" + + - repo: https://github.com/henryiii/validate-pyproject-schema-store + rev: 2024.05.13 + hooks: + - id: validate-pyproject + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.28.4 + hooks: + - id: check-dependabot + - id: check-github-workflows + - id: check-readthedocs diff --git a/debian/changelog b/debian/changelog index cf9efd5..0d99fd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +sphinxcontrib-moderncmakedomain (3.29.0-1) unstable; urgency=medium + + * New upstream version 3.29.0 + * Update patches + - Drop Use-pathlib-instead-of-sphinx.testing.path.patch + (obsolete, fixed upstream) + * Bump Standards-Version to 4.7.0 + + -- Timo Röhling <roehling@debian.org> Mon, 27 May 2024 15:17:15 +0200 + sphinxcontrib-moderncmakedomain (3.27.0-2) unstable; urgency=medium * Source only upload. diff --git a/debian/control b/debian/control index 888be7f..1f8f39a 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends: python3-pytest <!nocheck>, python3-sphinx, Homepage: https://github.com/scikit-build/moderncmakedomain -Standards-Version: 4.6.2 +Standards-Version: 4.7.0 Rules-Requires-Root: no Testsuite: autopkgtest-pkg-pybuild Vcs-Git: https://salsa.debian.org/python-team/packages/sphinxcontrib-moderncmakedomain.git diff --git a/debian/patches/0002-Do-not-fail-on-DeprecationWarning.patch b/debian/patches/0001-Do-not-fail-on-DeprecationWarning.patch index b2c62d8..ac3919f 100644 --- a/debian/patches/0002-Do-not-fail-on-DeprecationWarning.patch +++ b/debian/patches/0001-Do-not-fail-on-DeprecationWarning.patch @@ -8,14 +8,14 @@ Forwarded: not-needed 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml -index 6fbdac9..cfafb62 100644 +index c823db5..efc0230 100644 --- a/pyproject.toml +++ b/pyproject.toml -@@ -50,6 +50,7 @@ addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] +@@ -80,6 +80,7 @@ addopts = [ xfail_strict = true filterwarnings = [ - "error", -+ "default::DeprecationWarning:", - "ignore::DeprecationWarning:sphinx.builders.gettext", + "error", ++ "default::DeprecationWarning:", + "ignore::DeprecationWarning:sphinx.builders.gettext", ] log_cli_level = "info" diff --git a/debian/patches/0001-Use-pathlib-instead-of-sphinx.testing.path.patch b/debian/patches/0001-Use-pathlib-instead-of-sphinx.testing.path.patch deleted file mode 100644 index 7179ed6..0000000 --- a/debian/patches/0001-Use-pathlib-instead-of-sphinx.testing.path.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org> -Date: Sun, 19 Nov 2023 01:16:06 +0100 -Subject: Use pathlib instead of sphinx.testing.path - -Forwarded: https://github.com/scikit-build/moderncmakedomain/pull/41 ---- - tests/conftest.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/conftest.py b/tests/conftest.py -index 6a0c552..c62ee4e 100644 ---- a/tests/conftest.py -+++ b/tests/conftest.py -@@ -1,9 +1,9 @@ - import pytest - --from sphinx.testing.path import path -+from pathlib import Path - - pytest_plugins = 'sphinx.testing.fixtures' - - @pytest.fixture(scope="session") - def rootdir(): -- return path(__file__).parent.abspath() / "roots" -+ return Path(__file__).parent.absolute() / "roots" diff --git a/debian/patches/0002-Fix-sphinx.testing.path-deprecation-check.patch b/debian/patches/0002-Fix-sphinx.testing.path-deprecation-check.patch new file mode 100644 index 0000000..791d4af --- /dev/null +++ b/debian/patches/0002-Fix-sphinx.testing.path-deprecation-check.patch @@ -0,0 +1,21 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org> +Date: Mon, 27 May 2024 15:20:57 +0200 +Subject: Fix sphinx.testing.path deprecation check + +--- + tests/conftest.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index a5c050e..df780aa 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -11,7 +11,7 @@ sphinx_vesion = tuple(int(d) for d in version("sphinx").split(".")[:2]) + + pytest_plugins = "sphinx.testing.fixtures" + +-if sphinx_vesion < (7, 3): ++if sphinx_vesion < (7, 2): + from sphinx.testing.path import path + + @pytest.fixture(scope="session") diff --git a/debian/patches/series b/debian/patches/series index d111626..f04061e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,2 @@ -0001-Use-pathlib-instead-of-sphinx.testing.path.patch -0002-Do-not-fail-on-DeprecationWarning.patch +0001-Do-not-fail-on-DeprecationWarning.patch +0002-Fix-sphinx.testing.path-deprecation-check.patch @@ -1,11 +1,13 @@ -import nox -import urllib.request import re +import urllib.request from pathlib import Path +import nox + +nox.needs_version = ">=2024.3.2" nox.options.sessions = ["lint", "tests"] +nox.options.default_venv_backend = "uv|virtualenv" -ALL_PYTHONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] @nox.session def lint(session: nox.Session) -> None: @@ -55,11 +57,10 @@ def update(session: nox.Session) -> None: init_file.write_text(txt_new, encoding="utf_8") -@nox.session(python=ALL_PYTHONS) +@nox.session def tests(session): """ Run the unit and regular tests. """ - # Setuptools is required due to sphinx installing sphinxcontrib extensions that use pkg_resources (fixed upstream but not released yet) - session.install(".", "pytest", "setuptools") + session.install(".[test]", silent=False) session.run("pytest", *session.posargs) diff --git a/pyproject.toml b/pyproject.toml index cfafb62..efc0230 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,56 +6,82 @@ build-backend = "hatchling.build" name = "sphinxcontrib-moderncmakedomain" description = "Sphinx Domain for Modern CMake" readme = "README.md" -requires-python = ">=3.7" -authors = [ - { name = "Kitware" }, -] keywords = [ - "cmake", - "documentation", - "kitware", - "sphinx", - "sphinxcontrib", + "cmake", + "documentation", + "kitware", + "sphinx", + "sphinxcontrib", ] +authors = [ + { name = "Kitware" }, +] +requires-python = ">=3.7" classifiers = [ - "Environment :: Console", - "Environment :: Web Environment", - "Framework :: Sphinx :: Extension", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Documentation", - "Topic :: Utilities", -] -dependencies = ["sphinx>=2"] + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Sphinx :: Domain", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Documentation", + "Topic :: Utilities", +] dynamic = ["version"] +dependencies = [ + "sphinx>=2", +] + +[project.optional-dependencies] +test = [ + "defusedxml", + "pytest", +] [project.urls] Homepage = "https://github.com/scikit-build/moderncmakedomain" -[project.optional-dependencies] -test = ["pytest"] + +[tool.hatch] +version.path = "sphinxcontrib/moderncmakedomain/__init__.py" +build.targets.wheel.packages = ["sphinxcontrib"] + + +[tool.ruff] +exclude = [ + "sphinxcontrib/moderncmakedomain/cmake.py", + "sphinxcontrib/moderncmakedomain/colors.py", +] +lint.extend-select = [ + "B", # flake8-bugbear + "RUF", # Ruff-specific + "I", # isort + "UP", # pyupgrade +] + [tool.pytest.ini_options] minversion = "6.0" -addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] +addopts = [ + "-ra", + "--showlocals", + "--strict-markers", + "--strict-config", +] xfail_strict = true filterwarnings = [ - "error", - "default::DeprecationWarning:", - "ignore::DeprecationWarning:sphinx.builders.gettext", + "error", + "default::DeprecationWarning:", + "ignore::DeprecationWarning:sphinx.builders.gettext", ] log_cli_level = "info" testpaths = ["tests"] - -[tool.hatch] -version.path = "sphinxcontrib/moderncmakedomain/__init__.py" -build.targets.wheel.packages = ["sphinxcontrib"] diff --git a/sphinxcontrib/moderncmakedomain/__init__.py b/sphinxcontrib/moderncmakedomain/__init__.py index 9a77fde..c139a70 100644 --- a/sphinxcontrib/moderncmakedomain/__init__.py +++ b/sphinxcontrib/moderncmakedomain/__init__.py @@ -1,3 +1,5 @@ from .cmake import setup -__version__ = "3.27.0" +__version__ = "3.29.0" + +__all__ = ["__version__", "setup"] diff --git a/tests/conftest.py b/tests/conftest.py index c62ee4e..df780aa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,25 @@ +import sys + import pytest -from pathlib import Path +if sys.version_info < (3, 8): + from importlib_metadata import version +else: + from importlib.metadata import version + +sphinx_vesion = tuple(int(d) for d in version("sphinx").split(".")[:2]) + +pytest_plugins = "sphinx.testing.fixtures" + +if sphinx_vesion < (7, 2): + from sphinx.testing.path import path -pytest_plugins = 'sphinx.testing.fixtures' + @pytest.fixture(scope="session") + def rootdir(): + return path(__file__).parent.abspath() / "roots" +else: + from pathlib import Path -@pytest.fixture(scope="session") -def rootdir(): - return Path(__file__).parent.absolute() / "roots" + @pytest.fixture(scope="session") + def rootdir(): + return Path(__file__).parent.absolute() / "roots" diff --git a/tests/test_basic.py b/tests/test_basic.py index 659bed4..0f6fd9f 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,5 +1,6 @@ import pytest + @pytest.mark.parametrize("parallel", [0, 1, 2]) @pytest.mark.sphinx( "html", @@ -19,9 +20,9 @@ def test_simple_html(app, status, warning, parallel): with open(str(external_pth), encoding="utf-8") as f: external = f.read() - print(local) assert 'href="#variable:MYVAR"' in local assert 'id="variable:MYVAR"' in local - - + assert 'id="index-0-command:find_program"' in external + assert "find_program()" in external + assert 'class="xref cmake cmake-command docutils literal notranslate"' in external diff --git a/tests/test_version.py b/tests/test_version.py index 7b1c89b..91dbc98 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,7 +1,8 @@ """Version tests.""" + from sphinxcontrib.moderncmakedomain import __version__ def test_version(): """Test that version has at least 3 parts.""" - assert __version__.count('.') >= 2 + assert __version__.count(".") >= 2 |