doc-zero 0.1.1__tar.gz → 0.2.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.
- {doc_zero-0.1.1 → doc_zero-0.2.0}/PKG-INFO +16 -16
- {doc_zero-0.1.1 → doc_zero-0.2.0}/README.md +12 -12
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/base.py +9 -3
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/module.py +1 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/pyproject.py +14 -1
- {doc_zero-0.1.1 → doc_zero-0.2.0}/pyproject.toml +7 -6
- {doc_zero-0.1.1 → doc_zero-0.2.0}/pyproject.toml.orig +7 -6
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/__init__.py +0 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/__main__.py +0 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/cli.py +0 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/exports.py +0 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/py.typed +0 -0
- {doc_zero-0.1.1 → doc_zero-0.2.0}/doc0/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: doc-zero
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Zero-configuration documentation generator for Python.
|
|
5
5
|
Author: Fábio Macêdo Mendes
|
|
6
6
|
Author-email: Fábio Macêdo Mendes <fabiomacedomendes@gmail.com>
|
|
@@ -22,14 +22,14 @@ Requires-Dist: typer>=0.27.0
|
|
|
22
22
|
Maintainer: Fábio Macêdo Mendes
|
|
23
23
|
Maintainer-email: Fábio Macêdo Mendes <fabiomacedomendes@gmail.com>
|
|
24
24
|
Requires-Python: >=3.13
|
|
25
|
-
Project-URL: Homepage, http://github.com/fabiommendes/
|
|
26
|
-
Project-URL: Repository, http://github.com/fabiommendes/
|
|
27
|
-
Project-URL: Documentation, https://zero
|
|
25
|
+
Project-URL: Homepage, http://github.com/fabiommendes/doc0
|
|
26
|
+
Project-URL: Repository, http://github.com/fabiommendes/doc0
|
|
27
|
+
Project-URL: Documentation, https://doc-zero.readthedocs.io/
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
|
|
30
30
|
# doc-zero
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
**Doc-zero** streamlines the process of writing documentation for your project. It is
|
|
33
33
|
an opinionated and explicitly non-configurable tool that extracts information
|
|
34
34
|
from your Python codebase and generates nice documentation with minimal effort.
|
|
35
35
|
|
|
@@ -40,28 +40,28 @@ but somewhat clunky to use and configure.
|
|
|
40
40
|
|
|
41
41
|
## How does it work?
|
|
42
42
|
|
|
43
|
-
`
|
|
43
|
+
`doc-zero` introspect your codebase and creates a Sphinx project under the hood. In
|
|
44
44
|
practice, if you have a relatively modern Python project (i.e., it assumes the
|
|
45
45
|
existence of pyproject.toml) just type
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
$ doc0
|
|
48
|
+
$ doc-zero build # or the doc0 alias
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
in the project root and it will create and build the documentation under
|
|
52
|
-
`<project-root>/docs`. In `
|
|
52
|
+
`<project-root>/docs`. In `doc-zero`, all your documentation resides either in the
|
|
53
53
|
README.md file in your repository or inside the source code.
|
|
54
54
|
|
|
55
55
|
You can also type
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
$
|
|
58
|
+
$ doc-zero serve
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
and
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
|
-
|
|
64
|
+
doc-zero test
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
to run either the live server or to test the doctests inside the documentation.
|
|
@@ -69,16 +69,16 @@ to run either the live server or to test the doctests inside the documentation.
|
|
|
69
69
|
|
|
70
70
|
## Adding the documentation to your project
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
Doc-zero assumes your project is already documented using docstrings and that
|
|
73
73
|
you have a README.md file in the project root. It will use those assets to
|
|
74
74
|
generate the documentation and the necessary configurations to make it buildable
|
|
75
75
|
with Sphinx and ready to be hosted to readthedocs.io.
|
|
76
76
|
|
|
77
|
-
The first step is to install `
|
|
77
|
+
The first step is to install `doc-zero` as a development dependency in your project.
|
|
78
78
|
You can do this by running
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
$ pip install
|
|
81
|
+
$ pip install doc-zero
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
or the equivalent command for the package manager of choice.
|
|
@@ -87,10 +87,10 @@ or the equivalent command for the package manager of choice.
|
|
|
87
87
|
Then, the following command generates the documentation:
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
$
|
|
90
|
+
$ doc-zero build
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
`
|
|
93
|
+
`doc-zero` always creates a module documentation for your toplevel module. It will
|
|
94
94
|
also scan all sub-modules and generate a documentation page if they satisfy the
|
|
95
95
|
following conditions:
|
|
96
96
|
|
|
@@ -98,5 +98,5 @@ following conditions:
|
|
|
98
98
|
* The module has a docstring.
|
|
99
99
|
* The module defines a `__all__` variable that lists its public API.
|
|
100
100
|
|
|
101
|
-
`
|
|
101
|
+
`doc-zero` only includes the public API in the generated documentation.
|
|
102
102
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# doc-zero
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Doc-zero** streamlines the process of writing documentation for your project. It is
|
|
4
4
|
an opinionated and explicitly non-configurable tool that extracts information
|
|
5
5
|
from your Python codebase and generates nice documentation with minimal effort.
|
|
6
6
|
|
|
@@ -11,28 +11,28 @@ but somewhat clunky to use and configure.
|
|
|
11
11
|
|
|
12
12
|
## How does it work?
|
|
13
13
|
|
|
14
|
-
`
|
|
14
|
+
`doc-zero` introspect your codebase and creates a Sphinx project under the hood. In
|
|
15
15
|
practice, if you have a relatively modern Python project (i.e., it assumes the
|
|
16
16
|
existence of pyproject.toml) just type
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
$ doc0
|
|
19
|
+
$ doc-zero build # or the doc0 alias
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
in the project root and it will create and build the documentation under
|
|
23
|
-
`<project-root>/docs`. In `
|
|
23
|
+
`<project-root>/docs`. In `doc-zero`, all your documentation resides either in the
|
|
24
24
|
README.md file in your repository or inside the source code.
|
|
25
25
|
|
|
26
26
|
You can also type
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
$
|
|
29
|
+
$ doc-zero serve
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
and
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
|
|
35
|
+
doc-zero test
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
to run either the live server or to test the doctests inside the documentation.
|
|
@@ -40,16 +40,16 @@ to run either the live server or to test the doctests inside the documentation.
|
|
|
40
40
|
|
|
41
41
|
## Adding the documentation to your project
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Doc-zero assumes your project is already documented using docstrings and that
|
|
44
44
|
you have a README.md file in the project root. It will use those assets to
|
|
45
45
|
generate the documentation and the necessary configurations to make it buildable
|
|
46
46
|
with Sphinx and ready to be hosted to readthedocs.io.
|
|
47
47
|
|
|
48
|
-
The first step is to install `
|
|
48
|
+
The first step is to install `doc-zero` as a development dependency in your project.
|
|
49
49
|
You can do this by running
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
$ pip install
|
|
52
|
+
$ pip install doc-zero
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
or the equivalent command for the package manager of choice.
|
|
@@ -58,10 +58,10 @@ or the equivalent command for the package manager of choice.
|
|
|
58
58
|
Then, the following command generates the documentation:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
$
|
|
61
|
+
$ doc-zero build
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
`
|
|
64
|
+
`doc-zero` always creates a module documentation for your toplevel module. It will
|
|
65
65
|
also scan all sub-modules and generate a documentation page if they satisfy the
|
|
66
66
|
following conditions:
|
|
67
67
|
|
|
@@ -69,5 +69,5 @@ following conditions:
|
|
|
69
69
|
* The module has a docstring.
|
|
70
70
|
* The module defines a `__all__` variable that lists its public API.
|
|
71
71
|
|
|
72
|
-
`
|
|
72
|
+
`doc-zero` only includes the public API in the generated documentation.
|
|
73
73
|
|
|
@@ -128,7 +128,7 @@ class Doc0:
|
|
|
128
128
|
# Write the requirements.txt file for Read the Docs, if it doesn't exist.
|
|
129
129
|
req_path = self.root / "docs" / "requirements.txt"
|
|
130
130
|
if not req_path.exists():
|
|
131
|
-
req_path.write_text(f"
|
|
131
|
+
req_path.write_text(f"doc-zero>={module_version('doc-zero')}")
|
|
132
132
|
|
|
133
133
|
def build(self) -> None:
|
|
134
134
|
"""
|
|
@@ -230,6 +230,7 @@ class Index:
|
|
|
230
230
|
tutorials: Path | None = None
|
|
231
231
|
how_to_guides: Path | None = None
|
|
232
232
|
explanations: Path | None = None
|
|
233
|
+
user_guides: Path | None = None
|
|
233
234
|
|
|
234
235
|
# Reference is concepts + api documentation
|
|
235
236
|
concepts: Path | None = None
|
|
@@ -261,6 +262,7 @@ class Index:
|
|
|
261
262
|
|
|
262
263
|
tutorials = select("tutorial")
|
|
263
264
|
how_to_guides = select("how-to-guide")
|
|
265
|
+
user_guides = select("user-guide")
|
|
264
266
|
explanations = select("explanation")
|
|
265
267
|
concepts = select("concept")
|
|
266
268
|
|
|
@@ -269,6 +271,7 @@ class Index:
|
|
|
269
271
|
tutorials=tutorials,
|
|
270
272
|
how_to_guides=how_to_guides,
|
|
271
273
|
explanations=explanations,
|
|
274
|
+
user_guides=user_guides,
|
|
272
275
|
concepts=concepts,
|
|
273
276
|
api_modules=module_names,
|
|
274
277
|
)
|
|
@@ -298,6 +301,8 @@ class Index:
|
|
|
298
301
|
yield f" {self.tutorials.stem}"
|
|
299
302
|
if self.how_to_guides:
|
|
300
303
|
yield f" {self.how_to_guides.stem}"
|
|
304
|
+
if self.user_guides:
|
|
305
|
+
yield f" {self.user_guides.stem}"
|
|
301
306
|
if self.explanations:
|
|
302
307
|
yield f" {self.explanations.stem}"
|
|
303
308
|
if self.concepts:
|
|
@@ -350,13 +355,14 @@ class Conf:
|
|
|
350
355
|
|
|
351
356
|
# Read the year from the Copyright notice in the LICENSE file.
|
|
352
357
|
if (licence_file := Path(root / "LICENSE")).exists():
|
|
353
|
-
copyright =
|
|
358
|
+
copyright = None
|
|
354
359
|
if year is None:
|
|
355
360
|
try:
|
|
361
|
+
copyright = find_copyright(licence_file.read_text())
|
|
356
362
|
year = int(copyright["year"])
|
|
357
363
|
except ValueError:
|
|
358
364
|
pass
|
|
359
|
-
if author is None:
|
|
365
|
+
if author is None and copyright is not None:
|
|
360
366
|
author = copyright["author"]
|
|
361
367
|
|
|
362
368
|
return Conf(
|
|
@@ -126,7 +126,7 @@ class PyProject:
|
|
|
126
126
|
return False
|
|
127
127
|
|
|
128
128
|
def _is_toplevel_package_layout(self) -> bool:
|
|
129
|
-
package_dir = self.root / self.name
|
|
129
|
+
package_dir = self.root / normalize_package_name(self.name)
|
|
130
130
|
return package_dir.is_dir() and (package_dir / "__init__.py").exists()
|
|
131
131
|
|
|
132
132
|
def _find_uv_root_modules(self) -> Iterable[ModuleSpec]:
|
|
@@ -165,3 +165,16 @@ class PyProject:
|
|
|
165
165
|
class Author(TypedDict):
|
|
166
166
|
name: str
|
|
167
167
|
email: NotRequired[str]
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def normalize_package_name(name: str) -> str:
|
|
171
|
+
"""
|
|
172
|
+
Normalize a package name to a valid Python identifier.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
name: The package name to normalize.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
The normalized package name.
|
|
179
|
+
"""
|
|
180
|
+
return name.replace("-", "_").replace(".", "_")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "doc-zero"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Zero-configuration documentation generator for Python."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
@@ -33,9 +33,9 @@ name = "Fábio Macêdo Mendes"
|
|
|
33
33
|
email = "fabiomacedomendes@gmail.com"
|
|
34
34
|
|
|
35
35
|
[project.urls]
|
|
36
|
-
Homepage = "http://github.com/fabiommendes/
|
|
37
|
-
Repository = "http://github.com/fabiommendes/
|
|
38
|
-
Documentation = "https://zero
|
|
36
|
+
Homepage = "http://github.com/fabiommendes/doc0"
|
|
37
|
+
Repository = "http://github.com/fabiommendes/doc0"
|
|
38
|
+
Documentation = "https://doc-zero.readthedocs.io/"
|
|
39
39
|
|
|
40
40
|
[project.scripts]
|
|
41
41
|
doc0 = "doc0.cli:main"
|
|
@@ -70,14 +70,15 @@ release = '''
|
|
|
70
70
|
&& uv run task docs \
|
|
71
71
|
&& uv run task build \
|
|
72
72
|
&& git add . && git commit -m "Release $(uv version)" && git tag "v$(uv version --short)"
|
|
73
|
+
&& git push && git push --tags
|
|
73
74
|
'''
|
|
74
75
|
|
|
75
76
|
[tool.taskipy.tasks.docs]
|
|
76
|
-
cmd = "
|
|
77
|
+
cmd = "uv run doc-zero build"
|
|
77
78
|
help = "Build HTML documentation"
|
|
78
79
|
|
|
79
80
|
[tool.taskipy.tasks.docs-serve]
|
|
80
|
-
cmd = "
|
|
81
|
+
cmd = "uv run doc-zero serve"
|
|
81
82
|
help = "Serve HTML documentation with live reload"
|
|
82
83
|
|
|
83
84
|
[tool.doc-zero]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "doc-zero"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Zero-configuration documentation generator for Python."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -31,9 +31,9 @@ classifiers = [
|
|
|
31
31
|
license = "MIT"
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
34
|
-
Homepage = "http://github.com/fabiommendes/
|
|
35
|
-
Repository = "http://github.com/fabiommendes/
|
|
36
|
-
Documentation = "https://zero
|
|
34
|
+
Homepage = "http://github.com/fabiommendes/doc0"
|
|
35
|
+
Repository = "http://github.com/fabiommendes/doc0"
|
|
36
|
+
Documentation = "https://doc-zero.readthedocs.io/"
|
|
37
37
|
|
|
38
38
|
[project.scripts]
|
|
39
39
|
doc0 = "doc0.cli:main"
|
|
@@ -61,8 +61,8 @@ source = ["doc0"]
|
|
|
61
61
|
omit = ["doc0/__main__.py"]
|
|
62
62
|
|
|
63
63
|
[tool.taskipy.tasks]
|
|
64
|
-
docs = { cmd = "
|
|
65
|
-
docs-serve = { cmd = "
|
|
64
|
+
docs = { cmd = "uv run doc-zero build", help = "Build HTML documentation" }
|
|
65
|
+
docs-serve = { cmd = "uv run doc-zero serve", help = "Serve HTML documentation with live reload" }
|
|
66
66
|
test = "pytest tests"
|
|
67
67
|
coverage = "pytest tests --cov=doc0 --cov-report=term-missing"
|
|
68
68
|
lint = "ruff check ."
|
|
@@ -73,6 +73,7 @@ release = """
|
|
|
73
73
|
&& uv run task docs \\
|
|
74
74
|
&& uv run task build \\
|
|
75
75
|
&& git add . && git commit -m "Release $(uv version)" && git tag "v$(uv version --short)"
|
|
76
|
+
&& git push && git push --tags
|
|
76
77
|
"""
|
|
77
78
|
|
|
78
79
|
[tool.doc-zero]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|