afterpython 0.4.5__py3-none-any.whl → 0.4.7__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.
@@ -20,6 +20,7 @@ def build_pdoc(base_path: str) -> None:
20
20
  back to the project website root (matches MyST's UX).
21
21
  """
22
22
  from afterpython._io.toml import _from_tomlkit
23
+ from afterpython.builders.metadata import _resolve_logo_path
23
24
  from afterpython.tools._afterpython import read_afterpython
24
25
 
25
26
  package_dir = find_package_directory()
@@ -37,16 +38,21 @@ def build_pdoc(base_path: str) -> None:
37
38
  # user's own package, whose import-time behavior the user already trusts.
38
39
  env = {**os.environ, "PDOC_ALLOW_EXEC": "1"}
39
40
 
40
- # logo.svg is a project-website-template convention (always present in
41
- # `_website/static/`); served at `{base_path}/logo.svg` once the site
42
- # is built. logo-link points back to the project website root.
41
+ # Logos come from afterpython.toml (afterpython/static/ is served at the
42
+ # site root); logo.svg is the project-website-template's fallback.
43
+ # pdoc's --logo takes one image, so the dark one goes through an env var
44
+ # that module.html.jinja2 reads (pdoc exposes os.environ to templates as
45
+ # `env`). logo-link points back to the project website root.
46
+ logo = _resolve_logo_path(website.get("logo", "")) or "/logo.svg"
47
+ logo_dark = _resolve_logo_path(website.get("logo_dark", ""))
48
+ env["AP_PDOC_LOGO_DARK"] = f"{base_path}{logo_dark}" if logo_dark else ""
43
49
  result = subprocess.run(
44
50
  [
45
51
  "pdoc",
46
52
  "-o",
47
53
  str(output_dir),
48
54
  "--logo",
49
- f"{base_path}/logo.svg",
55
+ f"{base_path}{logo}",
50
56
  "--logo-link",
51
57
  f"{base_path}/",
52
58
  "--template-directory",
@@ -14,8 +14,11 @@
14
14
  });
15
15
  })();
16
16
  </script>
17
- {# Override pdoc's default 35vh logo height — too dominant in the sidebar. #}
17
+ {# Override pdoc's default 35vh logo height — too dominant in the sidebar.
18
+ The dark logo (see module.html.jinja2) replaces the light one in dark mode. #}
18
19
  <style>
19
- nav.pdoc img.logo { max-height: 5rem; margin-bottom: 1.5rem; }
20
+ nav.pdoc img.logo { max-height: 3rem; margin-bottom: 1.5rem; }
21
+ nav.pdoc img.logo-dark, html.dark nav.pdoc img.logo-light { display: none; }
22
+ html.dark nav.pdoc img.logo-dark { display: block; }
20
23
  </style>
21
24
  {% endblock %}
@@ -0,0 +1,13 @@
1
+ {% extends "default/module.html.jinja2" %}
2
+ {# Same as pdoc's nav_title, plus the dark logo (if set in afterpython.toml),
3
+ shown instead of the light one in dark mode by frame.html.jinja2's style. #}
4
+ {% block nav_title %}
5
+ {% if logo %}
6
+ {% if logo_link %}<a href="{{ logo_link }}">{% endif %}
7
+ <img src="{{ logo }}" class="logo{% if env.AP_PDOC_LOGO_DARK %} logo-light{% endif %}" alt="project logo"/>
8
+ {% if env.AP_PDOC_LOGO_DARK %}
9
+ <img src="{{ env.AP_PDOC_LOGO_DARK }}" class="logo logo-dark" alt="project logo"/>
10
+ {% endif %}
11
+ {% if logo_link %}</a>{% endif %}
12
+ {% endif %}
13
+ {% endblock %}
afterpython/utils.py CHANGED
@@ -336,6 +336,8 @@ def ensure_website_gitignore_rules() -> None:
336
336
 
337
337
  Adds the following rules if they don't exist:
338
338
  - **/_build/ (ignore all build directories)
339
+ - **/__marimo__/ (marimo's session cache, written next to notebooks by
340
+ `marimo export`, e.g. when building afterpython/README.py)
339
341
  - !afterpython/_website/src/lib/ (un-ignore website source for customization)
340
342
  - afterpython/_website.backup/ (ignore backup created by ap update website)
341
343
  """
@@ -346,6 +348,7 @@ def ensure_website_gitignore_rules() -> None:
346
348
  # Rules that should be present
347
349
  required_rules = [
348
350
  "**/_build/",
351
+ "**/__marimo__/",
349
352
  "!afterpython/_website/src/lib/",
350
353
  "afterpython/_website.backup/",
351
354
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afterpython
3
- Version: 0.4.5
3
+ Version: 0.4.7
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
@@ -4,7 +4,7 @@ afterpython/_io/yaml.py,sha256=raksve_gaIFJim8lQrq-kQHkRjTloed7CT2FY0oUJSg,654
4
4
  afterpython/_paths.py,sha256=FTwQ7necKYuRosCyMZPfv1eqaEmGIsyqd3yXpm-WQTA,1584
5
5
  afterpython/_typing.py,sha256=kDO25BbJCdNNkqoP9-JYC1zsOuNvzhqvSOCcam3yuAk,128
6
6
  afterpython/builders/__init__.py,sha256=A8LWY4ESeH3SuhkjRcwrCgIAAZXnwHk4asNGGTmVQ9g,1166
7
- afterpython/builders/build_pdoc.py,sha256=lFWQzw4w_-O1PdWHst3eAbgZKkZuQXWtMBFOmZK5BlQ,2442
7
+ afterpython/builders/build_pdoc.py,sha256=OzCy4H_jfKT7VPh76PfzwNxjmyypkHMEYzQ-6xPKMgc,2868
8
8
  afterpython/builders/comments_json.py,sha256=7gY1wy78wqSscTIFlDhwDKNYN6ioLzpDpACLBmwB9rw,3603
9
9
  afterpython/builders/content_json.py,sha256=yem8qhVjy5-aTnmUIING5ttNZFsuTQ-r5M_dYKGRyTk,5362
10
10
  afterpython/builders/faq_json.py,sha256=mMfFepRBL_1QYO0tQ6orf5ESo2LVntk55nfFzencViM,1193
@@ -50,7 +50,8 @@ afterpython/templates/cliff-template.toml,sha256=HVemOBXIAvxz_8IMMAUcSRqYVmC0etf
50
50
  afterpython/templates/dependabot-template.yml,sha256=CBQEgh8EsXw2X7IqzGtFI7lVT9liF6PW4DvGLB0X2LY,1136
51
51
  afterpython/templates/deploy-workflow-template.yml,sha256=n98miM10UUG1vkPATTGSP2QZQoJxvH5LqXnYhbF5Sbw,2858
52
52
  afterpython/templates/pdoc/custom.css,sha256=eAkXzF8jYInX88kHec2MoArxunTWnxSsCzytRtFWriI,1764
53
- afterpython/templates/pdoc/frame.html.jinja2,sha256=byBlXAQBCcTDgj8vCiDjFjjo46DG6uaLzzRf2x9pMHI,989
53
+ afterpython/templates/pdoc/frame.html.jinja2,sha256=994F5YQODCtePKd8gbe-AvwFlIzMU4c16lHWldpOjbo,1218
54
+ afterpython/templates/pdoc/module.html.jinja2,sha256=W8LBbvbYmeNucqAQzn-s6vxelEHbcxeTnjBj7JX-95w,648
54
55
  afterpython/templates/pdoc/syntax-highlighting.css,sha256=RqxTpVlTYuevLeGAUQbOJzK5UiVsQBhZfNSExvgmHag,10552
55
56
  afterpython/templates/pdoc/theme.css,sha256=Qf8GHLKJryY8EBJBxreAGjSoUTG73PDkYTwlGFMO7eI,904
56
57
  afterpython/templates/pre-commit-config-template.yaml,sha256=1dW_CEWyfgL_VeTWE8FIVa1HbhfdfMkxsBAiCRg5wcs,1995
@@ -64,9 +65,9 @@ afterpython/tools/github_actions.py,sha256=0xzOc41QF1PKagD1CW7BAt_Rugy0KCEx_Kfcr
64
65
  afterpython/tools/myst.py,sha256=-bdasdZC6ElTTgPfbsHsZSskotNtlSv1ldev0L2GMJ0,10190
65
66
  afterpython/tools/prek.py,sha256=NEEGf8alTt9MIelAJ8yxWD-V4mnM_pJ7oHgVQG8pbzo,3543
66
67
  afterpython/tools/pyproject.py,sha256=Slhxo-Z9M7Gn9ZGL2BKmbPONpDgAJ1g33TdiulxwEyQ,3700
67
- afterpython/utils.py,sha256=rbCOmRCHif2qzefw9rS-jFA05dz57hZKBr2mxVRaGR0,12406
68
+ afterpython/utils.py,sha256=JyNFhanWllmuE3Ax5URi6_UxVgM9GsqgGwceg4PbFlo,12572
68
69
  afterpython/version.py,sha256=hihRV1S-gc1m46OaXD32ikkEkqzs-Gtq7AcAqOQV-wY,1603
69
- afterpython-0.4.5.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
70
- afterpython-0.4.5.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
71
- afterpython-0.4.5.dist-info/METADATA,sha256=zgrCptp485ygJE2xjaGdIvcJXU1NgTkAm1_UfkdCXHs,6416
72
- afterpython-0.4.5.dist-info/RECORD,,
70
+ afterpython-0.4.7.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
71
+ afterpython-0.4.7.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
72
+ afterpython-0.4.7.dist-info/METADATA,sha256=aviqdUAjoYBlIns8QMhVtb9-mxeAziVGBsvou076f7g,6416
73
+ afterpython-0.4.7.dist-info/RECORD,,