Skip to main content

Yapper

Yapper converts Python docstrings to astro files for use by the Astro static site generator.

It uses griffe to parse python modules and extracts numpy style docstrings.

Docstrings and parameter descriptions will be passed through as raw markdown wrapped in Astro <Markdown is:raw></Markdown> components.

Class and function elements are wrapped with html with css classes that can be styled from Astro.

See the cityseer.benchmarkurbanism.com documentation site and associated docs repo for a working example.

Conversion of markdown formatting, code blocks, admonitions, etc., is all handled downstream by Astro's remark and rehype plugins. Styling is likewise handled downstream via css targeting the associated element classes.

Configuration

Configuration is provided in pyproject.toml file placed in the current directory, else a --config parameter can be provided with a relative or absolute filepath to a toml config file.

yapper --config ./custom_config.toml

The toml file must include a [tool.yapper] section, with keys corresponding to the default configuration options:

[tool.yapper]
package_root_relative_path = './'
intro_template = """
---\n
import { Markdown } from 'astro/components';\n
---\n
"""
outro_template = ""
module_map = [
  { module = "test.mock_file", astro = "./tests/mock_default.astro" },
]

If you want to wrap the .astro output in a particular layout, then set the intro_template and outro_template accordingly, for example, the following will import the PageLayout layout and will wrap the generated content accordingly:

[tool.yapper]
package_root_relative_path = './'
intro_template = """
---\n
import { Markdown } from 'astro/components';\n
import PageLayout from '../layouts/PageLayout.astro'\n
---\n
\n
<PageLayout>
"""
outro_template = """
</PageLayout>\n
"""
module_map = [
  { module = "test.mock_file", py = "./tests/mock_file.py", astro = "./tests/mock_default.astro" },
]

The module_map is mandatory and specifies the names of the python modules to be processed via the module key and an astro key corresponding to the output file:

Development

yapper uses a pyproject.toml file to specify project dependencies and scripts related to project development and publishing.

See pyproject.toml for available scripts.

Metadata

Release files for yapper 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yapper 0.5.0
File Size Uploaded Provenance Actions
yapper-0.5.0.tar.gz 17.5 kB Without provenance Details for yapper-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yapper 0.5.0
File Interpreter ABI Platform Actions
yapper-0.5.0-py3-none-any.whl Python 3 none any Details for yapper-0.5.0-py3-none-any.whl

Total release size: 27.9 kB

Release files / yapper-0.5.0.tar.gz

Download URL yapper-0.5.0.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9455a69a2d1a6417374b641ba6ccc3e66625ddf6f0cbb3979316800be948afca
BLAKE2b-256 checksum
How to use checksums
8420dfbd9d12d16fc7ef93975595d8530fb53c53209aad8421bd23117d170b37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / yapper-0.5.0-py3-none-any.whl

Download URL yapper-0.5.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bf20fceda7fd74fc85e4dfacae5dcdc8777d2bc164987f93110aaefa70592ce
BLAKE2b-256 checksum
How to use checksums
7ab69675e738ce78a2722e2c638165f26937eb812e07a07913a7032f09e6750b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Security for yapper 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page