doc-zero 0.1.2__tar.gz → 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doc-zero
3
- Version: 0.1.2
3
+ Version: 0.2.1
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>
@@ -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"doc-zero>={module_version('doc0')}")
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 = find_copyright(licence_file.read_text())
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(
@@ -175,6 +175,7 @@ class Module:
175
175
  if inspect.isclass(obj):
176
176
  yield f".. autoclass:: {qualname}"
177
177
  yield " :members:"
178
+ yield " :member-order: bysource"
178
179
  elif inspect.isroutine(obj):
179
180
  yield f".. autofunction:: {qualname}"
180
181
  else:
@@ -126,11 +126,11 @@ 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]:
133
- uv_conf = self.get("tool.uv.build-backend", type=dict)
133
+ uv_conf = self.get("tool.uv.build-backend", type=dict, default={})
134
134
  root = self.root / uv_conf.get("module-root", "")
135
135
  name = uv_conf.get("module-name")
136
136
  if name is None:
@@ -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.1.2"
3
+ version = "0.2.1"
4
4
  description = "Zero-configuration documentation generator for Python."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -69,7 +69,8 @@ release = '''
69
69
  && uv run task test \
70
70
  && uv run task docs \
71
71
  && uv run task build \
72
- && git add . && git commit -m "Release $(uv version)" && git tag "v$(uv version --short)"
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]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "doc-zero"
3
- version = "0.1.2"
3
+ version = "0.2.1"
4
4
  description = "Zero-configuration documentation generator for Python."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -72,7 +72,8 @@ release = """
72
72
  && uv run task test \\
73
73
  && uv run task docs \\
74
74
  && uv run task build \\
75
- && git add . && git commit -m "Release $(uv version)" && git tag "v$(uv version --short)"
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
File without changes