Skip to main content

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


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.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

asciidocstring-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file asciidocstring-0.1.0.tar.gz.

File metadata

  • Download URL: asciidocstring-0.1.0.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

Hashes for asciidocstring-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28ffbca4760cf4c3b508a3184158f9add7aa3568249c19952a052d8389f32987
MD5 cfa37a189092476469948cb3ba19fb6a
BLAKE2b-256 e2fed550e97a5789b5c050f92a1a88a1c6ff0149c33d87fa1dc27e9f5069a6b7

See more details on using hashes here.

File details

Details for the file asciidocstring-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asciidocstring-0.1.0-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

Hashes for asciidocstring-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 787b55d75a558186586a7f2f2d30ede0b8a7c74fb8ce68236b3964312fad5083
MD5 b30b2b4c5fce66495d4d154c22d07df4
BLAKE2b-256 915c2b3a10ee78cc9f0120e735cb73e3c97ca93dd1d52fb6e4229895887bc04c

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