afterpython 0.3.9__tar.gz → 0.3.11__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 (64) hide show
  1. {afterpython-0.3.9 → afterpython-0.3.11}/PKG-INFO +2 -2
  2. {afterpython-0.3.9 → afterpython-0.3.11}/pyproject.toml +2 -2
  3. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/marimo_notebook.py +28 -4
  4. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/build.py +1 -7
  5. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/dev.py +0 -4
  6. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/deploy-workflow-template.yml +5 -0
  7. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/_afterpython.py +1 -0
  8. {afterpython-0.3.9 → afterpython-0.3.11}/README.md +0 -0
  9. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/__init__.py +0 -0
  10. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/_io/toml.py +0 -0
  11. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/_io/yaml.py +0 -0
  12. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/_paths.py +0 -0
  13. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/_typing.py +0 -0
  14. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/__init__.py +0 -0
  15. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/build_pdoc.py +0 -0
  16. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/content_json.py +0 -0
  17. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/faq_json.py +0 -0
  18. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/index_md.py +0 -0
  19. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/jupyter_notebook.py +0 -0
  20. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/llms_txt.py +0 -0
  21. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/markdown.py +0 -0
  22. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/metadata.py +0 -0
  23. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/builders/url_md.py +0 -0
  24. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/__init__.py +0 -0
  25. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/add.py +0 -0
  26. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/bump.py +0 -0
  27. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/check.py +0 -0
  28. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/clean.py +0 -0
  29. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/commit.py +0 -0
  30. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/commitizen.py +0 -0
  31. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/format.py +0 -0
  32. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/init.py +0 -0
  33. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/init_branch_rules.py +0 -0
  34. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/install.py +0 -0
  35. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/lock.py +0 -0
  36. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/pre_commit.py +0 -0
  37. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/preview.py +0 -0
  38. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/release.py +0 -0
  39. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/remove.py +0 -0
  40. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/serve.py +0 -0
  41. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/start.py +0 -0
  42. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/sync.py +0 -0
  43. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/commands/update.py +0 -0
  44. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/cli/main.py +0 -0
  45. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/const.py +0 -0
  46. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/main.py +0 -0
  47. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/pcu.py +0 -0
  48. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/py.typed +0 -0
  49. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/ci-workflow-template.yml +0 -0
  50. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/cz-template.toml +0 -0
  51. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/dependabot-template.yml +0 -0
  52. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/pdoc/frame.html.jinja2 +0 -0
  53. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/pre-commit-config-template.yaml +0 -0
  54. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/release-workflow-template.yml +0 -0
  55. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/templates/ruff-template.toml +0 -0
  56. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/_git.py +0 -0
  57. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/branch_rules.py +0 -0
  58. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/commitizen.py +0 -0
  59. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/github_actions.py +0 -0
  60. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/myst.py +0 -0
  61. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/pre_commit.py +0 -0
  62. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/tools/pyproject.py +0 -0
  63. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/utils.py +0 -0
  64. {afterpython-0.3.9 → afterpython-0.3.11}/src/afterpython/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afterpython
3
- Version: 0.3.9
3
+ Version: 0.3.11
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
@@ -23,7 +23,7 @@ Requires-Dist: gitpython>=3.1.50
23
23
  Requires-Dist: python-dotenv>=1.2.2
24
24
  Requires-Dist: pyproject-metadata>=0.11.0
25
25
  Requires-Dist: jupytext>=1.19.2
26
- Requires-Dist: mystmd>=1.9.0
26
+ Requires-Dist: mystmd>=1.9.1
27
27
  Requires-Dist: pdoc>=16.0.0
28
28
  Requires-Dist: ruff>=0.15.12
29
29
  Requires-Dist: pre-commit>=4.6.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "afterpython"
3
- version = "0.3.9"
3
+ version = "0.3.11"
4
4
  description = "CLI tool to streamline Python package maintenance and generate a dedicated project website"
5
5
  license = "Apache-2.0"
6
6
  authors = [
@@ -43,7 +43,7 @@ dependencies = [
43
43
  "pyproject-metadata>=0.11.0",
44
44
  "jupytext>=1.19.2",
45
45
  # "jinja2>=3.1.6",
46
- "mystmd>=1.9.0",
46
+ "mystmd>=1.9.1",
47
47
  "pdoc>=16.0.0",
48
48
  "ruff>=0.15.12",
49
49
  "pre-commit>=4.6.0",
@@ -41,15 +41,33 @@ def is_marimo_notebook(path: Path) -> bool:
41
41
  return "__generated_with" in head and "marimo.App(" in head
42
42
 
43
43
 
44
- def _export_marimo(source: Path, output_html: Path, mode: MarimoExportMode):
44
+ def _export_marimo(
45
+ source: Path,
46
+ output_html: Path,
47
+ mode: MarimoExportMode,
48
+ execute: bool = False,
49
+ ):
45
50
  """Run `marimo export` to produce HTML at `output_html`."""
46
51
  output_html.parent.mkdir(parents=True, exist_ok=True)
47
52
  subcommand = "html-wasm" if mode == "wasm" else "html"
48
- cmd = ["marimo", "export", subcommand, str(source), "-o", str(output_html)]
53
+ cmd = [
54
+ "marimo",
55
+ "export",
56
+ subcommand,
57
+ str(source),
58
+ "-o",
59
+ str(output_html),
60
+ "--sandbox",
61
+ "--force",
62
+ ]
49
63
  # WASM-only flag: --mode edit shows code cells (interactive). Without it,
50
64
  # marimo's html-wasm subcommand defaults to "run" which hides them.
65
+ # --sandbox auto-answers marimo's interactive "Run in a sandboxed venv?"
66
+ # prompt; non-interactive builds (CI, `ap build`) would otherwise hang.
51
67
  if mode == "wasm":
52
68
  cmd += ["--mode", "edit"]
69
+ if execute:
70
+ cmd += ["--execute"]
53
71
  result = subprocess.run(cmd, check=False)
54
72
  if result.returncode != 0:
55
73
  raise click.ClickException(f"marimo export failed for {source}")
@@ -85,6 +103,7 @@ def build_marimo_notebook(
85
103
  output_html: Path,
86
104
  content_path: Path,
87
105
  mode: MarimoExportMode = "wasm",
106
+ execute: bool = False,
88
107
  ):
89
108
  """Build a single marimo notebook to HTML and inject the molab badge.
90
109
 
@@ -104,7 +123,7 @@ def build_marimo_notebook(
104
123
  return
105
124
 
106
125
  click.echo(f"Building marimo notebook {source.name} (mode={mode})...")
107
- _export_marimo(source, output_html, mode)
126
+ _export_marimo(source, output_html, mode, execute=execute)
108
127
 
109
128
  # WASM mode runs the notebook in-browser via Pyodide, so molab (a remote
110
129
  # runtime) is redundant. Skip the badge.
@@ -136,9 +155,14 @@ def build_marimo_readme(mode: MarimoExportMode = "wasm"):
136
155
  Skips silently if README.py is absent or isn't a marimo notebook so users
137
156
  who keep only README.md aren't penalized.
138
157
  """
158
+ from afterpython._io.toml import _from_tomlkit
159
+ from afterpython.tools._afterpython import read_afterpython
160
+
139
161
  readme_path = ap.paths.afterpython_path / "README.py"
140
162
  if not readme_path.exists():
141
163
  return
142
164
  output_html = ap.paths.build_path / "readme_py" / "readme_py.html"
143
165
  content_path = Path("README.py")
144
- build_marimo_notebook(readme_path, output_html, content_path, mode)
166
+ website = _from_tomlkit(read_afterpython().get("website", {}))
167
+ execute = bool(website.get("execute_readme_py", False))
168
+ build_marimo_notebook(readme_path, output_html, content_path, mode, execute=execute)
@@ -171,13 +171,7 @@ def postbuild(dev_build: bool = False):
171
171
  print(f"Moved: {source} to {destination}")
172
172
 
173
173
  build_content_json()
174
- # In dev mode the MyST `start` server is watching these files. Deleting
175
- # them here would make MyST re-index without the placeholder and revert
176
- # to using the first content file as the section index — exactly what
177
- # the placeholder was created to prevent. `ap dev` cleans them up in
178
- # its `finally` block after MyST has been shut down.
179
- if not dev_build:
180
- delete_placeholder_index_md_files()
174
+ delete_placeholder_index_md_files()
181
175
 
182
176
  website_static = ap.paths.website_path / "static"
183
177
  website_static.mkdir(parents=True, exist_ok=True)
@@ -11,7 +11,6 @@ import time
11
11
  import click
12
12
  from click.exceptions import Exit
13
13
 
14
- from afterpython.builders import delete_placeholder_index_md_files
15
14
  from afterpython.cli.commands.build import postbuild, prebuild
16
15
  from afterpython.const import CONTENT_TYPES
17
16
  from afterpython.utils import find_available_port, find_node_env
@@ -219,6 +218,3 @@ def dev(
219
218
  pass
220
219
  finally:
221
220
  cleanup_processes()
222
- # Now that MyST watchers are gone, clean up the placeholders
223
- # postbuild() intentionally left behind for dev mode.
224
- delete_placeholder_index_md_files()
@@ -63,6 +63,11 @@ jobs:
63
63
  - name: Install afterpython
64
64
  run: uv pip install --system afterpython
65
65
 
66
+ - name: Install marimo
67
+ # Needed by `ap build` when afterpython/README.py is a marimo notebook;
68
+ # afterpython shells out to the `marimo` CLI for the WASM export.
69
+ run: uv pip install --system marimo
70
+
66
71
  - name: Install website dependencies
67
72
  run: pnpm install
68
73
  working-directory: ./afterpython/_website
@@ -125,6 +125,7 @@ def init_afterpython():
125
125
  "thumbnail": "thumbnail.png",
126
126
  "announcement": "",
127
127
  "readme_py": "wasm",
128
+ "execute_readme_py": False,
128
129
  "api_reference": False,
129
130
  },
130
131
  }
File without changes