handsdown-fork 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.
- handsdown_fork-0.1.0/LICENSE +22 -0
- handsdown_fork-0.1.0/MANIFEST.in +4 -0
- handsdown_fork-0.1.0/PKG-INFO +436 -0
- handsdown_fork-0.1.0/README.md +373 -0
- handsdown_fork-0.1.0/handsdown/__init__.py +4 -0
- handsdown_fork-0.1.0/handsdown/__main__.py +5 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/__init__.py +28 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/__init__.py +1 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/base_analyzer.py +29 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/class_analyzer.py +176 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/expression_analyzer.py +740 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/function_analyzer.py +170 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/analyzers/module_analyzer.py +210 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/module_record_list.py +75 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/__init__.py +1 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/argument_record.py +107 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/attribute_record.py +69 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/class_record.py +136 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/expression_record.py +60 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/function_record.py +141 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/import_record.py +96 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/module_record.py +298 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/node_record.py +159 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/node_records/text_record.py +49 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/smart_ast.py +160 -0
- handsdown_fork-0.1.0/handsdown/ast_parser/type_defs.py +24 -0
- handsdown_fork-0.1.0/handsdown/cli_parser.py +294 -0
- handsdown_fork-0.1.0/handsdown/constants.py +22 -0
- handsdown_fork-0.1.0/handsdown/exceptions.py +21 -0
- handsdown_fork-0.1.0/handsdown/generators/__init__.py +0 -0
- handsdown_fork-0.1.0/handsdown/generators/base.py +418 -0
- handsdown_fork-0.1.0/handsdown/generators/material.py +23 -0
- handsdown_fork-0.1.0/handsdown/generators/rtd.py +13 -0
- handsdown_fork-0.1.0/handsdown/jinja_manager.py +60 -0
- handsdown_fork-0.1.0/handsdown/loader.py +159 -0
- handsdown_fork-0.1.0/handsdown/main.py +63 -0
- handsdown_fork-0.1.0/handsdown/md_document.py +327 -0
- handsdown_fork-0.1.0/handsdown/processors/__init__.py +6 -0
- handsdown_fork-0.1.0/handsdown/processors/base.py +308 -0
- handsdown_fork-0.1.0/handsdown/processors/pep257.py +116 -0
- handsdown_fork-0.1.0/handsdown/processors/rst.py +147 -0
- handsdown_fork-0.1.0/handsdown/processors/section.py +43 -0
- handsdown_fork-0.1.0/handsdown/processors/section_block.py +28 -0
- handsdown_fork-0.1.0/handsdown/processors/section_map.py +107 -0
- handsdown_fork-0.1.0/handsdown/processors/smart.py +45 -0
- handsdown_fork-0.1.0/handsdown/py.typed +0 -0
- handsdown_fork-0.1.0/handsdown/templates/common/argument.py.jinja2 +10 -0
- handsdown_fork-0.1.0/handsdown/templates/common/class.md.jinja2 +31 -0
- handsdown_fork-0.1.0/handsdown/templates/common/class_signature.py.jinja2 +15 -0
- handsdown_fork-0.1.0/handsdown/templates/common/docstring.md.jinja2 +8 -0
- handsdown_fork-0.1.0/handsdown/templates/common/function.md.jinja2 +19 -0
- handsdown_fork-0.1.0/handsdown/templates/common/function_signature.py.jinja2 +21 -0
- handsdown_fork-0.1.0/handsdown/templates/common/gh_pages_config.yml.jinja2 +5 -0
- handsdown_fork-0.1.0/handsdown/templates/common/index.md.jinja2 +28 -0
- handsdown_fork-0.1.0/handsdown/templates/common/method.md.jinja2 +21 -0
- handsdown_fork-0.1.0/handsdown/templates/material/mkdocs.yml.jinja2 +41 -0
- handsdown_fork-0.1.0/handsdown/templates/material/module.md.jinja2 +56 -0
- handsdown_fork-0.1.0/handsdown/templates/material/readthedocs.yml.jinja2 +19 -0
- handsdown_fork-0.1.0/handsdown/templates/material/requirements.mkdocs.txt.jinja2 +2 -0
- handsdown_fork-0.1.0/handsdown/templates/readthedocs/mkdocs.yml.jinja2 +9 -0
- handsdown_fork-0.1.0/handsdown/templates/readthedocs/module.md.jinja2 +56 -0
- handsdown_fork-0.1.0/handsdown/templates/readthedocs/readthedocs.yml.jinja2 +15 -0
- handsdown_fork-0.1.0/handsdown/utils/__init__.py +1 -0
- handsdown_fork-0.1.0/handsdown/utils/blackify.py +33 -0
- handsdown_fork-0.1.0/handsdown/utils/docstring_formatter.py +66 -0
- handsdown_fork-0.1.0/handsdown/utils/import_string.py +206 -0
- handsdown_fork-0.1.0/handsdown/utils/indent_trimmer.py +157 -0
- handsdown_fork-0.1.0/handsdown/utils/logger.py +32 -0
- handsdown_fork-0.1.0/handsdown/utils/markdown.py +104 -0
- handsdown_fork-0.1.0/handsdown/utils/path.py +20 -0
- handsdown_fork-0.1.0/handsdown/utils/path_finder.py +204 -0
- handsdown_fork-0.1.0/handsdown/utils/strings.py +74 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/PKG-INFO +436 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/SOURCES.txt +83 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/dependency_links.txt +1 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/entry_points.txt +2 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/requires.txt +5 -0
- handsdown_fork-0.1.0/handsdown_fork.egg-info/top_level.txt +1 -0
- handsdown_fork-0.1.0/pyproject.toml +177 -0
- handsdown_fork-0.1.0/setup.cfg +4 -0
- handsdown_fork-0.1.0/tests/test_cli_parser.py +64 -0
- handsdown_fork-0.1.0/tests/test_loader.py +9 -0
- handsdown_fork-0.1.0/tests/test_main.py +40 -0
- handsdown_fork-0.1.0/tests/test_md_document.py +87 -0
- handsdown_fork-0.1.0/tests/test_section_map.py +39 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) FredHappyface
|
|
4
|
+
Copyright (c) 2019 Vlad Emelianov
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: handsdown-fork
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A fork of handsdown, the python docstring-based documentation generator for lazy perfectionists.
|
|
5
|
+
Author: FredHappyface
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) FredHappyface
|
|
9
|
+
Copyright (c) 2019 Vlad Emelianov
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://vemel.github.io/handsdown
|
|
30
|
+
Project-URL: Documentation, https://vemel.github.io/handsdown
|
|
31
|
+
Project-URL: Repository, https://github.com/vemel/handsdown
|
|
32
|
+
Project-URL: Changelog, https://github.com/vemel/handsdown/releases
|
|
33
|
+
Project-URL: Issues, https://github.com/vemel/handsdown/issues
|
|
34
|
+
Keywords: autodoc,documentation,generator,markdown
|
|
35
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
36
|
+
Classifier: Environment :: Console
|
|
37
|
+
Classifier: Framework :: Django
|
|
38
|
+
Classifier: Framework :: Flask
|
|
39
|
+
Classifier: Intended Audience :: Developers
|
|
40
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
41
|
+
Classifier: Natural Language :: English
|
|
42
|
+
Classifier: Operating System :: OS Independent
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
48
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
50
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
51
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
52
|
+
Classifier: Typing :: Typed
|
|
53
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
54
|
+
Requires-Python: >=3.9
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
License-File: LICENSE
|
|
57
|
+
Requires-Dist: importlib-resources
|
|
58
|
+
Requires-Dist: jinja2
|
|
59
|
+
Requires-Dist: black
|
|
60
|
+
Requires-Dist: basedpyright>=1.39.8
|
|
61
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
62
|
+
Dynamic: license-file
|
|
63
|
+
|
|
64
|
+
# 🙌 Handsdown-fork
|
|
65
|
+
|
|
66
|
+
[](../../)
|
|
67
|
+
[](../../issues)
|
|
68
|
+
[](/LICENSE.md)
|
|
69
|
+
[](../../commits/master)
|
|
70
|
+
[](../../commits/master)
|
|
71
|
+
[](https://pypistats.org/packages/handsdown-fork)
|
|
72
|
+
[](https://pepy.tech/project/handsdown-fork)
|
|
73
|
+
[](https://pypi.org/project/handsdown-fork)
|
|
74
|
+
|
|
75
|
+
A fork of handsdown, the python docstring-based documentation generator for lazy perfectionists.
|
|
76
|
+
|
|
77
|
+
Huge thanks to <https://github.com/vemel/handsdown> for all of the groundwork!
|
|
78
|
+
|
|
79
|
+
- [🙌 Handsdown-fork](#-handsdown-fork)
|
|
80
|
+
- [Features](#features)
|
|
81
|
+
- [Do you need handsdown-fork?](#do-you-need-handsdown-fork)
|
|
82
|
+
- [Examples](#examples)
|
|
83
|
+
- [Usage](#usage)
|
|
84
|
+
- [💻 From command line](#-from-command-line)
|
|
85
|
+
- [🚀 Use a new Material design](#-use-a-new-material-design)
|
|
86
|
+
- [📝 As a GitHub Pages manager](#-as-a-github-pages-manager)
|
|
87
|
+
- [🐏 Deploy on Read the Docs](#-deploy-on-read-the-docs)
|
|
88
|
+
- [📋 Build static HTML](#-build-static-html)
|
|
89
|
+
- [🧩 As a module](#-as-a-module)
|
|
90
|
+
- [⌨️ CLI arguments](#️-cli-arguments)
|
|
91
|
+
- [Project Documentation](#project-documentation)
|
|
92
|
+
- [Installation](#installation)
|
|
93
|
+
- [Language information](#language-information)
|
|
94
|
+
- [Working with the repo](#working-with-the-repo)
|
|
95
|
+
- [Community Files](#community-files)
|
|
96
|
+
- [Licence](#licence)
|
|
97
|
+
- [Code of Conduct](#code-of-conduct)
|
|
98
|
+
- [Contributing](#contributing)
|
|
99
|
+
- [Security](#security)
|
|
100
|
+
- [Support](#support)
|
|
101
|
+
|
|
102
|
+
## Features
|
|
103
|
+
|
|
104
|
+
- [Material design](#-use-a-new-material-design) support!
|
|
105
|
+
- [PEP 257](https://www.python.org/dev/peps/pep-0257/),
|
|
106
|
+
[Google](http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings),
|
|
107
|
+
[Sphinx](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html)
|
|
108
|
+
and [reStructuredText](https://www.python.org/dev/peps/pep-0287/)
|
|
109
|
+
docstrings support. All of them are converted to a valid Markdown.
|
|
110
|
+
- Works with [Django](https://www.djangoproject.com/) and [Flask](https://palletsprojects.com/p/flask/) apps
|
|
111
|
+
- Can be used locally, or
|
|
112
|
+
[right on GitHub](https://github.com/FHPythonUtils/handsdown-fork/blob/docs/README.md) or even deployed on
|
|
113
|
+
[GitHub Pages](https://vemel.github.io/handsdown/) and [Read the Docs](https://handsdown.readthedocs.io/)!
|
|
114
|
+
- Signatures for every class, function, property and method.
|
|
115
|
+
- Support for type annotations. Even for the ones from the `__future__`!
|
|
116
|
+
- Nice list of all modules in [Index](https://github.com/FHPythonUtils/handsdown-fork/blob/docs/README.md)
|
|
117
|
+
- Gather all scattered `README.md` in submodules to one place
|
|
118
|
+
- Find related source code from every doc section.
|
|
119
|
+
- Make links by just adding `module.import.String` to docs.
|
|
120
|
+
- Do you use type annotations? Well, you get auto-discovery of related modules for free!
|
|
121
|
+
|
|
122
|
+
## Do you need handsdown-fork?
|
|
123
|
+
|
|
124
|
+
You definitely *do* if you:
|
|
125
|
+
|
|
126
|
+
- prefer to automate documentation builds
|
|
127
|
+
- work with a team and plan to simplify knowledge sharing
|
|
128
|
+
- want to show your project without navigating through a source code
|
|
129
|
+
- build `Django` or `Flask` applications
|
|
130
|
+
- are proud of your project and not afraid to show it
|
|
131
|
+
- love Open Source
|
|
132
|
+
|
|
133
|
+
## Examples
|
|
134
|
+
|
|
135
|
+
- [All documentation](https://vemel.github.io/handsdown/) in this project
|
|
136
|
+
- [Main](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/main_example.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/main_example.md)
|
|
137
|
+
- [RST docstrings](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/rst_docstrings.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/rst_docstrings.md)
|
|
138
|
+
- [Google docstrings](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/google_docstrings.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/google_docstrings.md)
|
|
139
|
+
- [PEP 257 docstrings](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/pep257_docstrings.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/pep257_docstrings.md)
|
|
140
|
+
- [Sphinx docstrings](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/sphinx_docstrings.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/sphinx_docstrings.md)
|
|
141
|
+
- [Type annotations](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/typed.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/typed.md)
|
|
142
|
+
- [Comment-style type annotations](https://github.com/FHPythonUtils/handsdown-fork/blob/main/examples/comment_typed.py) with [generated output](https://github.com/FHPythonUtils/handsdown-fork/tree/docs/examples/comment_typed.md)
|
|
143
|
+
|
|
144
|
+
## Usage
|
|
145
|
+
|
|
146
|
+
### 💻 From command line
|
|
147
|
+
|
|
148
|
+
Just go to your favorite project that has lots of docstrings but missing
|
|
149
|
+
auto-generated docs and let `handsdown` do the thing.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
cd ~/my/project
|
|
153
|
+
|
|
154
|
+
# build documentation *.md* files in docs/* directory
|
|
155
|
+
handsdown
|
|
156
|
+
|
|
157
|
+
# or provide custom output directory: output_dir/*
|
|
158
|
+
handsdown -o output_dir
|
|
159
|
+
|
|
160
|
+
# generate docs only for my_module, but exclude migrations
|
|
161
|
+
handsdown my_module --exclude my_module/migrations
|
|
162
|
+
|
|
163
|
+
# generate documentation for deployment
|
|
164
|
+
handsdown --external `git config --get remote.origin.url` -n ProjectName --branch main --create-configs
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Navigate to `docs/README.md` to check your new documentation!
|
|
168
|
+
|
|
169
|
+
### 🚀 Use a new Material design
|
|
170
|
+
|
|
171
|
+
- Add `mkdocs` and `mkdocs-material` to your dev dependencies or just install them
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# generate MarkDown documentation in docsmd folder
|
|
175
|
+
handsdown --external `git config --get remote.origin.url` -o docsmd -n <project_name> --theme=material --create-configs
|
|
176
|
+
|
|
177
|
+
# generate html files to docs folder
|
|
178
|
+
python -m mkdocs build
|
|
179
|
+
```
|
|
180
|
+
<!--
|
|
181
|
+
### 📦 As a Docker image
|
|
182
|
+
|
|
183
|
+
Work in progress -->
|
|
184
|
+
|
|
185
|
+
### 📝 As a GitHub Pages manager
|
|
186
|
+
|
|
187
|
+
With `--external` CLI flag, `handsdown` generates all required configuration
|
|
188
|
+
for [GitHub Pages](https://pages.github.com/), so you just need to setup your
|
|
189
|
+
GitHub repository.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Generate documentation that points to main branch
|
|
193
|
+
# do not use custom output location, as `GitHub Pages`
|
|
194
|
+
# works only with `docs` directory
|
|
195
|
+
handsdown --external `git config --get remote.origin.url` --create-configs
|
|
196
|
+
|
|
197
|
+
# or specify GitHub url directly
|
|
198
|
+
handsdown --external https://github.com/<user>/<project> --create-configs
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- Generate documentation with `--external` flag as shown above, do not use `--output`
|
|
202
|
+
flag, only `docs` folder is supported by `GitHub Pages`
|
|
203
|
+
- Commit and push all changes a to `main` branch.
|
|
204
|
+
- Set your GitHub project `Settings` > `GitHub Pages` > `Source` to `main branch /docs folder`
|
|
205
|
+
|
|
206
|
+
All set! You can change `docs/_config.yml` to add your own touch.
|
|
207
|
+
|
|
208
|
+
With `--external` flag links to your source are absolute and point to your GitHub repo. If you
|
|
209
|
+
still want to have relative links to source, e.g. for using docs locally,
|
|
210
|
+
generate docs to another folder
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# `docs_local` folder will be created in your project root
|
|
214
|
+
# you probably want to add it to .gitignore
|
|
215
|
+
handsdown -o docs_local
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 🐏 Deploy on Read the Docs
|
|
219
|
+
|
|
220
|
+
With `--external` CLI flag, `handsdown` generates all required configuration
|
|
221
|
+
for [Read the Docs](https://readthedocs.org/), so you just need to to add your
|
|
222
|
+
GitHub repository to `Read the Docs`.
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Generate documentation that points to main branch
|
|
226
|
+
# do not use custom output location, as `GitHub Pages`
|
|
227
|
+
# works only with `docs` directory
|
|
228
|
+
handsdown --external `git config --get remote.origin.url` --create-configs
|
|
229
|
+
|
|
230
|
+
# or specify GitHub url directly
|
|
231
|
+
handsdown --external https://github.com/<user>/<project>/ --create-configs
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- Generate documentation with `--external` flag as shown above, do not use `--output`
|
|
235
|
+
flag, only `docs` folder is supported by `Read the Docs`
|
|
236
|
+
- Commit and push all changes a to `main` branch.
|
|
237
|
+
- Add your repository on [Read the Docs](https://readthedocs.org/)
|
|
238
|
+
|
|
239
|
+
All set! You can change `.readthedocs.yml` and `mkdocs.yml` to add your own touch.
|
|
240
|
+
|
|
241
|
+
### 📋 Build static HTML
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Generate documentation that points to main branch
|
|
245
|
+
# with source links pointing to your repository
|
|
246
|
+
# this command also creates `mkdocs.yml`
|
|
247
|
+
handsdown --external `git config --get remote.origin.url` --create-configs
|
|
248
|
+
|
|
249
|
+
# Run mkdocs to build HTML
|
|
250
|
+
python -m mkdocs build
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 🧩 As a module
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from handsdown.generator import Generator
|
|
257
|
+
from handsdown.utils.path_finder import PathFinder
|
|
258
|
+
|
|
259
|
+
# this is our project root directory
|
|
260
|
+
repo_path = Path.cwd()
|
|
261
|
+
|
|
262
|
+
# this little tool works like `pathlib.Path.glob` with some extra magic
|
|
263
|
+
# but in this case `repo_path.glob("**/*.py")` would do as well
|
|
264
|
+
path_finder = PathFinder(repo_path, "**/*.py")
|
|
265
|
+
|
|
266
|
+
# no docs for tests and build
|
|
267
|
+
path_finder.exclude("tests/*", "build/*")
|
|
268
|
+
|
|
269
|
+
# initialize generator
|
|
270
|
+
handsdown = Generator(
|
|
271
|
+
input_path=repo_path,
|
|
272
|
+
output_path=repo_path / 'output',
|
|
273
|
+
source_paths=path_finder.glob("**/*.py")
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# generate all docs at once
|
|
277
|
+
handsdown.generate_docs()
|
|
278
|
+
|
|
279
|
+
# or generate just for one doc
|
|
280
|
+
handsdown.generate_doc(repo_path / 'my_module' / 'source.py')
|
|
281
|
+
|
|
282
|
+
# generate index.md file
|
|
283
|
+
handsdown.generate_index()
|
|
284
|
+
|
|
285
|
+
# and generate GitHub Pages and Read the Docs config files
|
|
286
|
+
handsdown.generate_configs()
|
|
287
|
+
|
|
288
|
+
# navigate to `output` dir and check results
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### ⌨️ CLI arguments
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
handsdown [-h] [--exclude [EXCLUDE ...]] [-i INPUT_PATH] [-f [FILES ...]]
|
|
295
|
+
[-o OUTPUT_PATH] [--external REPO_URL] [--source-code-path REPO_PATH]
|
|
296
|
+
[--branch BRANCH] [--toc-depth TOC_DEPTH] [--cleanup] [-n PROJECT_NAME]
|
|
297
|
+
[-e ENCODING] [--panic] [-d] [-q] [-V]
|
|
298
|
+
[include ...]
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
| Argument | Description | Default |
|
|
302
|
+
|-|-|-|
|
|
303
|
+
| `include` | Path expressions to include source files | |
|
|
304
|
+
| `--exclude` | Path expressions to exclude source files | `'build/*' 'tests/*' 'test/*' '*/__pycache__/*' '.*/*'` |
|
|
305
|
+
| `-i` / `--input-path` | Path to project root folder | `<cwd>` |
|
|
306
|
+
| `-f` / `--files` | List of source files to use for generation. If empty - all are used. | |
|
|
307
|
+
| `-o` / `--output-path` | Path to output folder | `<cwd>/docs` |
|
|
308
|
+
| `--external` | Build docs and config for external hosting, GitHub Pages or Read the Docs. Provide the project GitHub .../blob/main/ URL here. | |
|
|
309
|
+
| `--source-code-path` | Path to source code in the project. Overrides `--branch` CLI argument | |
|
|
310
|
+
| `--branch` | Main branch name | `main` |
|
|
311
|
+
| `--toc-depth` | Maximum depth of child modules ToC | `3` |
|
|
312
|
+
| `--cleanup` | Remove orphaned auto-generated docs | |
|
|
313
|
+
| `-n` / `--name` | Project name | `<cwd>.name` |
|
|
314
|
+
| `-e` / `--encoding` | Input and output file encoding | `utf-8` |
|
|
315
|
+
| `--panic` | Panic and die on import error | |
|
|
316
|
+
| `--debug` | Show debug messages| |
|
|
317
|
+
| `--quiet` | Hide log output | |
|
|
318
|
+
| `--create-configs` | Create config files for deployment to RtD and GitHub Pages | |
|
|
319
|
+
| `-t` / `--theme` | Output mkdocs theme: `readthedocs` or `material` | `readthedocs` |
|
|
320
|
+
| `-h` | Show help | |
|
|
321
|
+
|
|
322
|
+
## Project Documentation
|
|
323
|
+
|
|
324
|
+
A high-level overview of how the documentation is organized organized will help you know
|
|
325
|
+
where to look for certain things:
|
|
326
|
+
|
|
327
|
+
<!--
|
|
328
|
+
- [Tutorials](/documentation/tutorials) take you by the hand through a series of steps to get
|
|
329
|
+
started using the software. Start here if you’re new.
|
|
330
|
+
-->
|
|
331
|
+
- The [Technical Reference](/docs) documents APIs and other aspects of the
|
|
332
|
+
machinery. This documentation describes how to use the classes and functions at a lower level
|
|
333
|
+
and assume that you have a good high-level understanding of the software. Note this is generated
|
|
334
|
+
with handsdown-fork
|
|
335
|
+
<!--
|
|
336
|
+
- The [Help](/documentation/help) guide provides a starting point and outlines common issues that you
|
|
337
|
+
may have.
|
|
338
|
+
-->
|
|
339
|
+
|
|
340
|
+
## Installation
|
|
341
|
+
|
|
342
|
+
Install using `pip` from PyPI
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
pip install handsdown-fork
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
or directly from GitHub if you cannot wait to test new features
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
pip install git+https://github.com/FHPythonUtils/handsdown-fork.git
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Language information
|
|
355
|
+
|
|
356
|
+
Using python 3.9, to 3.14
|
|
357
|
+
|
|
358
|
+
## Working with the repo
|
|
359
|
+
|
|
360
|
+
Clone, the repo with
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
git clone https://github.com/FHPythonUtils/handsdown-fork
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Format
|
|
367
|
+
|
|
368
|
+
```sh
|
|
369
|
+
uv run ruff format
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Linting
|
|
373
|
+
|
|
374
|
+
```sh
|
|
375
|
+
uv run ruff check
|
|
376
|
+
uv run python3 -m basedpyright -p .
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Testing
|
|
380
|
+
|
|
381
|
+
```sh
|
|
382
|
+
uv run python3 -m pytest
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Alternatively use `tox` to run tests over a range of python versions
|
|
386
|
+
|
|
387
|
+
```sh
|
|
388
|
+
uvx tox
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Documentation
|
|
392
|
+
|
|
393
|
+
```sh
|
|
394
|
+
uv run handsdown
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Community Files
|
|
398
|
+
|
|
399
|
+
### Licence
|
|
400
|
+
|
|
401
|
+
MIT License
|
|
402
|
+
Copyright (c) FredHappyface
|
|
403
|
+
Copyright (c) 2019 Vlad Emelianov
|
|
404
|
+
(See the [LICENSE](/LICENSE) for more information.)
|
|
405
|
+
|
|
406
|
+
<!-- ### Changelog
|
|
407
|
+
|
|
408
|
+
See the [Changelog](/CHANGELOG.md) for more information. -->
|
|
409
|
+
|
|
410
|
+
### Code of Conduct
|
|
411
|
+
|
|
412
|
+
Online communities include people from many backgrounds. The *Project*
|
|
413
|
+
contributors are committed to providing a friendly, safe and welcoming
|
|
414
|
+
environment for all. Please see the
|
|
415
|
+
[Code of Conduct](https://github.com/FHPythonUtils/.github/blob/master/CODE_OF_CONDUCT.md)
|
|
416
|
+
for more information.
|
|
417
|
+
|
|
418
|
+
### Contributing
|
|
419
|
+
|
|
420
|
+
Contributions are welcome, please see the
|
|
421
|
+
[Contributing Guidelines](https://github.com/FHPythonUtils/.github/blob/master/CONTRIBUTING.md)
|
|
422
|
+
for more information.
|
|
423
|
+
|
|
424
|
+
### Security
|
|
425
|
+
|
|
426
|
+
Thank you for improving the security of the project, please see the
|
|
427
|
+
[Security Policy](https://github.com/FHPythonUtils/.github/blob/master/SECURITY.md)
|
|
428
|
+
for more information.
|
|
429
|
+
|
|
430
|
+
### Support
|
|
431
|
+
|
|
432
|
+
Thank you for using this project, I hope it is of use to you. Please be aware that
|
|
433
|
+
those involved with the project often do so for fun along with other commitments
|
|
434
|
+
(such as work, family, etc). Please see the
|
|
435
|
+
[Support Policy](https://github.com/FHPythonUtils/.github/blob/master/SUPPORT.md)
|
|
436
|
+
for more information.
|