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/setup.py b/setup.py index ce60012..64fbee1 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,9 @@ 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"], + extras_require={'test': ['myst-parser', 'defusedxml', 'sphinx', 'pytest']}, ) 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 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'