Skip to main content

A Transdoc handler for Python docstrings

Project description

🏳️‍⚧️🐍 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>"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transdoc_python-0.1.5.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transdoc_python-0.1.5-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file transdoc_python-0.1.5.tar.gz.

File metadata

  • Download URL: transdoc_python-0.1.5.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for transdoc_python-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6f3507df984d78d421cd20deed49af083012a4f6802e168551e0ef30c23552dc
MD5 77243ca343b3a7e1b3311564f0bf003d
BLAKE2b-256 14ef0f16584af57ea1cf6211f41a5a7fdd8b8f3d2419cd1a056e5b141f457bf5

See more details on using hashes here.

File details

Details for the file transdoc_python-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: transdoc_python-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for transdoc_python-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 12e604275d8b624aada0917bbeab31b25607962d60a635e0b193b2516d3696e8
MD5 63d939dc5815a29048c86b6684bf88e6
BLAKE2b-256 af2b9c748ec79b820f134d7cb471eabc04c04d0ee40df66d6afa3617035c1017

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page