From dea2e76f1c9176b45aa1db7a9e8a7841a6a9a6f6 Mon Sep 17 00:00:00 2001 From: Nick Pilon Date: Fri, 7 Jun 2024 15:49:15 -0300 Subject: [PATCH 1/3] Adjust sphinxcontrib.mermaid for PEP 420 --- setup.py | 6 +++--- sphinxcontrib/__init__.py | 12 ------------ sphinxcontrib/{mermaid.py => mermaid/__init__.py} | 0 sphinxcontrib/{ => mermaid}/autoclassdiag.py | 0 sphinxcontrib/{ => mermaid}/exceptions.py | 0 5 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 sphinxcontrib/__init__.py rename sphinxcontrib/{mermaid.py => mermaid/__init__.py} (100%) rename sphinxcontrib/{ => mermaid}/autoclassdiag.py (100%) rename sphinxcontrib/{ => mermaid}/exceptions.py (100%) diff --git a/setup.py b/setup.py index ce60012..dedcc3e 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import find_packages, setup +from setuptools import find_namespace_packages, setup readme = open("README.rst", encoding="utf-8").read() changes = open("CHANGELOG.rst", encoding="utf-8").read() @@ -58,8 +58,8 @@ def remove_block(text, token, margin=0): "Topic :: Utilities", ], platforms="any", - packages=find_packages(), + packages=find_namespace_packages(where='./', include=['sphinxcontrib.mermaid']), + package_dir={'': './'}, include_package_data=True, install_requires=["sphinx", "pyyaml"], - namespace_packages=["sphinxcontrib"], ) diff --git a/sphinxcontrib/__init__.py b/sphinxcontrib/__init__.py deleted file mode 100644 index ae0f862..0000000 --- a/sphinxcontrib/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -""" - sphinxcontrib - ~~~~~~~~~~~~~ - - This package is a namespace package that contains all extensions - distributed in the ``sphinx-contrib`` distribution. - - :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -__import__('pkg_resources').declare_namespace(__name__) diff --git a/sphinxcontrib/mermaid.py b/sphinxcontrib/mermaid/__init__.py similarity index 100% rename from sphinxcontrib/mermaid.py rename to sphinxcontrib/mermaid/__init__.py diff --git a/sphinxcontrib/autoclassdiag.py b/sphinxcontrib/mermaid/autoclassdiag.py similarity index 100% rename from sphinxcontrib/autoclassdiag.py rename to sphinxcontrib/mermaid/autoclassdiag.py diff --git a/sphinxcontrib/exceptions.py b/sphinxcontrib/mermaid/exceptions.py similarity index 100% rename from sphinxcontrib/exceptions.py rename to sphinxcontrib/mermaid/exceptions.py From c649b32529b9cacdeea29c8e7c91b2c931460881 Mon Sep 17 00:00:00 2001 From: Nick Pilon Date: Fri, 7 Jun 2024 15:49:43 -0300 Subject: [PATCH 2/3] Add tests extra for test dependencies --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index dedcc3e..64fbee1 100644 --- a/setup.py +++ b/setup.py @@ -62,4 +62,5 @@ def remove_block(text, token, margin=0): package_dir={'': './'}, include_package_data=True, install_requires=["sphinx", "pyyaml"], + extras_require={'test': ['myst-parser', 'defusedxml', 'sphinx', 'pytest']}, ) From f48589c231f9e0995bb6d6ff0e34021993cdf393 Mon Sep 17 00:00:00 2001 From: Nick Pilon Date: Fri, 7 Jun 2024 15:52:10 -0300 Subject: [PATCH 3/3] Fix sphinx.testing deprecation warning --- .github/workflows/test.yml | 5 ++--- docs/requirements.txt | 2 +- tests/conftest.py | 11 +++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91980e9..e706fee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,13 +22,12 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: pip - cache-dependency-path: docs/requirements.txt + cache-dependency-path: setup.py - name: Install dependencies run: | - python -m pip install -r docs/requirements.txt python -m pip install -U pytest - python -m pip install -e . + python -m pip install -e .[test] - name: Test run: | diff --git a/docs/requirements.txt b/docs/requirements.txt index 78cace8..318cdbc 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,2 @@ -Sphinx<7 +Sphinx myst-parser>=1.0.0 \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index fe52b0f..7caaaf5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,16 @@ +from pathlib import Path + import pytest -from sphinx.testing.path import path +import sphinx +from packaging.version import Version + pytest_plugins = 'sphinx.testing.fixtures' @pytest.fixture(scope='session') def rootdir(): - return path(__file__).parent.abspath() / 'roots' + if Version(sphinx.__version__) < Version('7.0.0'): + from sphinx.testing.path import path + return path(__file__).parent.abspath() / 'roots' + return Path(__file__).parent.absolute() / 'roots'