From 57e0622135a69a040a03dfcb6a884cf357b80ede Mon Sep 17 00:00:00 2001 From: MikeD <5084545+devmonkey22@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:56:15 -0400 Subject: [PATCH 1/5] Fix #176 - Remove ``sphinxcontrib/__init__.py` causing ``ModuleNotFoundError`` exception in some environments. This should be a namespace package per `PEP 420 `__ without ``__init_.py`` to match with other extensions. --- changelog.rst | 12 ++++++++++++ sphinxcontrib/__init__.py | 0 2 files changed, 12 insertions(+) delete mode 100644 sphinxcontrib/__init__.py diff --git a/changelog.rst b/changelog.rst index 1b3ca6e9..a29bc6f9 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,6 +1,18 @@ Changelog ========= +v2.0.2 - 2023-XX-YY +------------------- + +Bugfix +~~~~~~ + +- `#176 `__ - + Remove ``sphinxcontrib/__init__.py` causing ``ModuleNotFoundError`` exception + in some environments. This should be a namespace package per + `PEP 420 `__ without ``__init_.py`` to match with + other extensions. + v2.0.1 - 2023-08-01 ------------------- diff --git a/sphinxcontrib/__init__.py b/sphinxcontrib/__init__.py deleted file mode 100644 index e69de29b..00000000 From dab70180810403529c85128c47f7018d21b334c2 Mon Sep 17 00:00:00 2001 From: MikeD <5084545+devmonkey22@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:58:12 -0400 Subject: [PATCH 2/5] Update ``conftest`` to use ``pathlib`` instead of older Sphinx ``sphinx.testing.path`` module that is being deprecated for forward-compatibility with newer Sphinx versions. --- changelog.rst | 7 +++++++ pyproject.toml | 2 +- tests/conftest.py | 13 +++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/changelog.rst b/changelog.rst index a29bc6f9..234a9bf1 100644 --- a/changelog.rst +++ b/changelog.rst @@ -13,6 +13,13 @@ Bugfix `PEP 420 `__ without ``__init_.py`` to match with other extensions. +Testing +~~~~~~~ + +- Update ``conftest`` to use ``pathlib`` instead of older Sphinx ``sphinx.testing.path`` module + that is being deprecated for forward-compatibility with newer Sphinx versions. + + v2.0.1 - 2023-08-01 ------------------- diff --git a/pyproject.toml b/pyproject.toml index 01ce7663..c039a2f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "autodoc_pydantic" -version = "2.0.1" +version = "2.0.2" description = "Seamlessly integrate pydantic models in your Sphinx documentation." authors = ["mansenfranzen "] packages = [{ include = "sphinxcontrib" }] diff --git a/tests/conftest.py b/tests/conftest.py index 859ace81..00e62806 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,6 +6,7 @@ import logging from logging.handlers import MemoryHandler from pathlib import Path +import shutil from typing import Optional, Dict, List, Callable, Union, Any from unittest.mock import Mock @@ -15,7 +16,7 @@ from sphinx import application from sphinx.application import Sphinx from sphinx.cmd import build -from sphinx.testing.path import path + from sphinx.testing.restructuredtext import parse from sphinx.util.docutils import LoggingReporter from sphinx.ext.autodoc.directive import ( @@ -66,12 +67,12 @@ @pytest.fixture(scope='session') -def rootdir(): - return path(__file__).parent.abspath() / 'roots' +def rootdir() -> Path: + return Path(__file__).parent.resolve() / 'roots' @pytest.fixture(scope='session') -def docdir(): +def docdir() -> Path: """Provides path to actual sphinx documentation of autodoc_pydantic. """ @@ -143,11 +144,11 @@ def create(testroot: str, conf: Optional[Dict] = None, deactivate_all: bool = False): srcdir = sphinx_test_tempdir / testroot - srcdir.rmtree(ignore_errors=True) + shutil.rmtree(srcdir, ignore_errors=True) if rootdir and not srcdir.exists(): testroot_path = rootdir / ('test-' + testroot) - testroot_path.copytree(srcdir) + shutil.copytree(testroot_path, srcdir) kwargs = dict(srcdir=srcdir, confoverrides={}) From 304a73bb6421d7168e30be8cb47c0ceec473a3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20W=C3=B6llert?= Date: Fri, 8 Dec 2023 20:30:49 +0100 Subject: [PATCH 3/5] Force pipeline to run. --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 58fdd795..311f8108 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,7 @@ on: branches: - main pull_request: + workflow_dispatch: jobs: test-stable-versions: From bb08ed169ab7297830c3d161ea2f4e1f05fa6976 Mon Sep 17 00:00:00 2001 From: mansenfranzen Date: Wed, 27 Dec 2023 21:46:53 +0100 Subject: [PATCH 4/5] Improve changelog. --- changelog.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/changelog.rst b/changelog.rst index bd313634..60d3cde8 100644 --- a/changelog.rst +++ b/changelog.rst @@ -5,15 +5,16 @@ v2.1.0 - 2024-01-XX ------------------- This is a maintenance and bugfix release extending support to pydantic v2.5, -sphinx v7.2 and python 3.12. Python 3.7 is removed from the test matrix and -will be no longer supported. +sphinx v7.2 and python 3.12 while dropping support for python 3.7 which has +reached EOL. Testing ~~~~~~~ - Add pydantic 2.2/2.3/2.4/2.5 to test matrix. -- Add python 3.12 to test matrix. - Add sphinx 7.1/7.2 to test matrix. +- Add python 3.12 to test matrix. +- Remove python 3.7 from test matrix. - Remove obsolete `skip ci` condition from github actions. - Update ``conftest`` to use ``pathlib`` instead of older Sphinx ``sphinx.testing.path`` module that is being deprecated for @@ -30,6 +31,15 @@ Bugfix `PEP 420 `__ without ``__init_.py`` to match with other extensions. +Contributors +~~~~~~~~~~~~ + +- Thanks to `devmonkey22 `__ for providing a PR + to solve a nasty namespace package issue + `#176 `__ and + `daquinteroflex `__ for testing and + providing feedback. + v2.0.1 - 2023-08-01 ------------------- From 7dd2715a1a85a8b11939a345aea09de20c399e18 Mon Sep 17 00:00:00 2001 From: mansenfranzen Date: Wed, 27 Dec 2023 21:50:15 +0100 Subject: [PATCH 5/5] Solely rely on shutil instead of using Path. --- tests/conftest.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 38a46e0e..d81f418e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -145,9 +145,6 @@ def create(testroot: str, conf: Optional[Dict] = None, deactivate_all: bool = False): - # workaround for sphinx issue #11605 - testroot = Path(testroot) - srcdir = sphinx_test_tempdir / testroot shutil.rmtree(srcdir, ignore_errors=True)