🏳️⚧️🐍 Transdoc Python
A Transdoc handler for Python docstrings.
Installation
# Use your dependency manager of choice
uv add transdoc[python]
poetry add transdoc[python]
pip install transdoc[python]
Usage
Transdoc rules are applied to Python docstrings.
For example, given the following rule:
def mdn_link(e: str) -> str:
'''
Return a Markdown-formatted link to MDN's documentation of an HTML element.
'''
return (
f"[View `<{e}>` on MDN]"
f"(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/{e})"
)
The following Python function's docstring would be transformed as follows:
# Before
def make_link(text: str, href: str) -> str:
'''
Generate an HTML link.
{{mdn_link[a]}}
'''
# Please don't write code this insecure in real life
return f"<a href={href}>{text}</a>"
# After
def make_link(text: str, href: str) -> str:
'''
Generate an HTML link.
[View `<a>` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
'''
# Please don't write code this insecure in real life
return f"<a href={href}>{text}</a>"
Release files for transdoc-python 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| transdoc_python-0.1.5.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| transdoc_python-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / transdoc_python-0.1.5.tar.gz
| Download URL | transdoc_python-0.1.5.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f3507df984d78d421cd20deed49af083012a4f6802e168551e0ef30c23552dc
|
|
BLAKE2b-256 checksum How to use checksums |
14ef0f16584af57ea1cf6211f41a5a7fdd8b8f3d2419cd1a056e5b141f457bf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / transdoc_python-0.1.5-py3-none-any.whl
| Download URL | transdoc_python-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12e604275d8b624aada0917bbeab31b25607962d60a635e0b193b2516d3696e8
|
|
BLAKE2b-256 checksum How to use checksums |
af2b9c748ec79b820f134d7cb471eabc04c04d0ee40df66d6afa3617035c1017
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|