From 82b4b28328a7f162acadbeee915c3c622fdbac19 Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Fri, 7 Nov 2025 10:28:39 +0100 Subject: [PATCH 1/4] update(chore): switch from setup.* to pyproject.toml --- .github/labeler.yml | 6 +- .github/workflows/docker-test.yml | 6 +- .github/workflows/documentation.yml | 18 +- .github/workflows/lint-and-tests.yml | 16 +- .github/workflows/release.yml | 6 +- .gitignore | 1 + .pre-commit-config.yaml | 6 +- README.md | 24 ++- docs/contributing.md | 73 ++++--- mkdocs_rss_plugin/__about__.py | 42 +++-- pyproject.toml | 178 ++++++++++++++++++ requirements.txt | 3 - requirements/base.txt | 8 - requirements/development.txt | 11 -- requirements/documentation.txt | 9 - requirements/testing.txt | 10 - setup.cfg | 79 -------- setup.py | 107 ----------- .../fixtures/test-build-min-python.dockerfile | 3 +- 19 files changed, 301 insertions(+), 305 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements/base.txt delete mode 100644 requirements/development.txt delete mode 100644 requirements/documentation.txt delete mode 100644 requirements/testing.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/labeler.yml b/.github/labeler.yml index b13a9b8d..8dafa72a 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -13,15 +13,13 @@ ci-cd: dependencies: - changed-files: - any-glob-to-any-file: - - requirements/*.txt - - requirements.txt + - pyproject.toml documentation: - changed-files: - any-glob-to-any-file: - "*.md" - docs/** - - requirements/documentation.txt - head-branch: - ^docs - documentation @@ -37,7 +35,6 @@ packaging: - changed-files: - any-glob-to-any-file: - MANIFEST.in - - setup.py - head-branch: - ^packaging - packaging @@ -52,7 +49,6 @@ tooling: - any-glob-to-any-file: - ".*" - codecov.yml - - setup.cfg - .vscode/**/* - head-branch: - ^tooling diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index e6d8d1b9..f1e4242d 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -4,11 +4,13 @@ name: "🐳 Docker Builder" # events but only for the master branch on: pull_request: - branches: [main] + branches: + - main paths-ignore: - "docs/**" push: - branches: [main] + branches: + - main paths-ignore: - "docs/**" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 7ce365d0..1b82edd4 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -12,7 +12,7 @@ on: - "*.md" - ".github/workflows/documentation.yml" - ./mkdocs_rss_plugin - - requirements/documentation.txt + - pyproject.toml tags: - "*" @@ -22,19 +22,19 @@ on: paths: - .github/workflows/documentation.yml - docs/ - - requirements/documentation.txt + - pyproject.toml workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read - pages: write id-token: write + pages: write # Allow one concurrent deployment concurrency: - group: "pages" + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true # A workflow run is made up of one or more jobs that can run sequentially or in parallel @@ -56,13 +56,13 @@ jobs: with: python-version: "3.11" cache: "pip" - cache-dependency-path: "requirements/documentation.txt" + cache-dependency-path: pyproject.toml - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements/documentation.txt + run: python -m pip install --upgrade pip setuptools wheel + + - name: Install project as a package + run: python -m pip install .[docs] - name: Build static website env: diff --git a/.github/workflows/lint-and-tests.yml b/.github/workflows/lint-and-tests.yml index 5250652e..7ccb2ff0 100644 --- a/.github/workflows/lint-and-tests.yml +++ b/.github/workflows/lint-and-tests.yml @@ -38,14 +38,13 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "pip" - cache-dependency-path: "requirements/*.txt" + cache-dependency-path: pyproject.toml - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements/development.txt - python -m pip install --upgrade -r requirements/testing.txt + - name: Upgrade installation dependencies + run: python -m pip install --upgrade pip setuptools wheel + + - name: Install project as a package + run: python -m pip install .[test] - name: Lint with flake8 run: | @@ -54,9 +53,6 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Install project - run: python -m pip install -e . - - name: Run Unit tests run: python -m pytest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46f98da8..5857f924 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,8 +16,8 @@ jobs: url: https://pypi.org/project/mkdocs-rss-plugin/ permissions: contents: write - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing discussions: write + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - uses: actions/checkout@v5 @@ -25,9 +25,9 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: "3.x" + python-version: "3.13" cache: "pip" - cache-dependency-path: "requirements/base.txt" + cache-dependency-path: pyproject.toml - name: Install dependencies run: | diff --git a/.gitignore b/.gitignore index f1947752..1fc11861 100644 --- a/.gitignore +++ b/.gitignore @@ -216,5 +216,6 @@ dmypy.json # ################################ **/*.xml +mkdocs_rss_plugin/_version.py site/ tests/fixtures/docs/temp_page_not_in_git_log.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 75d2c6c1..f8235feb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,9 @@ repos: - id: detect-private-key - id: end-of-file-fixer - id: fix-byte-order-marker + - id: name-tests-test + args: + - --pytest-test-first - id: trailing-whitespace args: - --markdown-linebreak-ext=md @@ -37,7 +40,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.14.3" hooks: - - id: ruff + - id: ruff-check args: - --fix-only - --target-version=py310 @@ -66,7 +69,6 @@ repos: - flake8-docstrings<2 language: python args: - - --config=setup.cfg - --select=E9,F63,F7,F82 - --docstring-convention=google diff --git a/README.md b/README.md index 75089dc9..b789a47e 100644 --- a/README.md +++ b/README.md @@ -84,16 +84,24 @@ Following initiative from the author of Material for MkDocs, this plugin provide ## Development -Clone the repository: +Once you cloned the repository: ```sh -# install development dependencies -python -m pip install -U -r requirements/development.txt -# alternatively: pip install -e .[dev] - # install project as editable python -m pip install -e . +# including development dependencies +python -m pip install -e .[dev] + +# including documentation dependencies +python -m pip install -e .[docs] + +# including testing dependencies +python -m pip install -e .[test] + +# all inclusive +python -m pip install -e .[dev,docs,test] + # install git hooks pre-commit install ``` @@ -104,8 +112,7 @@ Then follow the [contribution guidelines](CONTRIBUTING.md). ```sh # install development dependencies -python -m pip install -U -r requirements/testing.txt -# alternatively: pip install -e .[test] +python -m pip install -e .[test] # run tests pytest @@ -115,8 +122,7 @@ pytest ```sh # install dependencies for documentation -python -m pip install -U -r requirements/documentation.txt -# alternatively: pip install -e .[doc] +python -m pip install -e .[docs] # build the documentation mkdocs build diff --git a/docs/contributing.md b/docs/contributing.md index 32121529..347a63d5 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -12,16 +12,24 @@ These are mostly guidelines, not rules. Use your best judgment, and feel free to ## Development -Clone the repository: +Once you cloned the repository: ```sh -# install development dependencies -python -m pip install -U -r requirements/development.txt -# alternatively: pip install -e .[dev] - # install project as editable python -m pip install -e . +# including development dependencies +python -m pip install -e .[dev] + +# including documentation dependencies +python -m pip install -e .[docs] + +# including testing dependencies +python -m pip install -e .[test] + +# all inclusive +python -m pip install -e .[dev,docs,test] + # install git hooks pre-commit install ``` @@ -32,8 +40,7 @@ Then follow the [contribution guidelines](#guidelines). ```sh # install development dependencies -python -m pip install -U -r requirements/testing.txt -# alternatively: pip install -e .[test] +python -m pip install -e .[test] # run tests pytest @@ -43,8 +50,7 @@ pytest ```sh # install dependencies for documentation -python -m pip install -U -r requirements/documentation.txt -# alternatively: pip install -e .[doc] +python -m pip install -e .[docs] # build the documentation mkdocs build @@ -90,10 +96,15 @@ Feel free to use the IDE you love. Here come configurations for some popular IDE ```jsonc { - // Editor - "files.associations": { - "./requirements/*.txt": "pip-requirements" + // JSON + "[json]": { + "editor.bracketPairColorization.enabled": true, + "editor.defaultFormatter": "vscode.json-language-features", + "editor.formatOnSave": true, + "editor.guides.bracketPairs": "active" }, + "json.format.enable": true, + "json.schemaDownload.enable": true, // Markdown "markdown.updateLinksOnFileMove.enabled": "prompt", "markdown.updateLinksOnFileMove.enableForDirectories": true, @@ -104,9 +115,16 @@ Feel free to use the IDE you love. Here come configurations for some popular IDE "editor.bracketPairColorization.enabled": true, "editor.formatOnSave": true, "editor.guides.bracketPairs": "active", - "files.trimTrailingWhitespace": false, + "files.trimTrailingWhitespace": false }, // Python + "python.analysis.autoFormatStrings": true, + "python.analysis.autoImportCompletions": true, + "python.analysis.typeCheckingMode": "basic", + "python.terminal.activateEnvInCurrentTerminal": true, + "python.terminal.activateEnvironment": true, + "python.testing.unittestEnabled": true, + "python.testing.pytestEnabled": true, "[python]": { "editor.codeActionsOnSave": { "source.organizeImports": "explicit" @@ -119,9 +137,24 @@ Feel free to use the IDE you love. Here come configurations for some popular IDE ], "editor.wordWrapColumn": 88, }, - // Extensions + // YAML + "[yaml]": { + "editor.autoIndent": "keep", + "editor.formatOnSave": true, + "editor.insertSpaces": true, + "editor.tabSize": 2, + "diffEditor.ignoreTrimWhitespace": false, + "editor.quickSuggestions": { + "other": true, + "comments": false, + "strings": true + } + }, + // extensions + "autoDocstring.guessTypes": true, + "autoDocstring.docstringFormat": "google-notypes", + "autoDocstring.generateDocstringOnEnter": false, "flake8.args": [ - "--config=setup.cfg", "--verbose" ], "isort.args": [ @@ -129,15 +162,13 @@ Feel free to use the IDE you love. Here come configurations for some popular IDE "black" ], "isort.check": true, - "autoDocstring.guessTypes": true, - "autoDocstring.docstringFormat": "google", - "autoDocstring.generateDocstringOnEnter": false, "yaml.customTags": [ "!ENV scalar", "!ENV sequence", - "tag:yaml.org,2002:python/name:materialx.emoji.to_svg", - "tag:yaml.org,2002:python/name:materialx.emoji.twemoji", + "!relative scalar", + "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg", + "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji", "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format" - ], + ] } ``` diff --git a/mkdocs_rss_plugin/__about__.py b/mkdocs_rss_plugin/__about__.py index 30af9ef3..30b2b286 100644 --- a/mkdocs_rss_plugin/__about__.py +++ b/mkdocs_rss_plugin/__about__.py @@ -12,27 +12,25 @@ # standard library from datetime import date +from importlib import metadata + +_pkg_metadata = metadata.metadata("mkdocs-rss-plugin") or {} + +try: + from ._version import version as __version__ +except ImportError: + __version__ = _pkg_metadata.get("Version", "0.0.0-dev0") + # ############################################################################ # ########## Globals ############# # ################################ -__all__ = [ - "__author__", - "__copyright__", - "__email__", - "__license__", - "__summary__", - "__title__", - "__title_clean__", - "__uri__", - "__version__", - "__version_info__", -] -__author__ = "Julien Moura" + +__author__: str = _pkg_metadata.get("Author-email", "Julien Moura (In Geo Veritas)") __copyright__ = f"2020 - {date.today().year}, {__author__}" __email__ = "dev@ingeoveritas.com" -__license__ = "MIT" +__license__: str = _pkg_metadata.get("License-Expression", "MIT") __summary__ = ( "MkDocs plugin which generates a static RSS feed using git log and page.meta." ) @@ -40,10 +38,24 @@ __title_clean__ = "".join(e for e in __title__ if e.isalnum()) __uri__ = "https://github.com/Guts/mkdocs-rss-plugin/" -__version__ = "1.17.4" +__version_clean__: str = __version__.split(".dev")[0].split("+")[0] __version_info__ = tuple( [ int(num) if num.isdigit() else num for num in __version__.replace("-", ".", 1).split(".") ] ) + + +__all__ = [ + "__author__", + "__copyright__", + "__email__", + "__license__", + "__summary__", + "__title__", + "__title_clean__", + "__uri__", + "__version__", + "__version_info__", +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e1c610fc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,178 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=64", "setuptools-scm>=8"] + +[project] +name = "mkdocs-rss-plugin" +description = "MkDocs plugin to generate RSS and JSON feeds using Mkdocs site configuration, git log and Mkdocs pages'meta." +dynamic = ["version"] +readme = "README.md" +license = "MIT" +license-files = ["LICENSE"] +requires-python = ">=3.10" +authors = [{ name = "Julien Moura", email = "dev@ingeoveritas.com" }] +maintainers = [{ name = "Julien Moura", email = "dev@ingeoveritas.com" }] +keywords = [ + "atom", + "documentation", + "feed", + "git", + "json-feed", + "mkdocs", + "plugin", + "rss", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", + "Topic :: Text Processing :: Markup :: Markdown", +] + +dependencies = [ + "CacheControl[filecache]>=0.14.3,<1", + "GitPython>=3.1.45,<3.2", + "mkdocs>=1.6.1,<2", + "requests>=2.32.5,<3", + "tzdata==2024.* ; sys_platform == 'win32'", +] + +[project.optional-dependencies] +dev = [ + "black>=25.9", + "flake8>=7.1", + "flake8-bugbear>=24.10", + "flake8-builtins>=2.5", + "flake8-eradicate>=1.5", + "flake8-isort>=6.1.1", + "Flake8-pyproject>=1.2.3", + "pre-commit>=4,<5", +] +docs = [ + "mkdocs-git-committers-plugin-2>=2.4.1,<2.6", + "mkdocs-git-revision-date-localized-plugin>=1.3,<1.6", + "mkdocs-material[imaging]>=9.5.47,<10", + "mkdocs-minify-plugin>=0.8,<0.9", + "mkdocstrings-python>=1.16.2,<1.19", + "termynal>=0.12.2,<0.14", +] +test = [ + "feedparser>=6.0.12,<6.1", + "jsonfeed-util>=1.2,<2", + "mkdocs-material[imaging]>=9.6.23", + "pytest-cov>=6.9.1,<8", + "validator-collection>=1.5,<1.6", +] + +[project.entry-points."mkdocs.plugins"] +rss = "mkdocs_rss_plugin.plugin:GitRssPlugin" + +[project.urls] +Changelog = "https://github.com/guts/mkdocs-rss-plugin/blob/main/CHANGELOG.md" +Documentation = "https://guts.github.io/mkdocs-rss-plugin/" +Homepage = "https://guts.github.io/mkdocs-rss-plugin/" +Issues = "https://github.com/guts/mkdocs-rss-plugin/issues/" +releasenotes = "https://github.com/guts/mkdocs-rss-plugin/releases/latest" +Repository = "https://github.com/guts/mkdocs-rss-plugin/" + + +# -- TOOLING CONFIGURATION -- + +# Black configuration +[tool.black] +target-version = ["py310", "py311", "py312", "py313", "py314"] + +# Coverage configuration +[tool.coverage.report] +exclude_also = [ + # Don't complain about abstract methods, they aren't run: + "@(abc\\.)?abstractmethod", + "class .*\\bProtocol\\):", + # Don't complain about missing debug-only code: + "def __repr__", + "if self.debug:", + # Don't complain if non-runnable code isn't run: + "if 0:", + "if __name__ == .__main__.:", + # Don't complain about imports for type checking: + "if TYPE_CHECKING:", + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + # ignore lines marked with a pragma + "pragma: no cover", +] +ignore_errors = true +show_missing = true + +[tool.coverage.run] +branch = true +omit = ["*/tests/*", "*/__pycache__/*", "*/.venv/*", "*/_version.py"] + +[tool.flake8] +count = true +exclude = [ + ".git", + "__pycache__", + "docs/conf.py", + "old", + "build", + "dist", + ".venv*", + "tests", +] +ignore = ["E121", "E123", "E126", "E203", "E226", "E24", "E704", "W503", "W504"] +max-complexity = 15 +max-doc-length = 130 +max-line-length = 100 +statistics = true +tee = true + +[tool.isort] +profile = "black" +ensure_newline_before_comments = true +force_grid_wrap = 0 +include_trailing_comma = true +line_length = 88 +multi_line_output = 3 +use_parentheses = true + +# Pytest configuration +[tool.pytest.ini_options] +addopts = [ + "--junitxml=junit/test-results.xml", + "--cov=mkdocs_rss_plugin", + "--cov-config=pyproject.toml", + "--cov-report=html", + "--cov-report=term", + "--cov-report=xml", + "--ignore=tests/_wip/", +] +junit_family = "xunit2" +minversion = "7.0" +norecursedirs = ".* build dev development dist docs CVS fixtures _darcs {arch} *.egg venv _wip" +python_files = ["test_*.py"] +testpaths = ["tests"] + +# Setuptools configuration +[tool.setuptools] +packages = ["mkdocs_rss_plugin"] + +[tool.setuptools.package-data] +mkdocs_rss_plugin = ["templates/*.jinja2", "templates/**/*.jinja2"] + +# setuptools-scm configuration +[tool.setuptools_scm] +fallback_version = "0.0.0+unknown" +local_scheme = "no-local-version" +version_scheme = "guess-next-dev" +write_to = "mkdocs_rss_plugin/_version.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 75766a0b..00000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --r requirements/base.txt - --e "." diff --git a/requirements/base.txt b/requirements/base.txt deleted file mode 100644 index 6b57af11..00000000 --- a/requirements/base.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Common requirements -# ----------------------- - -cachecontrol[filecache] >=0.14,<1 -GitPython>=3.1.43,<3.2 -mkdocs>=1.6.1,<2 -requests>=2.31,<3 -tzdata==2024.* ; sys_platform == "win32" diff --git a/requirements/development.txt b/requirements/development.txt deleted file mode 100644 index f50d1948..00000000 --- a/requirements/development.txt +++ /dev/null @@ -1,11 +0,0 @@ --r base.txt - -# Development -# ----------------------- -black -flake8>=7.1,<8 -flake8-bugbear>=24.10 -flake8-builtins>=2.5 -flake8-eradicate>=1.5 -flake8-isort>=6.1.1 -pre-commit>=3.7,<5 diff --git a/requirements/documentation.txt b/requirements/documentation.txt deleted file mode 100644 index ee671c74..00000000 --- a/requirements/documentation.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Documentation -# ----------------------- - -mkdocs-git-committers-plugin-2>=2.4.1,<2.6 -mkdocs-git-revision-date-localized-plugin>=1.3,<1.6 -mkdocs-material[imaging]>=9.5.47,<10 -mkdocs-minify-plugin>=0.8,<0.9 -mkdocstrings-python>=1.16.2,<1.19 -termynal>=0.12.2,<0.14 diff --git a/requirements/testing.txt b/requirements/testing.txt deleted file mode 100644 index 53dcd67a..00000000 --- a/requirements/testing.txt +++ /dev/null @@ -1,10 +0,0 @@ --r base.txt - -# Testing -# ------- - -feedparser>=6.0.11,<6.1 -jsonfeed-util>=1.2,<2 -mkdocs-material[imaging]>=9.5.47 -pytest-cov>=6,<8 -validator-collection>=1.5,<1.6 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b2f1294a..00000000 --- a/setup.cfg +++ /dev/null @@ -1,79 +0,0 @@ -# -- Packaging -------------------------------------- -[bdist_wheel] -universal = 1 - -[metadata] -description-file = README.md - -# -- Code quality ------------------------------------ -[flake8] -count = True -docstring-convention = google -exclude = - # No need to traverse our git directory - .git, - # There's no value in checking cache directories - __pycache__, - # The conf file is mostly autogenerated, ignore it - docs/conf.py, - # The old directory contains Flake8 2.0 - old, - # This contains our built documentation - build, - # This contains builds of flake8 that we don't want to check - dist, - # This contains local virtual environments - .venv*, - # do not watch on tests - tests -ignore = E121,E123,E126,E203,E226,E24,E704,W503,W504 -max-complexity = 15 -max-doc-length = 130 -max-line-length = 100 -statistics = True -tee = True - -[isort] -ensure_newline_before_comments = True -force_grid_wrap = 0 -include_trailing_comma = True -line_length = 88 -multi_line_output = 3 -profile = black -use_parentheses = True - -# -- Tests ---------------------------------------------- -[tool:pytest] -addopts = - --junitxml=junit/test-results.xml - --cov-config=setup.cfg - --cov=mkdocs_rss_plugin - --cov-report=html - --cov-report=term - --cov-report=xml - --ignore=tests/_wip/ -junit_family = xunit2 -minversion = 5.0 -norecursedirs = .* build dev development dist docs CVS fixtures _darcs {arch} *.egg venv _wip -python_files = test_*.py -testpaths = tests - -[coverage:run] -disable_warnings=include-ignored -branch = True -include = - mkdocs_rss_plugin/* -omit = - .venv/* - docs/* - *tests* - -[coverage:report] -exclude_lines = - if self.debug: - pragma: no cover - raise NotImplementedError - if __name__ == .__main__.: - -ignore_errors = True -show_missing = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 6e921712..00000000 --- a/setup.py +++ /dev/null @@ -1,107 +0,0 @@ -#! python3 # noqa: E265 - -# ############################################################################ -# ########## Libraries ############# -# ################################## - -# standard library -from pathlib import Path - -# 3rd party -from setuptools import find_packages, setup - -# package (to get version) -from mkdocs_rss_plugin import __about__ - -# ############################################################################ -# ########## Globals ############# -# ################################ - -HERE = Path(__file__).parent -README = (HERE / "README.md").read_text() - -# ############################################################################ -# ########### Functions ############ -# ################################## - - -def load_requirements(requirements_files: Path | list[Path]) -> list: - """Helper to load requirements list from a path or a list of paths. - - Args: - requirements_files (Union[Path, List[Path]]): path or list to paths of - requirements file(s) - - Returns: - list: list of requirements loaded from file(s) - """ - out_requirements = [] - - if isinstance(requirements_files, Path): - requirements_files = [ - requirements_files, - ] - - for requirements_file in requirements_files: - with requirements_file.open(encoding="UTF-8") as f: - out_requirements += [ - line - for line in f.read().splitlines() - if not line.startswith(("#", "-")) and len(line) - ] - - return out_requirements - - -# ############################################################################ -# ########## Setup ############# -# ############################## -setup( - name="mkdocs-rss-plugin", - version=__about__.__version__, - author=__about__.__author__, - author_email=__about__.__email__, - description=__about__.__summary__, - license=__about__.__license__, - long_description=README, - long_description_content_type="text/markdown", - project_urls={ - "Docs": "https://guts.github.io/mkdocs-rss-plugin/", - "Bug Reports": f"{__about__.__uri__}issues/", - "Source": __about__.__uri__, - }, - # packaging - packages=find_packages( - exclude=["contrib", "docs", "*.tests", "*.tests.*", "tests.*", "tests"] - ), - include_package_data=True, - # run - entry_points={"mkdocs.plugins": ["rss = mkdocs_rss_plugin.plugin:GitRssPlugin"]}, - # dependencies - python_requires=">=3.10, <4", - extras_require={ - # tooling - "dev": load_requirements(HERE / "requirements/development.txt"), - "doc": load_requirements(HERE / "requirements/documentation.txt"), - "test": load_requirements(HERE / "requirements/testing.txt"), - }, - install_requires=load_requirements(HERE / "requirements/base.txt"), - # metadata - keywords="mkdocs rss git plugin", - classifiers=[ - "Intended Audience :: Developers", - "Intended Audience :: Information Technology", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "Programming Language :: Python :: Implementation :: CPython", - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Topic :: Documentation", - "Topic :: Text Processing :: Markup :: Markdown", - ], -) diff --git a/tests/fixtures/test-build-min-python.dockerfile b/tests/fixtures/test-build-min-python.dockerfile index 7e4a5064..1107b648 100644 --- a/tests/fixtures/test-build-min-python.dockerfile +++ b/tests/fixtures/test-build-min-python.dockerfile @@ -4,7 +4,6 @@ FROM python:3.10.19 COPY . . RUN python3 -m pip install --no-cache-dir -U pip setuptools wheel \ - && python3 -m pip install --no-cache-dir -U -r requirements/documentation.txt \ - && python3 -m pip install --no-cache-dir . + && python3 -m pip install --no-cache-dir .[docs] RUN mkdocs build From 4176c946f5ed21e2c2d6ff39811d83989d00db1e Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Fri, 7 Nov 2025 10:28:55 +0100 Subject: [PATCH 2/4] update(tooling): add Python 3.14 to SonarCloud config --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 9b189759..a38b5a23 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,7 +6,7 @@ sonar.projectKey=Guts_mkdocs-rss-plugin # only=main # Python versions -sonar.python.version=3.9, 3.10, 3.11, 3.12, 3.13 +sonar.python.version=3.10, 3.11, 3.12, 3.13, 3.14 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=mkdocs_rss_plugin From de6654248edb39598afe6b5626c32046f3c7789c Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Fri, 7 Nov 2025 10:32:03 +0100 Subject: [PATCH 3/4] update(ci): remove flake8 run in GH Actions since it's already un on pre-commit.ci --- .github/workflows/lint-and-tests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/lint-and-tests.yml b/.github/workflows/lint-and-tests.yml index 7ccb2ff0..72685ddf 100644 --- a/.github/workflows/lint-and-tests.yml +++ b/.github/workflows/lint-and-tests.yml @@ -46,13 +46,6 @@ jobs: - name: Install project as a package run: python -m pip install .[test] - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Run Unit tests run: python -m pytest From e7b7e89c0d7c84886ba5069e6416e2bc7f44a88d Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Fri, 7 Nov 2025 10:36:12 +0100 Subject: [PATCH 4/4] update(tooling): remove name-tests-test since it's not possible to exclude tests/base.py --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8235feb..7f9b7571 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,9 +18,6 @@ repos: - id: detect-private-key - id: end-of-file-fixer - id: fix-byte-order-marker - - id: name-tests-test - args: - - --pytest-test-first - id: trailing-whitespace args: - --markdown-linebreak-ext=md