A semantic parser and converter for Python docstrings written in AsciiDoc
Project description
= AsciiDocString
:toc: left
:sectnums:
A semantic parser, extractor, and translator for Python docstrings written in AsciiDoc.
== Introduction
`asciidocstring` is a Python library built on top of the pure-Python `asciidoctrine` parser. It is designed to clean raw docstrings (stripping common indentation) and compile them into a structured Abstract Semantic Graph (ASG).
This parsed semantic graph can be used by downstream libraries to:
1. Render high-fidelity reStructuredText for Sphinx (`sphinx-asciidoc`).
2. Query and run interactive doctests (`asciidoctest`).
== Installation
[source,bash]
----
pip install asciidocstring
----
== Usage
=== Parsing a Docstring
[source,python]
----
import asciidocstring
docstring = """
= Parse Coordinates
This function processes dynamic coordinate objects.
[source,python,test]
----
assert parse_coords(10, 20) == (10, 20)
----
x (int):: The horizontal component
y (int):: The vertical component
"""
doc = asciidocstring.parse(docstring)
# Convert to reStructuredText (reST) for Sphinx
rest_output = doc.to_rest()
# Extract code blocks for doctesting
tests = doc.extract_tests()
----
== License
This project is licensed under the Apache License, Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asciidocstring-0.1.0a1.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asciidocstring-0.1.0a1.tar.gz.
File metadata
- Download URL: asciidocstring-0.1.0a1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccb9d70bccd3e052e884c9acad15e043da7db5878e2cb953e46b7de0638b824c
|
|
| MD5 |
7958bab0568fee8107263b770bf46a08
|
|
| BLAKE2b-256 |
53fc1287fda30d408b7ebb4de7e875e9b10b0194986a6cddb219a9aca4bbeca0
|
File details
Details for the file asciidocstring-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: asciidocstring-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3138dc0a2937477e3cf19f169fab83736b1ebd4e3e1f7540f4850775fbce28b
|
|
| MD5 |
dff6a70735338a0225d61759c961fa42
|
|
| BLAKE2b-256 |
b1a0f568df5544c8c12571e2ca181a63f2628c3ccf2b0dd3a0c242a97a82f86d
|