Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace package fix #177

Merged
merged 6 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test-stable-versions:
Expand Down
24 changes: 21 additions & 3 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,40 @@ 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 no
longer be 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
forward-compatibility with newer Sphinx versions.

Bugfix
~~~~~~

- Fix incompatibity with sphinx 7.2 due to changed usage of path objects.
For more, see `#11606 <https://github.com/sphinx-doc/sphinx/issues/11605>`__.
- `#176 <https://github.com/mansenfranzen/autodoc_pydantic/issues/176>`__ -
Remove ``sphinxcontrib/__init__.py`` causing ``ModuleNotFoundError``
exception in some environments. This should be a namespace package per
`PEP 420 <https://peps.python.org/pep-0420/>`__ without ``__init_.py`` to
match with other extensions.

Contributors
~~~~~~~~~~~~

- Thanks to `devmonkey22 <https://github.com/devmonkey22>`__ for providing a PR
to solve a nasty namespace package issue
`#176 <https://github.com/mansenfranzen/autodoc_pydantic/issues/176>`__ and
`daquinteroflex <https://github.com/daquinteroflex>`__ for testing and
providing feedback.

v2.0.1 - 2023-08-01
-------------------
Expand Down
Empty file removed sphinxcontrib/__init__.py
Empty file.
17 changes: 7 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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

Expand All @@ -16,7 +17,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 (
Expand Down Expand Up @@ -67,12 +68,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.

"""
Expand Down Expand Up @@ -144,16 +145,12 @@ 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)

if rootdir and not srcdir.exists():
testroot_name = testroot.parent / ('test-' + testroot.name)
testroot_path = rootdir / testroot_name
testroot_path.copytree(srcdir)
testroot_path = rootdir / ('test-' + testroot)
shutil.copytree(testroot_path, srcdir)

kwargs = dict(srcdir=srcdir, confoverrides={})

Expand Down
Loading