afterpython 0.3.8__py3-none-any.whl → 0.3.10__py3-none-any.whl

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.
@@ -4,17 +4,12 @@ import afterpython as ap
4
4
  from afterpython.const import CONTENT_TYPES, PLACEHOLDER_INDEX_MARKER
5
5
 
6
6
 
7
- def _legacy_placeholder_content(content_type: str) -> str:
8
- return f"""---
9
- title: ← {content_type.capitalize()}
10
- ---
11
-
12
- This is a placeholder index page. The actual {content_type} landing page is rendered by SvelteKit.
13
- """
14
-
15
-
16
- def _legacy_welcome_content(content_type: str) -> str:
17
- return f"""# Welcome to AfterPython
7
+ def _placeholder_content(content_type: str) -> str:
8
+ """Current placeholder body. Marker is an HTML comment so it embeds invisibly;
9
+ _is_afterpython_placeholder_index keys off it to tell our files apart from
10
+ user-authored ones."""
11
+ return f"""{PLACEHOLDER_INDEX_MARKER}
12
+ # Welcome to AfterPython
18
13
 
19
14
  Welcome to your project's {content_type}! This is a starter page to help you get started.
20
15
 
@@ -35,6 +30,19 @@ Start building your amazing project! 🚀
35
30
  """
36
31
 
37
32
 
33
+ def _legacy_placeholder_content(content_type: str) -> str:
34
+ """Frozen fingerprint of the arrow-stub placeholder written between commits
35
+ 49f30c1 and 3a560e2 (no marker). Kept solely so projects built in that window
36
+ are still recognized as ours and cleaned up rather than blocking with the
37
+ 'reserved' error. Do not edit — that would break recognition."""
38
+ return f"""---
39
+ title: ← {content_type.capitalize()}
40
+ ---
41
+
42
+ This is a placeholder index page. The actual {content_type} landing page is rendered by SvelteKit.
43
+ """
44
+
45
+
38
46
  def _is_afterpython_placeholder_index(index_md, content_type: str) -> bool:
39
47
  """Return True only for non-doc index.md files generated by AfterPython."""
40
48
  content = index_md.read_text(encoding="utf-8", errors="ignore")
@@ -43,7 +51,6 @@ def _is_afterpython_placeholder_index(index_md, content_type: str) -> bool:
43
51
  return (
44
52
  PLACEHOLDER_INDEX_MARKER in content
45
53
  or normalized_content == _legacy_placeholder_content(content_type).strip()
46
- or normalized_content == _legacy_welcome_content(content_type).strip()
47
54
  )
48
55
 
49
56
 
@@ -76,25 +83,15 @@ def create_placeholder_index_md_files():
76
83
  )
77
84
  continue
78
85
 
79
- content_path = ap.paths.afterpython_path / content_type
80
- myst_yml_path = content_path / "myst.yml"
81
-
82
- # Prepend index.md to TOC in myst.yml
83
- if myst_yml_path.exists():
84
- # Create placeholder index.md file
85
- _write_index_file(content_type)
86
- myst_data = read_yaml(myst_yml_path) or {}
87
- toc = myst_data.get("project", {}).get("toc", [])
86
+ _write_index_file(content_type)
88
87
 
89
- # Check if index.md is already first in TOC
90
- if not toc or toc[0].get("file") != "index.md":
91
- # Prepend index.md to TOC in myst.yml
92
- new_toc = [{"file": "index.md"}, *toc]
93
- if "project" not in myst_data:
94
- myst_data["project"] = {}
95
- myst_data["project"]["toc"] = new_toc
96
- write_yaml(myst_yml_path, myst_data)
97
- click.echo(f"Added index.md to TOC in {myst_yml_path}")
88
+ # Prepend index.md to TOC in myst.yml (skip if already first).
89
+ myst_data = read_yaml(myst_yml_path) or {}
90
+ toc = myst_data.get("project", {}).get("toc", [])
91
+ if not toc or toc[0].get("file") != "index.md":
92
+ myst_data.setdefault("project", {})["toc"] = [{"file": "index.md"}, *toc]
93
+ write_yaml(myst_yml_path, myst_data)
94
+ click.echo(f"Added index.md to TOC in {myst_yml_path}")
98
95
 
99
96
 
100
97
  def 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
afterpython/tools/myst.py CHANGED
@@ -143,14 +143,11 @@ def _write_index_file(content_type: tContentType):
143
143
  f"and update the reference in afterpython/{content_type}/myst.yml."
144
144
  )
145
145
 
146
- index_content = f"""---
147
- title: ← {content_type.capitalize()}
148
- ---
146
+ # Lazy import to avoid the circular dep with builders/index_md.py, which
147
+ # already lazy-imports _write_index_file from this module.
148
+ from afterpython.builders.index_md import _placeholder_content
149
149
 
150
- {PLACEHOLDER_INDEX_MARKER}
151
-
152
- This is a placeholder index page. The actual {content_type} landing page is rendered by SvelteKit.
153
- """
150
+ index_content = _placeholder_content(content_type)
154
151
  index_file.write_text(index_content)
155
152
  return index_file
156
153
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afterpython
3
- Version: 0.3.8
3
+ Version: 0.3.10
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
@@ -7,7 +7,7 @@ afterpython/builders/__init__.py,sha256=H7f9mFKXofWOAC3hkrxiFzvW5NziF8wYyduUBykH
7
7
  afterpython/builders/build_pdoc.py,sha256=rasjCtTah5GsZYokqU--Fp3bvTEf464ievENfOoANOk,2040
8
8
  afterpython/builders/content_json.py,sha256=-LTkeA8oA6XEudc2b1H7U0-UwcJlHn7xgICeweMYrG0,4805
9
9
  afterpython/builders/faq_json.py,sha256=mMfFepRBL_1QYO0tQ6orf5ESo2LVntk55nfFzencViM,1193
10
- afterpython/builders/index_md.py,sha256=M4TNqrMl9_7HKiu11VOGiYvgffBQp3ZZbgLvlczZAVA,5998
10
+ afterpython/builders/index_md.py,sha256=ZpBA1FIHgw9MXD8kRaq2OBaEAKnf94_sJmB2cG68iag,6021
11
11
  afterpython/builders/jupyter_notebook.py,sha256=8yjgwWBaHfEzvN90j4biR6-RaTUHeIQ59h4NKethHOk,9693
12
12
  afterpython/builders/llms_txt.py,sha256=9x-B1i1buTDJt4zGs8nugyto_pI5QIp7WUBcv-zpcso,9226
13
13
  afterpython/builders/marimo_notebook.py,sha256=cIah_ly67tTj4j1y7yL19MRQ9NN6vESmS2JKMsEuaA0,5386
@@ -44,7 +44,7 @@ afterpython/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  afterpython/templates/ci-workflow-template.yml,sha256=-7BVbNArhaUNtJzxdfIX9scCQcba7LoWHPJXLBm-OxM,7115
45
45
  afterpython/templates/cz-template.toml,sha256=2qwbQLb0nbZaA63oWXFFzvzPNBsFZHATL1C2rdNdjjs,185
46
46
  afterpython/templates/dependabot-template.yml,sha256=CBQEgh8EsXw2X7IqzGtFI7lVT9liF6PW4DvGLB0X2LY,1136
47
- afterpython/templates/deploy-workflow-template.yml,sha256=o9blTGoM_KLB3wZUQcfdjxSOz08ldNJDfv1hA7FEbp8,2397
47
+ afterpython/templates/deploy-workflow-template.yml,sha256=3N8obLgDIKmTkWcr1NEqYVMDCfhllPDc_g05-T0AVLI,2625
48
48
  afterpython/templates/pdoc/frame.html.jinja2,sha256=GX4pNSuYC4Fq9hvZ01WyaBQes4FyNDOx5Ra4MNLr0eg,250
49
49
  afterpython/templates/pre-commit-config-template.yaml,sha256=3QkZekg2kK04-Dp8nGc9AsqEdpnh10EcdD6pBhyKpRQ,988
50
50
  afterpython/templates/release-workflow-template.yml,sha256=-vJJlbsroq1BGh0vN1tqJzh8uncn7_73OYn_GTVswCY,1606
@@ -54,12 +54,12 @@ afterpython/tools/_git.py,sha256=aO-qDEQ4OevD_B74DYKK4nQKYeiaS1BXmYc8paJRfbQ,377
54
54
  afterpython/tools/branch_rules.py,sha256=ciQ2H2YBnoCZu_plyVeIHzf2FcAILRFhpjzOR2_IfJg,3159
55
55
  afterpython/tools/commitizen.py,sha256=ZO1qHmzUU0myd85tncv76WtIR7DB_AoQGSUvaf78Ohg,438
56
56
  afterpython/tools/github_actions.py,sha256=0xzOc41QF1PKagD1CW7BAt_Rugy0KCEx_KfcrPKVl3c,3168
57
- afterpython/tools/myst.py,sha256=03m1bBKHxcDgruwrNjf7zAu5eH6TVDvsXSd936eIGF4,8586
57
+ afterpython/tools/myst.py,sha256=UbtcCUbu_zMYZA00LptO25VKNi7GOodeNVuiGgi1320,8646
58
58
  afterpython/tools/pre_commit.py,sha256=oNsrUkPI13rSSBSyhyTTKPnQGhDxLIPYhxu6kL0fDmo,1206
59
59
  afterpython/tools/pyproject.py,sha256=hz-DOf-pkGBF2m_RqEZipAaO-NDbsLxrrc65LWAIwLA,3698
60
60
  afterpython/utils.py,sha256=fVa3jIzCvhn7QA7N0M6d_pvojpPFrN-hae8trUYhPKU,11701
61
61
  afterpython/version.py,sha256=hihRV1S-gc1m46OaXD32ikkEkqzs-Gtq7AcAqOQV-wY,1603
62
- afterpython-0.3.8.dist-info/WHEEL,sha256=f5fWSvWsg5Knq5GWa6t1nJIug0Tqo69GqAWD_9LbBKw,81
63
- afterpython-0.3.8.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
64
- afterpython-0.3.8.dist-info/METADATA,sha256=tHD7uS3ZZuzzvZ8ooe-L_JFSVbxj8VbBt7C6toJLcKg,6180
65
- afterpython-0.3.8.dist-info/RECORD,,
62
+ afterpython-0.3.10.dist-info/WHEEL,sha256=f5fWSvWsg5Knq5GWa6t1nJIug0Tqo69GqAWD_9LbBKw,81
63
+ afterpython-0.3.10.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
64
+ afterpython-0.3.10.dist-info/METADATA,sha256=2sC2DKjDGAOvPkuoESl82akQUx27-qik117DYuKuIHE,6181
65
+ afterpython-0.3.10.dist-info/RECORD,,