sphinxcontrib-pydantic 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. sphinxcontrib_pydantic-0.1.0/.codecov.yaml +25 -0
  2. sphinxcontrib_pydantic-0.1.0/.codespellignore +0 -0
  3. sphinxcontrib_pydantic-0.1.0/.github/dependabot.yaml +12 -0
  4. sphinxcontrib_pydantic-0.1.0/.github/release.yaml +7 -0
  5. sphinxcontrib_pydantic-0.1.0/.github/workflows/bot.yaml +24 -0
  6. sphinxcontrib_pydantic-0.1.0/.github/workflows/examples.yaml +47 -0
  7. sphinxcontrib_pydantic-0.1.0/.github/workflows/publish.yaml +24 -0
  8. sphinxcontrib_pydantic-0.1.0/.github/workflows/pytest.yaml +69 -0
  9. sphinxcontrib_pydantic-0.1.0/.gitignore +136 -0
  10. sphinxcontrib_pydantic-0.1.0/.pre-commit-config.yaml +33 -0
  11. sphinxcontrib_pydantic-0.1.0/.yamllint.yaml +5 -0
  12. sphinxcontrib_pydantic-0.1.0/LICENSE +21 -0
  13. sphinxcontrib_pydantic-0.1.0/PKG-INFO +175 -0
  14. sphinxcontrib_pydantic-0.1.0/README.md +145 -0
  15. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/Makefile +31 -0
  16. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/api/database.rst +21 -0
  17. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/api/generics.rst +10 -0
  18. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/api/index.rst +13 -0
  19. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/api/models.rst +37 -0
  20. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/api/settings.rst +10 -0
  21. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/conf.py +121 -0
  22. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/index.rst +22 -0
  23. sphinxcontrib_pydantic-0.1.0/examples/advanced/doc/make.bat +49 -0
  24. sphinxcontrib_pydantic-0.1.0/examples/advanced/pyproject.toml +16 -0
  25. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/__init__.py +15 -0
  26. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/database/__init__.py +18 -0
  27. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/database/dto.py +49 -0
  28. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/database/table.py +36 -0
  29. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/generics.py +66 -0
  30. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/models/__init__.py +24 -0
  31. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/models/base.py +41 -0
  32. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/models/computed.py +46 -0
  33. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/models/config.py +61 -0
  34. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/models/validators.py +62 -0
  35. sphinxcontrib_pydantic-0.1.0/examples/advanced/src/example_advanced/settings.py +60 -0
  36. sphinxcontrib_pydantic-0.1.0/examples/advanced/uv.lock +294 -0
  37. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/Makefile +31 -0
  38. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/_templates/autosummary/models.rst +6 -0
  39. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/api.rst +47 -0
  40. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/conf.py +72 -0
  41. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/index.rst +18 -0
  42. sphinxcontrib_pydantic-0.1.0/examples/autosummary/doc/make.bat +49 -0
  43. sphinxcontrib_pydantic-0.1.0/examples/autosummary/pyproject.toml +15 -0
  44. sphinxcontrib_pydantic-0.1.0/examples/autosummary/src/example_autosummary/__init__.py +5 -0
  45. sphinxcontrib_pydantic-0.1.0/examples/autosummary/src/example_autosummary/database/__init__.py +11 -0
  46. sphinxcontrib_pydantic-0.1.0/examples/autosummary/src/example_autosummary/database/dto.py +34 -0
  47. sphinxcontrib_pydantic-0.1.0/examples/autosummary/src/example_autosummary/database/table.py +28 -0
  48. sphinxcontrib_pydantic-0.1.0/examples/autosummary/src/example_autosummary/models.py +50 -0
  49. sphinxcontrib_pydantic-0.1.0/examples/autosummary/uv.lock +269 -0
  50. sphinxcontrib_pydantic-0.1.0/examples/basic/doc/Makefile +31 -0
  51. sphinxcontrib_pydantic-0.1.0/examples/basic/doc/api.rst +10 -0
  52. sphinxcontrib_pydantic-0.1.0/examples/basic/doc/conf.py +41 -0
  53. sphinxcontrib_pydantic-0.1.0/examples/basic/doc/index.rst +18 -0
  54. sphinxcontrib_pydantic-0.1.0/examples/basic/doc/make.bat +49 -0
  55. sphinxcontrib_pydantic-0.1.0/examples/basic/pyproject.toml +12 -0
  56. sphinxcontrib_pydantic-0.1.0/examples/basic/src/example_basic/__init__.py +6 -0
  57. sphinxcontrib_pydantic-0.1.0/examples/basic/src/example_basic/models.py +49 -0
  58. sphinxcontrib_pydantic-0.1.0/examples/basic/uv.lock +156 -0
  59. sphinxcontrib_pydantic-0.1.0/pyproject.toml +156 -0
  60. sphinxcontrib_pydantic-0.1.0/setup.cfg +4 -0
  61. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/__init__.py +56 -0
  62. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_autodoc/__init__.py +10 -0
  63. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_autodoc/_handlers.py +447 -0
  64. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_config.py +50 -0
  65. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_directives/__init__.py +36 -0
  66. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_directives/_base.py +126 -0
  67. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_directives/_model.py +374 -0
  68. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_directives/_settings.py +153 -0
  69. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_inspection/__init__.py +25 -0
  70. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_inspection/_field.py +174 -0
  71. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_inspection/_model.py +180 -0
  72. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_inspection/_references.py +191 -0
  73. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_inspection/_validator.py +186 -0
  74. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_rendering/__init__.py +12 -0
  75. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_rendering/_rst.py +62 -0
  76. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_rendering/_summary.py +313 -0
  77. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib/pydantic/_version.py +34 -0
  78. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib_pydantic.egg-info/PKG-INFO +175 -0
  79. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib_pydantic.egg-info/SOURCES.txt +123 -0
  80. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib_pydantic.egg-info/dependency_links.txt +1 -0
  81. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib_pydantic.egg-info/requires.txt +7 -0
  82. sphinxcontrib_pydantic-0.1.0/src/sphinxcontrib_pydantic.egg-info/top_level.txt +1 -0
  83. sphinxcontrib_pydantic-0.1.0/tests/__init__.py +0 -0
  84. sphinxcontrib_pydantic-0.1.0/tests/assets/__init__.py +1 -0
  85. sphinxcontrib_pydantic-0.1.0/tests/assets/conf.py +7 -0
  86. sphinxcontrib_pydantic-0.1.0/tests/assets/index.rst +5 -0
  87. sphinxcontrib_pydantic-0.1.0/tests/assets/models/__init__.py +62 -0
  88. sphinxcontrib_pydantic-0.1.0/tests/assets/models/basic.py +42 -0
  89. sphinxcontrib_pydantic-0.1.0/tests/assets/models/computed.py +33 -0
  90. sphinxcontrib_pydantic-0.1.0/tests/assets/models/fields.py +37 -0
  91. sphinxcontrib_pydantic-0.1.0/tests/assets/models/forward_refs.py +69 -0
  92. sphinxcontrib_pydantic-0.1.0/tests/assets/models/generics.py +65 -0
  93. sphinxcontrib_pydantic-0.1.0/tests/assets/models/inheritance.py +85 -0
  94. sphinxcontrib_pydantic-0.1.0/tests/assets/models/nested.py +36 -0
  95. sphinxcontrib_pydantic-0.1.0/tests/assets/models/root_model.py +32 -0
  96. sphinxcontrib_pydantic-0.1.0/tests/assets/models/settings.py +30 -0
  97. sphinxcontrib_pydantic-0.1.0/tests/assets/models/sqlmodel_models.py +60 -0
  98. sphinxcontrib_pydantic-0.1.0/tests/assets/models/validators.py +99 -0
  99. sphinxcontrib_pydantic-0.1.0/tests/conftest.py +122 -0
  100. sphinxcontrib_pydantic-0.1.0/tests/integration/__init__.py +1 -0
  101. sphinxcontrib_pydantic-0.1.0/tests/integration/test_autodoc.py +390 -0
  102. sphinxcontrib_pydantic-0.1.0/tests/integration/test_build.py +551 -0
  103. sphinxcontrib_pydantic-0.1.0/tests/integration/test_extension.py +196 -0
  104. sphinxcontrib_pydantic-0.1.0/tests/integration/test_forward_refs.py +192 -0
  105. sphinxcontrib_pydantic-0.1.0/tests/integration/test_generics.py +277 -0
  106. sphinxcontrib_pydantic-0.1.0/tests/integration/test_inheritance.py +237 -0
  107. sphinxcontrib_pydantic-0.1.0/tests/integration/test_root_model.py +235 -0
  108. sphinxcontrib_pydantic-0.1.0/tests/integration/test_sqlmodel.py +324 -0
  109. sphinxcontrib_pydantic-0.1.0/tests/integration/test_xrefs.py +264 -0
  110. sphinxcontrib_pydantic-0.1.0/tests/unit/__init__.py +0 -0
  111. sphinxcontrib_pydantic-0.1.0/tests/unit/_autodoc/__init__.py +1 -0
  112. sphinxcontrib_pydantic-0.1.0/tests/unit/_autodoc/test_handlers.py +152 -0
  113. sphinxcontrib_pydantic-0.1.0/tests/unit/_directives/__init__.py +1 -0
  114. sphinxcontrib_pydantic-0.1.0/tests/unit/_directives/test_base.py +77 -0
  115. sphinxcontrib_pydantic-0.1.0/tests/unit/_directives/test_model.py +73 -0
  116. sphinxcontrib_pydantic-0.1.0/tests/unit/_directives/test_settings.py +62 -0
  117. sphinxcontrib_pydantic-0.1.0/tests/unit/_inspection/__init__.py +1 -0
  118. sphinxcontrib_pydantic-0.1.0/tests/unit/_inspection/test_field.py +194 -0
  119. sphinxcontrib_pydantic-0.1.0/tests/unit/_inspection/test_model.py +270 -0
  120. sphinxcontrib_pydantic-0.1.0/tests/unit/_inspection/test_references.py +213 -0
  121. sphinxcontrib_pydantic-0.1.0/tests/unit/_inspection/test_validator.py +137 -0
  122. sphinxcontrib_pydantic-0.1.0/tests/unit/_rendering/__init__.py +1 -0
  123. sphinxcontrib_pydantic-0.1.0/tests/unit/_rendering/test_rst.py +137 -0
  124. sphinxcontrib_pydantic-0.1.0/tests/unit/_rendering/test_summary.py +372 -0
  125. sphinxcontrib_pydantic-0.1.0/uv.lock +2279 -0
@@ -0,0 +1,25 @@
1
+ comment: false
2
+ github_checks: # too noisy, even though "a" interactively disables them
3
+ annotations: false
4
+
5
+ codecov:
6
+ notify:
7
+ require_ci_to_pass: false
8
+
9
+ coverage:
10
+ status:
11
+ patch:
12
+ default:
13
+ informational: true
14
+ target: 95%
15
+ if_no_uploads: error
16
+ if_not_found: success
17
+ if_ci_failed: error
18
+ project:
19
+ default: false
20
+ library:
21
+ informational: true
22
+ target: 90%
23
+ if_no_uploads: error
24
+ if_not_found: success
25
+ if_ci_failed: error
File without changes
@@ -0,0 +1,12 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+
9
+ - package-ecosystem: "uv"
10
+ directory: "/"
11
+ schedule:
12
+ interval: "weekly"
@@ -0,0 +1,7 @@
1
+ changelog:
2
+ exclude:
3
+ authors:
4
+ - autofix-ci[bot]
5
+ - dependabot[bot]
6
+ - github-actions[bot]
7
+ - pre-commit-ci[bot]
@@ -0,0 +1,24 @@
1
+ name: bot
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on: # yamllint disable-line rule:truthy
6
+ pull_request:
7
+ schedule:
8
+ - cron: '0 3 * * *'
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+ pull-requests: write
14
+
15
+ jobs:
16
+ auto-merge:
17
+ if: ${{ github.repository == 'mscheltienne/sphinxcontrib-pydantic' && github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') }}
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Enable auto-merge for bot PRs
21
+ run: gh pr merge --auto --squash "$PR_URL"
22
+ env:
23
+ PR_URL: ${{ github.event.pull_request.html_url }}
24
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,47 @@
1
+ name: examples
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on: # yamllint disable-line rule:truthy
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+ schedule:
11
+ - cron: '0 8 * * 1'
12
+
13
+ env:
14
+ UV_LOCKED: true
15
+
16
+ jobs:
17
+ build:
18
+ timeout-minutes: 30
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os: [ubuntu]
23
+ python-version: ["3.13"]
24
+ name: ${{ matrix.os }} - py${{ matrix.python-version }}
25
+ runs-on: ${{ matrix.os }}-latest
26
+ defaults:
27
+ run:
28
+ shell: bash
29
+ steps:
30
+ - uses: actions/checkout@v6
31
+ with:
32
+ fetch-depth: 0
33
+ - uses: astral-sh/setup-uv@v7
34
+ with:
35
+ activate-environment: true
36
+ python-version: ${{ matrix.python-version }}
37
+ - run: |
38
+ uv sync -q --no-default-groups --group example
39
+ uv pip install -e examples/basic/
40
+ uv pip install -e examples/advanced/
41
+ uv pip install -e examples/autosummary/
42
+ - name: Build basic example
43
+ run: make -C examples/basic/doc html
44
+ - name: Build advanced example
45
+ run: make -C examples/advanced/doc html
46
+ - name: Build autosummary example
47
+ run: make -C examples/autosummary/doc html
@@ -0,0 +1,24 @@
1
+ name: publish
2
+ on: # yamllint disable-line rule:truthy
3
+ release:
4
+ types: [published]
5
+
6
+ jobs:
7
+ pypi:
8
+ timeout-minutes: 10
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write
12
+ contents: write
13
+ environment: pypi
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ with:
17
+ fetch-depth: 0
18
+ - uses: astral-sh/setup-uv@v7
19
+ - run: uv build
20
+ - uses: softprops/action-gh-release@v2
21
+ with:
22
+ files: dist/*
23
+ tag_name: ${{ github.event.release.tag_name }}
24
+ - run: uv publish --trusted-publishing always
@@ -0,0 +1,69 @@
1
+ name: pytest
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on: # yamllint disable-line rule:truthy
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+ schedule:
11
+ - cron: '0 8 * * 1'
12
+
13
+ env:
14
+ UV_LOCKED: true
15
+
16
+ jobs:
17
+ pytest:
18
+ timeout-minutes: 30
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os: [ubuntu, macos, windows]
23
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
24
+ name: ${{ matrix.os }} - py${{ matrix.python-version }}
25
+ runs-on: ${{ matrix.os }}-latest
26
+ defaults:
27
+ run:
28
+ shell: bash
29
+ steps:
30
+ - uses: actions/checkout@v6
31
+ with:
32
+ fetch-depth: 0
33
+ - uses: astral-sh/setup-uv@v7
34
+ with:
35
+ activate-environment: true
36
+ python-version: ${{ matrix.python-version }}
37
+ - run: uv sync -q --no-default-groups --group test
38
+ - run: pytest tests --cov=sphinxcontrib.pydantic --cov-report=xml --cov-config=pyproject.toml
39
+ - uses: codecov/codecov-action@v5
40
+ if: ${{ github.repository == 'mscheltienne/sphinxcontrib-pydantic' }}
41
+ with:
42
+ token: ${{ secrets.CODECOV_TOKEN }}
43
+
44
+ pytest-pip-pre:
45
+ timeout-minutes: 30
46
+ strategy:
47
+ fail-fast: false
48
+ matrix:
49
+ python-version: ["3.13"]
50
+ name: pip pre-release - py${{ matrix.python-version }}
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v6
54
+ with:
55
+ fetch-depth: 0
56
+ - uses: astral-sh/setup-uv@v7
57
+ with:
58
+ activate-environment: true
59
+ python-version: ${{ matrix.python-version }}
60
+ - name: Install package
61
+ run: |
62
+ uv sync -q --no-default-groups --group test
63
+ uv pip install -q --upgrade --prerelease allow git+https://github.com/pydantic/pydantic
64
+ uv pip install -q --upgrade --prerelease allow git+https://github.com/sphinx-doc/sphinx
65
+ - run: pytest tests --cov=template --cov-report=xml --cov-config=pyproject.toml
66
+ - uses: codecov/codecov-action@v5
67
+ if: ${{ github.repository == 'mscheltienne/sphinxcontrib-pydantic' }}
68
+ with:
69
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,136 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ junit-results.xml
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ doc/_build/
73
+ doc/generated/
74
+ doc/api/generated/
75
+
76
+ # Example package documentation builds
77
+ examples/**/doc/_build/
78
+ examples/**/doc/generated/
79
+
80
+ # PyBuilder
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ .python-version
92
+
93
+ # celery beat schedule file
94
+ celerybeat-schedule
95
+
96
+ # SageMath parsed files
97
+ *.sage.py
98
+
99
+ # Environments
100
+ .env
101
+ .venv
102
+ env/
103
+ venv/
104
+ ENV/
105
+ env.bak/
106
+ venv.bak/
107
+
108
+ # Spyder project settings
109
+ .spyderproject
110
+ .spyproject
111
+
112
+ # Rope project settings
113
+ .ropeproject
114
+
115
+ # mkdocs documentation
116
+ /site
117
+
118
+ # mypy
119
+ .mypy_cache/
120
+ .dmypy.json
121
+ dmypy.json
122
+
123
+ # Pyre type checker
124
+ .pyre/
125
+
126
+ # PyCharm
127
+ **/.idea/
128
+
129
+ # VSCode
130
+ .vscode
131
+
132
+ # Ruff
133
+ .ruff_cache
134
+
135
+ # Version file generated by setuptools
136
+ _version.py
@@ -0,0 +1,33 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/uv-pre-commit
3
+ rev: 0.9.26
4
+ hooks:
5
+ - id: uv-lock
6
+
7
+ - repo: https://github.com/astral-sh/ruff-pre-commit
8
+ rev: v0.14.14
9
+ hooks:
10
+ - id: ruff
11
+ name: ruff linter
12
+ args: [--fix, --show-fixes]
13
+ - id: ruff-format
14
+ name: ruff formatter
15
+
16
+ - repo: https://github.com/codespell-project/codespell
17
+ rev: v2.4.1
18
+ hooks:
19
+ - id: codespell
20
+ additional_dependencies: [tomli]
21
+
22
+ - repo: https://github.com/pappasam/toml-sort
23
+ rev: v0.24.3
24
+ hooks:
25
+ - id: toml-sort-fix
26
+ files: pyproject.toml
27
+
28
+ - repo: https://github.com/adrienverge/yamllint
29
+ rev: v1.38.0
30
+ hooks:
31
+ - id: yamllint
32
+ args: [--strict, -c, .yamllint.yaml]
33
+ files: (.github/|.codecov.yaml|.pre-commit-config.yaml|.yamllint.yaml)
@@ -0,0 +1,5 @@
1
+ extends: default
2
+
3
+ rules:
4
+ line-length: disable
5
+ document-start: disable
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Mathieu Scheltienne
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinxcontrib-pydantic
3
+ Version: 0.1.0
4
+ Summary: A simple integration between autodoc and Pydantic in your Sphinx documentation.
5
+ Author-email: Mathieu Scheltienne <mathieu.scheltienne@gmail.com>
6
+ Maintainer-email: Mathieu Scheltienne <mathieu.scheltienne@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: source, https://github.com/mscheltienne/sphinxcontrib-pydantic
9
+ Project-URL: tracker, https://github.com/mscheltienne/sphinxcontrib-pydantic/issues
10
+ Keywords: autodoc,pydantic,python,sphinx
11
+ Classifier: Natural Language :: English
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: Unix
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: docutils
24
+ Requires-Dist: pydantic-core
25
+ Requires-Dist: pydantic>=2.0
26
+ Requires-Dist: sphinx>=9.0
27
+ Provides-Extra: settings
28
+ Requires-Dist: pydantic-settings>=2.0; extra == "settings"
29
+ Dynamic: license-file
30
+
31
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
32
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
33
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
34
+ [![codecov](https://codecov.io/gh/mscheltienne/sphinxcontrib-pydantic/graph/badge.svg?token=AC0qhhaeVW)](https://codecov.io/gh/mscheltienne/sphinxcontrib-pydantic)
35
+ [![tests](https://github.com/mscheltienne/sphinxcontrib-pydantic/actions/workflows/pytest.yaml/badge.svg?branch=main)](https://github.com/mscheltienne/sphinxcontrib-pydantic/actions/workflows/pytest.yaml)
36
+
37
+ # sphinxcontrib-pydantic
38
+
39
+ A Sphinx extension for documenting Pydantic models in your documentation.
40
+
41
+ This project was inspired by [autodoc_pydantic](https://github.com/mansenfranzen/autodoc_pydantic),
42
+ which I have been using for years but has gone unmaintained and is now incompatible
43
+ with **Sphinx 9.0+**. Unlike its predecessor, `sphinxcontrib-pydantic` focuses
44
+ exclusively on modern versions: **Pydantic v2+** and **Sphinx 9.0+** (Python 3.11+).
45
+
46
+ This project was vibe-coded using Claude Code (Opus 4.5); using `autodoc_pydantic` as
47
+ inspiration as well as the source code of `sphinx` and `pydantic` as documentation.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install sphinxcontrib-pydantic
53
+ ```
54
+
55
+ For `pydantic-settings` support:
56
+
57
+ ```bash
58
+ pip install sphinxcontrib-pydantic[settings]
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ Enable the extension in your `conf.py`:
64
+
65
+ ```python
66
+ extensions = [
67
+ "sphinx.ext.autodoc",
68
+ "sphinxcontrib.pydantic",
69
+ ]
70
+ ```
71
+
72
+ ## Usage
73
+
74
+ ### With autodoc
75
+
76
+ The extension integrates with `sphinx.ext.autodoc`. Simply use `automodule` or
77
+ `autoclass`:
78
+
79
+ ```rst
80
+ .. automodule:: mypackage.models
81
+ :members:
82
+ ```
83
+
84
+ Pydantic models are automatically detected and documented with field summaries and
85
+ validators.
86
+
87
+ ### With autosummary
88
+
89
+ For larger projects, use `autosummary` with a custom template:
90
+
91
+ ```rst
92
+ .. currentmodule:: mypackage.models
93
+
94
+ .. autosummary::
95
+ :toctree: generated/api
96
+ :template: autosummary/models.rst
97
+
98
+ UserConfig
99
+ DatabaseConfig
100
+ ```
101
+
102
+ Create `_templates/autosummary/models.rst`:
103
+
104
+ ```jinja
105
+ {{ fullname | escape | underline }}
106
+
107
+ .. currentmodule:: {{ module }}
108
+
109
+ .. pydantic-model:: {{ fullname }}
110
+ :inherited-members: BaseModel
111
+ ```
112
+
113
+ ### Standalone directives
114
+
115
+ Document models directly with the `pydantic-model` directive:
116
+
117
+ ```rst
118
+ .. pydantic-model:: mypackage.models.UserConfig
119
+ :show-field-summary:
120
+ :show-validator-summary:
121
+ ```
122
+
123
+ For Pydantic settings:
124
+
125
+ ```rst
126
+ .. pydantic-settings:: mypackage.settings.AppSettings
127
+ :show-field-summary:
128
+ ```
129
+
130
+ ## Configuration Options
131
+
132
+ All options use the `sphinxcontrib_pydantic_` prefix in `conf.py`, e.g.
133
+ `sphinxcontrib_pydantic_model_show_json`.
134
+
135
+ ### Model Options
136
+
137
+ | Option | Default | Description |
138
+ |--------|---------|-------------|
139
+ | `model_show_json` | `False` | Show JSON schema for the model |
140
+ | `model_show_field_summary` | `True` | Show summary table of fields |
141
+ | `model_show_validator_summary` | `True` | Show summary table of validators |
142
+ | `model_show_config` | `False` | Show model configuration |
143
+ | `model_signature_prefix` | `"model"` | Prefix shown before model name |
144
+ | `model_hide_paramlist` | `True` | Hide `__init__` parameter list |
145
+
146
+ ### Field Options
147
+
148
+ | Option | Default | Description |
149
+ |--------|---------|-------------|
150
+ | `field_show_alias` | `True` | Show field aliases |
151
+ | `field_show_default` | `True` | Show default values |
152
+ | `field_show_required` | `True` | Show required status |
153
+ | `field_show_constraints` | `True` | Show field constraints (e.g., `min_length`) |
154
+
155
+ ### Validator Options
156
+
157
+ | Option | Default | Description |
158
+ |--------|---------|-------------|
159
+ | `validator_list_fields` | `True` | List fields affected by each validator |
160
+
161
+ ### Settings Options
162
+
163
+ Settings options mirror model options with `settings_` prefix (e.g.,
164
+ `sphinxcontrib_pydantic_settings_show_json`).
165
+ They default to the same values as their model counterparts.
166
+
167
+ ### Example Configuration
168
+
169
+ ```python
170
+ # conf.py
171
+ sphinxcontrib_pydantic_model_show_json = True
172
+ sphinxcontrib_pydantic_model_show_field_summary = True
173
+ sphinxcontrib_pydantic_field_show_constraints = True
174
+ sphinxcontrib_pydantic_settings_signature_prefix = "config"
175
+ ```