afterpython 0.4.2__tar.gz → 0.4.3__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.
- {afterpython-0.4.2 → afterpython-0.4.3}/PKG-INFO +1 -1
- {afterpython-0.4.2 → afterpython-0.4.3}/pyproject.toml +1 -1
- {afterpython-0.4.2 → afterpython-0.4.3}/pyproject.toml.orig +1 -1
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/marimo_content.py +43 -1
- {afterpython-0.4.2 → afterpython-0.4.3}/README.md +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/__init__.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/_io/toml.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/_io/yaml.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/_paths.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/_typing.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/__init__.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/build_pdoc.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/comments_json.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/content_json.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/faq_json.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/index_md.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/jupyter_notebook.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/llms_txt.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/marimo_notebook.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/markdown.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/metadata.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/builders/url_md.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/__init__.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/add.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/build.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/bump.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/changelog.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/check.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/clean.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/commit_msg.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/dev.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/format.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/init.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/init_branch_rules.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/install.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/lint.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/lock.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/prek.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/preview.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/release.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/remove.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/serve.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/start.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/sync.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/commands/update.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/cli/main.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/const.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/main.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/pcu.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/py.typed +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/afterpython-template.toml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/ci-workflow-template.yml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/cliff-template.toml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/dependabot-template.yml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/deploy-workflow-template.yml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pdoc/custom.css +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pdoc/frame.html.jinja2 +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pdoc/syntax-highlighting.css +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pdoc/theme.css +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pre-commit-config-template.yaml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/release-workflow-template.yml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/ruff-template.toml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/ty-template.toml +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/_afterpython.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/_git.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/branch_rules.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/github_actions.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/myst.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/prek.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/tools/pyproject.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/utils.py +0 -0
- {afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: afterpython
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: CLI tool to streamline Python package maintenance and generate a dedicated project website
|
|
5
5
|
Keywords: package-maintenance,project-website,static-site-generator,developer-tools,documentation,cli-tool,ci/cd,mystmd,semantic-release,python-packaging
|
|
6
6
|
Author: Stephen Yau
|
|
@@ -204,12 +204,16 @@ def _as_lines(source: str | list[str]) -> list[str]:
|
|
|
204
204
|
return text.splitlines(keepends=True)
|
|
205
205
|
|
|
206
206
|
|
|
207
|
+
_FRONTMATTER_RE = re.compile(r"^---\s*\n(.*?)\n---\s*(\n|$)", re.DOTALL)
|
|
208
|
+
_H1_RE = re.compile(r"^# \S", re.MULTILINE)
|
|
209
|
+
|
|
210
|
+
|
|
207
211
|
def _parse_frontmatter(cell: dict) -> dict | None:
|
|
208
212
|
"""The YAML mapping if a markdown cell is a `---`-fenced frontmatter block."""
|
|
209
213
|
if cell.get("cell_type") != "markdown":
|
|
210
214
|
return None
|
|
211
215
|
text = "".join(cell.get("source", [])).strip()
|
|
212
|
-
match =
|
|
216
|
+
match = _FRONTMATTER_RE.match(text)
|
|
213
217
|
if not match:
|
|
214
218
|
return None
|
|
215
219
|
try:
|
|
@@ -231,6 +235,43 @@ def _check_frontmatter_first(notebook: dict, source: Path):
|
|
|
231
235
|
)
|
|
232
236
|
|
|
233
237
|
|
|
238
|
+
def _warn_heading_not_first(notebook: dict, source: Path):
|
|
239
|
+
"""Without a frontmatter `title`, MyST takes the title from a leading
|
|
240
|
+
`# Heading` and removes it from the body. If anything comes before the
|
|
241
|
+
heading (marimo's default import cell, typically), the title is still right
|
|
242
|
+
but the heading also stays in the body, so the page shows it twice."""
|
|
243
|
+
cells = notebook["cells"]
|
|
244
|
+
frontmatter = _parse_frontmatter(cells[0]) if cells else None
|
|
245
|
+
if frontmatter and frontmatter.get("title"):
|
|
246
|
+
return
|
|
247
|
+
|
|
248
|
+
def _body(cell: dict) -> str:
|
|
249
|
+
text = "".join(cell.get("source", [])).strip()
|
|
250
|
+
if cell.get("cell_type") == "markdown":
|
|
251
|
+
text = _FRONTMATTER_RE.sub("", text, count=1).strip()
|
|
252
|
+
return text
|
|
253
|
+
|
|
254
|
+
# the first cell with content, skipping a frontmatter-only cell
|
|
255
|
+
lead = next((cell for cell in cells if _body(cell)), None)
|
|
256
|
+
if lead and lead.get("cell_type") == "markdown" and _body(lead).startswith("# "):
|
|
257
|
+
return
|
|
258
|
+
has_h1 = any(
|
|
259
|
+
cell.get("cell_type") == "markdown" and _H1_RE.search(_body(cell))
|
|
260
|
+
for cell in cells
|
|
261
|
+
)
|
|
262
|
+
if has_h1:
|
|
263
|
+
click.echo(
|
|
264
|
+
click.style(
|
|
265
|
+
f"⚠ {source}: the page title comes from its first # heading, "
|
|
266
|
+
"but that heading isn't in the first cell, so the page shows the "
|
|
267
|
+
"title twice.\n"
|
|
268
|
+
" Move that mo.md(...) cell to the top of the file, or set "
|
|
269
|
+
"`title` in the frontmatter.",
|
|
270
|
+
fg="yellow",
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
|
|
234
275
|
def _project_import_name() -> str | None:
|
|
235
276
|
from afterpython.tools.pyproject import read_pyproject
|
|
236
277
|
|
|
@@ -299,6 +340,7 @@ def _postprocess(
|
|
|
299
340
|
cell["source"] = _as_lines(cell.get("source", ""))
|
|
300
341
|
_check_no_errors(notebook, source)
|
|
301
342
|
_check_frontmatter_first(notebook, source)
|
|
343
|
+
_warn_heading_not_first(notebook, source)
|
|
302
344
|
# outputs come from the sandbox, `myst build --execute` must not redo them
|
|
303
345
|
_add_fields_to_frontmatter(notebook, {"execute": "{skip: true}"})
|
|
304
346
|
_rewrite_cell_ids(notebook, _cell_id_prefix(source, content_path))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/deploy-workflow-template.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pdoc/syntax-highlighting.css
RENAMED
|
File without changes
|
|
File without changes
|
{afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/pre-commit-config-template.yaml
RENAMED
|
File without changes
|
{afterpython-0.4.2 → afterpython-0.4.3}/src/afterpython/templates/release-workflow-template.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|