drf-to-mkdoc 0.3.4__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 (136) hide show
  1. drf_to_mkdoc-0.3.4/.github/workflows/publish.yaml +43 -0
  2. drf_to_mkdoc-0.3.4/.pre-commit-config.yaml +8 -0
  3. drf_to_mkdoc-0.3.4/CONTRIBUTING.md +127 -0
  4. drf_to_mkdoc-0.3.4/LICENSE +21 -0
  5. drf_to_mkdoc-0.3.4/MANIFEST.in +19 -0
  6. drf_to_mkdoc-0.3.4/PKG-INFO +232 -0
  7. drf_to_mkdoc-0.3.4/README.md +183 -0
  8. drf_to_mkdoc-0.3.4/conf/__init__.py +0 -0
  9. drf_to_mkdoc-0.3.4/conf/defaults.py +11 -0
  10. drf_to_mkdoc-0.3.4/conf/settings.py +21 -0
  11. drf_to_mkdoc-0.3.4/docs/customizing_endpoints.md +202 -0
  12. drf_to_mkdoc-0.3.4/docs/mkdocs.yml +71 -0
  13. drf_to_mkdoc-0.3.4/docs/serving_docs_with_django.md +118 -0
  14. drf_to_mkdoc-0.3.4/docs/serving_mkdocs_with_django.md +124 -0
  15. drf_to_mkdoc-0.3.4/drf_to_mkdoc/__init__.py +7 -0
  16. drf_to_mkdoc-0.3.4/drf_to_mkdoc/apps.py +19 -0
  17. drf_to_mkdoc-0.3.4/drf_to_mkdoc/conf/__init__.py +0 -0
  18. drf_to_mkdoc-0.3.4/drf_to_mkdoc/conf/defaults.py +18 -0
  19. drf_to_mkdoc-0.3.4/drf_to_mkdoc/conf/settings.py +164 -0
  20. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/__init__.py +0 -0
  21. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/__init__.py +0 -0
  22. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/build_docs.py +110 -0
  23. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/build_endpoint_docs.py +69 -0
  24. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/build_model_docs.py +59 -0
  25. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/extract_model_data.py +351 -0
  26. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/generate_doc_json.py +512 -0
  27. drf_to_mkdoc-0.3.4/drf_to_mkdoc/management/commands/update_doc_schema.py +53 -0
  28. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/endpoints-filter.js +195 -0
  29. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/field-sections-loader.js +29 -0
  30. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/query-parameters-loader.js +16 -0
  31. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/settings-modal.js +361 -0
  32. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/field-extractor.js +200 -0
  33. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/form-manager.js +584 -0
  34. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/main.js +50 -0
  35. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/modal.js +359 -0
  36. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/query-parameters-extractor.js +94 -0
  37. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/request-executor.js +343 -0
  38. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/response-modal.js +173 -0
  39. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/suggestions.js +123 -0
  40. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/tabs.js +77 -0
  41. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/accessibility.css +21 -0
  42. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/animations.css +11 -0
  43. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/badges.css +62 -0
  44. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/base.css +84 -0
  45. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoint-content.css +165 -0
  46. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoints-grid.css +266 -0
  47. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/filter-section.css +214 -0
  48. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/fixes.css +44 -0
  49. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/layout.css +31 -0
  50. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/loading.css +35 -0
  51. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/responsive.css +96 -0
  52. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/sections.css +35 -0
  53. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/settings-modal.css +555 -0
  54. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/stats.css +34 -0
  55. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/tags.css +92 -0
  56. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/theme-toggle.css +314 -0
  57. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/fab.css +204 -0
  58. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/response.css +323 -0
  59. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/variables.css +139 -0
  60. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/variables.css +73 -0
  61. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/field-sections.css +136 -0
  62. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/animations.css +25 -0
  63. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/base.css +83 -0
  64. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-cards.css +126 -0
  65. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-tables.css +57 -0
  66. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/responsive.css +51 -0
  67. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/variables.css +46 -0
  68. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/buttons.css +71 -0
  69. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/fab.css +47 -0
  70. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/form.css +663 -0
  71. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/key-value.css +161 -0
  72. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/main.css +57 -0
  73. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/modal.css +334 -0
  74. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/response.css +618 -0
  75. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/tabs.css +114 -0
  76. drf_to_mkdoc-0.3.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/variables.css +94 -0
  77. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/detail/base.html +35 -0
  78. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/detail/path_parameters.html +8 -0
  79. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/detail/query_parameters.html +36 -0
  80. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/detail/request_body.html +12 -0
  81. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/detail/responses.html +18 -0
  82. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/base.html +31 -0
  83. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/endpoint_card.html +18 -0
  84. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/filter_section.html +18 -0
  85. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/filters/app.html +8 -0
  86. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/filters/method.html +12 -0
  87. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/filters/path.html +5 -0
  88. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/filters/search.html +9 -0
  89. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/endpoints/list/settings_modal.html +138 -0
  90. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/er_diagrams/app.html +26 -0
  91. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/er_diagrams/index.html +14 -0
  92. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/er_diagrams/main.html +22 -0
  93. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/base.html +34 -0
  94. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/choices.html +12 -0
  95. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/fields.html +11 -0
  96. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/meta.html +6 -0
  97. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/methods.html +9 -0
  98. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/model_detail/relationships.html +8 -0
  99. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/models_index.html +24 -0
  100. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/try-out/fab.html +68 -0
  101. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/try-out/form.html +260 -0
  102. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/try-out/main.html +4 -0
  103. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/try-out/modal.html +82 -0
  104. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templates/try-out/response-modal.html +149 -0
  105. drf_to_mkdoc-0.3.4/drf_to_mkdoc/templatetags/custom_filters.py +148 -0
  106. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/__init__.py +3 -0
  107. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/__init__.py +0 -0
  108. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/enums.py +13 -0
  109. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/exceptions.py +19 -0
  110. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/providers/__init__.py +0 -0
  111. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/providers/base_provider.py +123 -0
  112. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/providers/gemini_provider.py +80 -0
  113. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/ai_tools/types.py +81 -0
  114. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/__init__.py +0 -0
  115. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/code_extractor.py +22 -0
  116. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/file_utils.py +35 -0
  117. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/model_utils.py +83 -0
  118. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/operation_utils.py +83 -0
  119. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/path_utils.py +78 -0
  120. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/commons/schema_utils.py +221 -0
  121. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/endpoint_detail_generator.py +844 -0
  122. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/endpoint_list_generator.py +101 -0
  123. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/er_diagram_generator.py +230 -0
  124. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/extractors/__init__.py +3 -0
  125. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/extractors/query_parameter_extractors.py +216 -0
  126. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/model_detail_generator.py +62 -0
  127. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/model_list_generator.py +59 -0
  128. drf_to_mkdoc-0.3.4/drf_to_mkdoc/utils/schema.py +364 -0
  129. drf_to_mkdoc-0.3.4/drf_to_mkdoc.egg-info/PKG-INFO +232 -0
  130. drf_to_mkdoc-0.3.4/drf_to_mkdoc.egg-info/SOURCES.txt +134 -0
  131. drf_to_mkdoc-0.3.4/drf_to_mkdoc.egg-info/dependency_links.txt +1 -0
  132. drf_to_mkdoc-0.3.4/drf_to_mkdoc.egg-info/requires.txt +15 -0
  133. drf_to_mkdoc-0.3.4/drf_to_mkdoc.egg-info/top_level.txt +1 -0
  134. drf_to_mkdoc-0.3.4/pyproject.toml +214 -0
  135. drf_to_mkdoc-0.3.4/setup.cfg +4 -0
  136. drf_to_mkdoc-0.3.4/setup.py +3 -0
@@ -0,0 +1,43 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*' # Trigger on tags like v1.0.0
7
+
8
+ jobs:
9
+ publish:
10
+ name: Publish to PyPI
11
+ runs-on: ubuntu-latest
12
+ environment: pypi # Make sure this environment exists in repo settings
13
+
14
+ permissions:
15
+ contents: read
16
+ id-token: write # Required for PyPI trusted publishing
17
+
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: '3.x'
28
+
29
+ - name: Install build tools and setuptools_scm
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install build setuptools_scm[toml]
33
+
34
+ - name: Verify version detection
35
+ run: |
36
+ echo "Detected version: $(python -m setuptools_scm)"
37
+ echo "Git describe: $(git describe --tags)"
38
+
39
+ - name: Build package
40
+ run: python -m build
41
+
42
+ - name: Publish to PyPI
43
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.12.4
4
+ hooks:
5
+ - id: ruff
6
+ args: [ --fix ]
7
+ - id: ruff-format
8
+
@@ -0,0 +1,127 @@
1
+ # Contributing to DRF to MkDocs
2
+
3
+ Thank you for your interest in contributing to DRF to MkDocs! This document provides guidelines and information for contributors.
4
+
5
+ ## Getting Started
6
+
7
+ 1. **Fork the repository**
8
+ - Go to the main repository page
9
+ - Click the "Fork" button to create your own copy
10
+
11
+ 2. **Clone your fork**
12
+ ```bash
13
+ git clone https://github.com/yourusername/drf-to-mkdoc.git
14
+ cd drf-to-mkdoc
15
+ ```
16
+
17
+ 3. **Set up development environment**
18
+ ```bash
19
+ pip install -e ".[dev]"
20
+ ```
21
+
22
+ 4. **Create a feature branch**
23
+ ```bash
24
+ git checkout -b feature/your-feature-name
25
+ ```
26
+
27
+ ## Development Guidelines
28
+
29
+ ### Code Style
30
+
31
+ - Follow PEP 8 style guidelines
32
+ - Use meaningful variable and function names
33
+ - Add docstrings to all public functions and classes
34
+ - Keep functions focused and single-purpose
35
+
36
+ ### Documentation
37
+
38
+ - Update README.md if adding new features
39
+ - Add docstrings to new functions and classes
40
+ - Update inline comments for complex logic
41
+ - Consider adding examples for new functionality
42
+
43
+ ## Making Changes
44
+
45
+ 1. **Make your changes**
46
+ - Implement your feature or fix
47
+ - Follow the coding guidelines above
48
+ - Test your changes thoroughly
49
+
50
+ 2. **Commit your changes**
51
+ ```bash
52
+ git add .
53
+ git commit -m "Add feature: brief description of changes"
54
+ ```
55
+
56
+ 3. **Push to your fork**
57
+ ```bash
58
+ git push origin feature/your-feature-name
59
+ ```
60
+
61
+ 4. **Create a pull request**
62
+ - Go to your fork on GitHub
63
+ - Click "New Pull Request"
64
+ - Select your feature branch
65
+ - Fill out the pull request template
66
+
67
+ ## Pull Request Guidelines
68
+
69
+ ### Before Submitting
70
+
71
+ - [ ] Code follows style guidelines
72
+ - [ ] Documentation is updated
73
+ - [ ] No breaking changes (or clearly documented)
74
+ - [ ] Feature is tested with multiple Django versions
75
+
76
+ ### Pull Request Template
77
+
78
+ ```markdown
79
+ ## Description
80
+ Brief description of the changes made.
81
+
82
+ ## Type of Change
83
+ - [ ] Bug fix
84
+ - [ ] New feature
85
+ - [ ] Documentation update
86
+ - [ ] Code refactoring
87
+
88
+ ## Testing
89
+ Describe how you tested your changes.
90
+
91
+ ## Checklist
92
+ - [ ] My code follows the style guidelines
93
+ - [ ] I have performed a self-review
94
+ - [ ] I have commented my code where necessary
95
+ - [ ] I have made corresponding changes to documentation
96
+ - [ ] My changes generate no new warnings
97
+ - [ ] I have added tests that prove my fix is effective
98
+ ```
99
+
100
+ ## Issue Reporting
101
+
102
+ When reporting issues, please include:
103
+
104
+ - **Django version**: The version you're using
105
+ - **DRF version**: Django REST Framework version
106
+ - **Python version**: Your Python version
107
+ - **Error message**: Full error traceback
108
+ - **Steps to reproduce**: Clear steps to reproduce the issue
109
+ - **Expected behavior**: What you expected to happen
110
+ - **Actual behavior**: What actually happened
111
+
112
+ ## Code of Conduct
113
+
114
+ - Be respectful and inclusive
115
+ - Focus on the code and technical discussions
116
+ - Help others learn and improve
117
+ - Report any inappropriate behavior to maintainers
118
+
119
+ ## Questions?
120
+
121
+ If you have questions about contributing, feel free to:
122
+
123
+ - Open an issue for general questions
124
+ - Ask in pull request comments
125
+ - Contact maintainers directly
126
+
127
+ Thank you for contributing to DRF to MkDocs!
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ShayestehHs
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
13
+ all 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
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ include README.md
2
+ include LICENSE
3
+ include MANIFEST.in
4
+ include pyproject.toml
5
+
6
+ recursive-include drf_to_mkdoc/conf *.py
7
+ recursive-include drf_to_mkdoc/utils *.py
8
+ recursive-include drf_to_mkdoc/management *.py
9
+ recursive-include static *
10
+
11
+ global-exclude *.pyc
12
+ global-exclude *.pyo
13
+ global-exclude __pycache__
14
+ global-exclude .DS_Store
15
+ global-exclude .git*
16
+ global-exclude .idea
17
+ global-exclude .venv
18
+ global-exclude .env
19
+ global-exclude *.log
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: drf-to-mkdoc
3
+ Version: 0.3.4
4
+ Summary: Generate Markdown API docs from Django/DRF OpenAPI schema for MkDocs
5
+ Author-email: Hossein Shayesteh <shayestehhs1@gmail.com>
6
+ Maintainer-email: Hossein Shayesteh <shayestehhs1@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/shayestehhs/drf-to-mkdoc
9
+ Project-URL: Repository, https://github.com/shayestehhs/drf-to-mkdoc
10
+ Project-URL: Documentation, https://github.com/shayestehhs/drf-to-mkdoc#readme
11
+ Project-URL: Bug Tracker, https://github.com/shayestehhs/drf-to-mkdoc/issues
12
+ Keywords: django,django-rest-framework,documentation,mkdocs,api
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Framework :: Django
24
+ Classifier: Framework :: Django :: 3.2
25
+ Classifier: Framework :: Django :: 4.0
26
+ Classifier: Framework :: Django :: 4.1
27
+ Classifier: Framework :: Django :: 4.2
28
+ Classifier: Framework :: Django :: 5.0
29
+ Classifier: Topic :: Documentation
30
+ Classifier: Topic :: Software Development :: Documentation
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: Django<6.0,>=3.2
35
+ Requires-Dist: djangorestframework<4.0,>=3.12
36
+ Requires-Dist: PyYAML>=6.0
37
+ Requires-Dist: drf-spectacular>=0.26.0
38
+ Requires-Dist: mkdocs>=1.4.0
39
+ Requires-Dist: mkdocs-material>=9.0.0
40
+ Requires-Dist: coreapi>=2.3.0
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
43
+ Requires-Dist: pytest-django>=4.5.0; extra == "dev"
44
+ Requires-Dist: black>=22.0.0; extra == "dev"
45
+ Requires-Dist: isort>=5.10.0; extra == "dev"
46
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
47
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # DRF to MkDocs
51
+
52
+ Unlock effortless API documentation for your Django REST Framework project. Automatically generate beautiful, interactive, and maintainable docs that accelerate developer onboarding and streamline your team's workflow.
53
+
54
+ ---
55
+
56
+ ## Why DRF to MkDocs?
57
+
58
+ `DRF to MkDocs` bridges the gap between your API's OpenAPI schema and user-friendly, maintainable documentation. It introspects your Django models and DRF views to automatically generate a polished, feature-rich documentation site that stays in sync with your codebase, empowering your team to build better APIs, faster.
59
+
60
+ - **Effortless Documentation**: Automate the entire process of generating and updating your API docs. Say goodbye to manual work and outdated information.
61
+ - **Accelerate Onboarding**: Provide new joiners with interactive, easy-to-navigate documentation. The "Try-it-out" feature and clear model relationships help them become productive from day one.
62
+ - **Deeply Integrated with DRF**: Leverages `drf-spectacular` for accurate schema generation, ensuring your documentation is a true reflection of your API.
63
+ - **Enhance Developer Experience**: Features like the interactive API console and in-depth model pages streamline development, testing, and debugging for the entire team.
64
+ - **Beautiful & Professional**: Built on MkDocs with the Material theme for a clean, modern, and responsive UI that you'll be proud to share.
65
+
66
+ ## Gallery
67
+
68
+ <details>
69
+ <summary>🚀 Interactive Endpoint List & Filtering</summary>
70
+ <img width="1434" height="943" alt="List-EndPoint" src="https://github.com/user-attachments/assets/f886fc7f-afa0-4faa-b9c2-d6f754ca3597" />
71
+ </details>
72
+
73
+ <details>
74
+ <summary>🔬 Detailed Endpoint View with "Try-it-out"</summary>
75
+ <img width="958" height="887" alt="Detail-EndPoint" src="https://github.com/user-attachments/assets/9d9e3d4b-cb92-4ece-831e-aef45ceec768" />
76
+ <img width="532" height="804" alt="Try-it-out" src="https://github.com/user-attachments/assets/0f483922-60c4-4f62-8fb4-bc7372e82a03" />
77
+ </details>
78
+
79
+ <details>
80
+ <summary>📚 Rich Model Documentation</summary>
81
+ <img width="906" height="885" alt="Model-fields" src="https://github.com/user-attachments/assets/a1ca369c-ad40-4b05-83ec-ceb1f80aab23" />
82
+ <img width="848" height="886" alt="Model" src="https://github.com/user-attachments/assets/683d6d26-a8e4-4c05-8b5f-11a61a62cb0c" />
83
+ </details>
84
+
85
+ <details>
86
+ <summary>📈 Entity-Relationship Diagrams</summary>
87
+ <img width="953" height="606" alt="ER-Diagram" src="https://github.com/user-attachments/assets/3d0b1cb0-7ebf-4d4a-a181-1b7dbc9c6a01" />
88
+ </details>
89
+
90
+ ## Key Features
91
+
92
+ | Feature | Description |
93
+ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
94
+ | 🚀 **Interactive API Console** | Test endpoints directly from the documentation with a "Try-it-out" feature, complete with a request builder and response viewer. |
95
+ | 🔍 **Advanced Filtering & Search** | Instantly find endpoints with multi-criteria filtering by app, method, path, and a real-time search. |
96
+ | 📚 **In-Depth Model Pages** | Automatically generate detailed pages for each model, including fields, relationships, choices, and methods. |
97
+ | 📊 **Entity-Relationship Diagrams** | Visualize model relationships with auto-generated, interactive ER diagrams for each app and for the entire project. |
98
+ | 🎨 **Modern & Responsive UI** | A beautiful and intuitive interface powered by MkDocs Material, featuring light/dark themes and full mobile support. |
99
+ | 🔧 **Highly Customizable** | Override templates, configure settings, and use custom functions to tailor the documentation to your project's specific needs. |
100
+ | ⚙️ **Simple Integration** | Works seamlessly with existing DRF projects and `drf-spectacular` without requiring complex setup. |
101
+ | 🤖 **AI-Powered Enhancements** | (Working on it...) Leverage AI to generate smarter examples and more descriptive documentation for your API. |
102
+
103
+ ## Getting Started
104
+
105
+ ### 1. Installation
106
+
107
+ ```bash
108
+ pip install drf-to-mkdoc
109
+ ```
110
+
111
+ ### 2. Configure Your Django Project
112
+
113
+ In your `settings.py`:
114
+
115
+ ```python
116
+ # settings.py
117
+
118
+ INSTALLED_APPS = [
119
+ # ... your other apps
120
+ 'drf_to_mkdoc',
121
+ 'drf_spectacular', # Required for schema generation
122
+ ]
123
+
124
+ # Required for OpenAPI schema generation
125
+ REST_FRAMEWORK = {
126
+ 'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
127
+ }
128
+
129
+ SPECTACULAR_SETTINGS = {
130
+ 'TITLE': 'Your API',
131
+ 'DESCRIPTION': 'Your API description',
132
+ 'VERSION': '1.0.0',
133
+ }
134
+
135
+ # DRF to MkDocs specific settings
136
+ DRF_TO_MKDOC = {
137
+ 'DJANGO_APPS': [
138
+ 'users',
139
+ 'products',
140
+ # ... list all apps you want to document
141
+ ],
142
+ }
143
+ ```
144
+
145
+ ### 3. Create MkDocs Configuration
146
+
147
+ Create an `mkdocs.yml` file in your project root. You can start with the [default configuration](docs/mkdocs.yml) and customize it.
148
+
149
+ ### 4. Build Your Documentation
150
+
151
+ ```bash
152
+ python manage.py build_docs
153
+ ```
154
+
155
+ For more detailed instructions, see the full [Installation and Setup Guide](docs/installation.md).
156
+
157
+ ## Usage and Customization
158
+
159
+ ### Building Your Documentation
160
+
161
+ To build the entire documentation site, run the following command. This will generate a static site in your `site/` directory.
162
+
163
+ ```bash
164
+ python manage.py build_docs
165
+ ```
166
+
167
+ For more granular control, `DRF to MkDocs` provides several commands, such as `build_endpoint_docs` and `build_model_docs`.
168
+
169
+ ### Serving Docs with Django
170
+
171
+ You can serve your documentation directly from your Django application, protecting it with Django's authentication system. This is ideal for private or internal APIs.
172
+
173
+ For a complete guide, see [Serving Docs with Django](docs/serving_docs_with_django.md).
174
+
175
+ ### Customizing the OpenAPI Schema
176
+
177
+ `DRF to MkDocs` allows you to override and extend the auto-generated OpenAPI schema by providing a custom JSON file. This gives you fine-grained control over the final documentation, enabling you to add examples, descriptions, or even custom endpoints.
178
+
179
+ For more details, refer to the [Customizing Endpoints](docs/customizing_endpoints.md) guide.
180
+
181
+ ### Best Practices
182
+
183
+ For better project organization, we recommend creating a separate `docs_settings.py` for documentation-specific configurations and using the `--settings` flag:
184
+
185
+ ```bash
186
+ python manage.py build_docs --settings=my_project.docs_settings
187
+ ```
188
+
189
+ This keeps your production settings clean and your documentation configuration isolated.
190
+
191
+ ## Configuration
192
+
193
+ You can customize the behavior of `DRF to MkDocs` by configuring the `DRF_TO_MKDOC` dictionary in your settings file.
194
+
195
+ | Key | Description | Default |
196
+ | -------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
197
+ | `DJANGO_APPS` (required) | A list of Django app names to process. | `[]` |
198
+ | `DOCS_DIR` | The base directory where documentation will be generated. | `'docs'` |
199
+ | `ER_DIAGRAMS_DIR` | The directory for ER diagrams, relative to `DOCS_DIR`. | `'er_diagrams'` |
200
+ | `FIELD_GENERATORS` | Custom field value generators for creating better examples. | `{}` |
201
+ | `ENABLE_AI_DOCS` | A flag to enable AI-powered documentation features. | `False` |
202
+ | `PATH_PARAM_SUBSTITUTE_FUNCTION` | A custom function for substituting path parameters in URLs. | `None` |
203
+ | `PATH_PARAM_SUBSTITUTE_MAPPING` | A mapping for substituting common path parameters (e.g., `{'pk': 1}`). | `{}` |
204
+
205
+ ## How It Works
206
+
207
+ `DRF to MkDocs` operates in a few stages:
208
+
209
+ 1. **Model Introspection**: It deeply analyzes your Django models, mapping out their fields, relationships (like ForeignKeys and ManyToManyFields), and metadata.
210
+ 2. **Schema Generation**: It uses `drf-spectacular` to generate a detailed OpenAPI schema for your API endpoints.
211
+ 3. **Template Rendering**: It renders Jinja2 templates for each endpoint, model, and ER diagram, creating Markdown files.
212
+ 4. **MkDocs Build**: Finally, it invokes MkDocs to build a static HTML site from the generated Markdown files.
213
+
214
+ This process ensures that your documentation is always an accurate and comprehensive reflection of your codebase.
215
+
216
+ ## Contributing
217
+
218
+ Contributions are welcome! Whether it's a bug report, a new feature, or an improvement to the documentation, we appreciate your help. To ensure code quality, we use **CoderabbitAI** for automated code reviews on all pull requests.
219
+
220
+ Please see our [Contributing Guidelines](CONTRIBUTING.md) to get started.
221
+
222
+ ### Development Setup
223
+
224
+ ```bash
225
+ git clone https://github.com/Shayestehhs/drf-to-mkdoc.git
226
+ cd drf-to-mkdoc
227
+ pip install -e ".[dev]"
228
+ ```
229
+
230
+ ## License
231
+
232
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,183 @@
1
+ # DRF to MkDocs
2
+
3
+ Unlock effortless API documentation for your Django REST Framework project. Automatically generate beautiful, interactive, and maintainable docs that accelerate developer onboarding and streamline your team's workflow.
4
+
5
+ ---
6
+
7
+ ## Why DRF to MkDocs?
8
+
9
+ `DRF to MkDocs` bridges the gap between your API's OpenAPI schema and user-friendly, maintainable documentation. It introspects your Django models and DRF views to automatically generate a polished, feature-rich documentation site that stays in sync with your codebase, empowering your team to build better APIs, faster.
10
+
11
+ - **Effortless Documentation**: Automate the entire process of generating and updating your API docs. Say goodbye to manual work and outdated information.
12
+ - **Accelerate Onboarding**: Provide new joiners with interactive, easy-to-navigate documentation. The "Try-it-out" feature and clear model relationships help them become productive from day one.
13
+ - **Deeply Integrated with DRF**: Leverages `drf-spectacular` for accurate schema generation, ensuring your documentation is a true reflection of your API.
14
+ - **Enhance Developer Experience**: Features like the interactive API console and in-depth model pages streamline development, testing, and debugging for the entire team.
15
+ - **Beautiful & Professional**: Built on MkDocs with the Material theme for a clean, modern, and responsive UI that you'll be proud to share.
16
+
17
+ ## Gallery
18
+
19
+ <details>
20
+ <summary>🚀 Interactive Endpoint List & Filtering</summary>
21
+ <img width="1434" height="943" alt="List-EndPoint" src="https://github.com/user-attachments/assets/f886fc7f-afa0-4faa-b9c2-d6f754ca3597" />
22
+ </details>
23
+
24
+ <details>
25
+ <summary>🔬 Detailed Endpoint View with "Try-it-out"</summary>
26
+ <img width="958" height="887" alt="Detail-EndPoint" src="https://github.com/user-attachments/assets/9d9e3d4b-cb92-4ece-831e-aef45ceec768" />
27
+ <img width="532" height="804" alt="Try-it-out" src="https://github.com/user-attachments/assets/0f483922-60c4-4f62-8fb4-bc7372e82a03" />
28
+ </details>
29
+
30
+ <details>
31
+ <summary>📚 Rich Model Documentation</summary>
32
+ <img width="906" height="885" alt="Model-fields" src="https://github.com/user-attachments/assets/a1ca369c-ad40-4b05-83ec-ceb1f80aab23" />
33
+ <img width="848" height="886" alt="Model" src="https://github.com/user-attachments/assets/683d6d26-a8e4-4c05-8b5f-11a61a62cb0c" />
34
+ </details>
35
+
36
+ <details>
37
+ <summary>📈 Entity-Relationship Diagrams</summary>
38
+ <img width="953" height="606" alt="ER-Diagram" src="https://github.com/user-attachments/assets/3d0b1cb0-7ebf-4d4a-a181-1b7dbc9c6a01" />
39
+ </details>
40
+
41
+ ## Key Features
42
+
43
+ | Feature | Description |
44
+ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | 🚀 **Interactive API Console** | Test endpoints directly from the documentation with a "Try-it-out" feature, complete with a request builder and response viewer. |
46
+ | 🔍 **Advanced Filtering & Search** | Instantly find endpoints with multi-criteria filtering by app, method, path, and a real-time search. |
47
+ | 📚 **In-Depth Model Pages** | Automatically generate detailed pages for each model, including fields, relationships, choices, and methods. |
48
+ | 📊 **Entity-Relationship Diagrams** | Visualize model relationships with auto-generated, interactive ER diagrams for each app and for the entire project. |
49
+ | 🎨 **Modern & Responsive UI** | A beautiful and intuitive interface powered by MkDocs Material, featuring light/dark themes and full mobile support. |
50
+ | 🔧 **Highly Customizable** | Override templates, configure settings, and use custom functions to tailor the documentation to your project's specific needs. |
51
+ | ⚙️ **Simple Integration** | Works seamlessly with existing DRF projects and `drf-spectacular` without requiring complex setup. |
52
+ | 🤖 **AI-Powered Enhancements** | (Working on it...) Leverage AI to generate smarter examples and more descriptive documentation for your API. |
53
+
54
+ ## Getting Started
55
+
56
+ ### 1. Installation
57
+
58
+ ```bash
59
+ pip install drf-to-mkdoc
60
+ ```
61
+
62
+ ### 2. Configure Your Django Project
63
+
64
+ In your `settings.py`:
65
+
66
+ ```python
67
+ # settings.py
68
+
69
+ INSTALLED_APPS = [
70
+ # ... your other apps
71
+ 'drf_to_mkdoc',
72
+ 'drf_spectacular', # Required for schema generation
73
+ ]
74
+
75
+ # Required for OpenAPI schema generation
76
+ REST_FRAMEWORK = {
77
+ 'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
78
+ }
79
+
80
+ SPECTACULAR_SETTINGS = {
81
+ 'TITLE': 'Your API',
82
+ 'DESCRIPTION': 'Your API description',
83
+ 'VERSION': '1.0.0',
84
+ }
85
+
86
+ # DRF to MkDocs specific settings
87
+ DRF_TO_MKDOC = {
88
+ 'DJANGO_APPS': [
89
+ 'users',
90
+ 'products',
91
+ # ... list all apps you want to document
92
+ ],
93
+ }
94
+ ```
95
+
96
+ ### 3. Create MkDocs Configuration
97
+
98
+ Create an `mkdocs.yml` file in your project root. You can start with the [default configuration](docs/mkdocs.yml) and customize it.
99
+
100
+ ### 4. Build Your Documentation
101
+
102
+ ```bash
103
+ python manage.py build_docs
104
+ ```
105
+
106
+ For more detailed instructions, see the full [Installation and Setup Guide](docs/installation.md).
107
+
108
+ ## Usage and Customization
109
+
110
+ ### Building Your Documentation
111
+
112
+ To build the entire documentation site, run the following command. This will generate a static site in your `site/` directory.
113
+
114
+ ```bash
115
+ python manage.py build_docs
116
+ ```
117
+
118
+ For more granular control, `DRF to MkDocs` provides several commands, such as `build_endpoint_docs` and `build_model_docs`.
119
+
120
+ ### Serving Docs with Django
121
+
122
+ You can serve your documentation directly from your Django application, protecting it with Django's authentication system. This is ideal for private or internal APIs.
123
+
124
+ For a complete guide, see [Serving Docs with Django](docs/serving_docs_with_django.md).
125
+
126
+ ### Customizing the OpenAPI Schema
127
+
128
+ `DRF to MkDocs` allows you to override and extend the auto-generated OpenAPI schema by providing a custom JSON file. This gives you fine-grained control over the final documentation, enabling you to add examples, descriptions, or even custom endpoints.
129
+
130
+ For more details, refer to the [Customizing Endpoints](docs/customizing_endpoints.md) guide.
131
+
132
+ ### Best Practices
133
+
134
+ For better project organization, we recommend creating a separate `docs_settings.py` for documentation-specific configurations and using the `--settings` flag:
135
+
136
+ ```bash
137
+ python manage.py build_docs --settings=my_project.docs_settings
138
+ ```
139
+
140
+ This keeps your production settings clean and your documentation configuration isolated.
141
+
142
+ ## Configuration
143
+
144
+ You can customize the behavior of `DRF to MkDocs` by configuring the `DRF_TO_MKDOC` dictionary in your settings file.
145
+
146
+ | Key | Description | Default |
147
+ | -------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
148
+ | `DJANGO_APPS` (required) | A list of Django app names to process. | `[]` |
149
+ | `DOCS_DIR` | The base directory where documentation will be generated. | `'docs'` |
150
+ | `ER_DIAGRAMS_DIR` | The directory for ER diagrams, relative to `DOCS_DIR`. | `'er_diagrams'` |
151
+ | `FIELD_GENERATORS` | Custom field value generators for creating better examples. | `{}` |
152
+ | `ENABLE_AI_DOCS` | A flag to enable AI-powered documentation features. | `False` |
153
+ | `PATH_PARAM_SUBSTITUTE_FUNCTION` | A custom function for substituting path parameters in URLs. | `None` |
154
+ | `PATH_PARAM_SUBSTITUTE_MAPPING` | A mapping for substituting common path parameters (e.g., `{'pk': 1}`). | `{}` |
155
+
156
+ ## How It Works
157
+
158
+ `DRF to MkDocs` operates in a few stages:
159
+
160
+ 1. **Model Introspection**: It deeply analyzes your Django models, mapping out their fields, relationships (like ForeignKeys and ManyToManyFields), and metadata.
161
+ 2. **Schema Generation**: It uses `drf-spectacular` to generate a detailed OpenAPI schema for your API endpoints.
162
+ 3. **Template Rendering**: It renders Jinja2 templates for each endpoint, model, and ER diagram, creating Markdown files.
163
+ 4. **MkDocs Build**: Finally, it invokes MkDocs to build a static HTML site from the generated Markdown files.
164
+
165
+ This process ensures that your documentation is always an accurate and comprehensive reflection of your codebase.
166
+
167
+ ## Contributing
168
+
169
+ Contributions are welcome! Whether it's a bug report, a new feature, or an improvement to the documentation, we appreciate your help. To ensure code quality, we use **CoderabbitAI** for automated code reviews on all pull requests.
170
+
171
+ Please see our [Contributing Guidelines](CONTRIBUTING.md) to get started.
172
+
173
+ ### Development Setup
174
+
175
+ ```bash
176
+ git clone https://github.com/Shayestehhs/drf-to-mkdoc.git
177
+ cd drf-to-mkdoc
178
+ pip install -e ".[dev]"
179
+ ```
180
+
181
+ ## License
182
+
183
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
File without changes
@@ -0,0 +1,11 @@
1
+ DEFAULTS = {
2
+ "TEMPLATES_DIR": None, # Optional override directory
3
+ "PAGINATION_MAP": {
4
+ "rest_framework.pagination.PageNumberPagination": "pagination/page_number.md",
5
+ "rest_framework.pagination.LimitOffsetPagination": "pagination/limit_offset.md",
6
+ "rest_framework.pagination.CursorPagination": "pagination/cursor.md",
7
+ },
8
+ "INDEX_TEMPLATE": "index.md",
9
+ "AUTH_TEMPLATE": "auth.md",
10
+ "PATH_PARAM_SUBSTITUTOR": None,
11
+ }
@@ -0,0 +1,21 @@
1
+ from django.conf import settings
2
+
3
+ from .defaults import DEFAULTS
4
+
5
+
6
+ class DocBuilderSettings:
7
+ def __init__(self, user_settings_key="DOC_BUILDER", defaults=None):
8
+ self.user_settings_key = user_settings_key
9
+ self._user_settings = getattr(settings, user_settings_key, {})
10
+ self.defaults = defaults or {}
11
+
12
+ def get(self, key):
13
+ if key not in self.defaults:
14
+ raise AttributeError(f"Invalid DOC_BUILDER setting: '{key}'")
15
+ return self._user_settings.get(key, self.defaults[key])
16
+
17
+ def __getattr__(self, key):
18
+ return self.get(key)
19
+
20
+
21
+ drf_to_mkdoc_settings = DocBuilderSettings(defaults=DEFAULTS)