Pydowndoc
Rapidly convert your AsciiDoc files to Markdown, using Python
A Python wrapper around the latest-built binary of downdoc; a rapid AsciiDoc to Markdown converter.
Why Use Pydowndoc?
- Run downdoc from the CLI within your virtual environment
- Use PyPI as the single installation location of your Python project tooling
- Use pydowndoc/init.py[the API] to convert files using your own Python code/scripts
- Use the Hatch plugin to convert your project’s README.adoc file to Markdown, when building your package
Installation
Run as a uv tool (no installation necessary)
uvx --from Pydowndoc-bin -- downdoc --version
💡 TIP
uv will warn you that the downdoc binary is not directly provided by the Pydowndoc[bin] package, so we suggest to use --from Pydowndoc-bin when running downdoc using uvx or uv tool.
Add to your uv project/script’s dependencies
uv add Pydowndoc[bin]
Install permanently as a uv tool
uv tool install Pydowndoc-bin
Install using pip after creating a virtual environment
path/to/venv/python -m pip install Pydowndoc[bin]
Installing the downdoc Binary
Pydowndoc assumes by default that you wish to use the downdoc binary already installed on your system (E.g. using your system’s package manager).
Installing the PyPI package Pydowndoc will only install the Python compatibility layer for downdoc.
If you wish to also install the downdoc binary itself, please install using the [bin] extra.
Installing without the [bin] extra on a system where downdoc is not already installed will not work
$ uvx --with Pydowndoc python -c "import pydowndoc; pydowndoc.run()"
OSError: The downdoc executable could not be found. Ensure it is installed (E.g `uv add Pydowndoc[bin]`).
📌 NOTE
Once PEP 771 is finalised, the default install will include the [bin] extra, and using the downdoc binary already installed on your system will require opting-out from including the [bin] extra.
CLI Usage
These commands will only work correctly after the downdoc binary has been installed, either as a system binary or using the [bin] extra.
See Installing the downdoc Binary for more information.
Display the current version number (useful to validate that installation was successful)
downdoc --version
Display the help message
downdoc --help
Convert a given file (the same filename will be retained, with file-extension changed to .md)
downdoc MyNotes.adoc
Output the converted file to the given filename & path
downdoc MyNotes.adoc -o path/to/output.md
Output the converted file to stdout
downdoc MyNotes.adoc -o -
Read the input AsciiDoc file from stdin
cat MyNotes.adoc | downdoc - -o MyNotes.md
API Usage
Convert a given file (the same filename will be retained, with file-extension changed to .md)
from pathlib import Path
import pydowndoc
pydowndoc.run(Path("MyNotes.adoc"))
Retrieve the converted file as a string
from pathlib import Path
import pydowndoc
converted_file_contents: str = pydowndoc.run(
Path("MyNotes.adoc"),
output="-",
process_capture_output=True,
).stdout.decode()
Ensure the conversion process executes successfully and output the converted file to the given location (by default your code will continue execution even if conversion fails)
from pathlib import Path
import pydowndoc
pydowndoc.run(
Path("MyNotes.adoc"),
output=Path("path/to/output.md"),
process_check_return_code=True,
)
Use as a Hatch build hook
-
Ensure the
readmefield is added to yourproject.dynamiclist within yourpyproject.tomlfile[project] name = "my-cool-project" version = "0.1.0" dynamic = ["readme"]
-
Set up your build backend, within your
pyproject.tomlfile, addingPydowndoc[bin]as a build dependency[build-system] build-backend = "hatchling.build" requires = ["hatchling", "Pydowndoc[bin]"]
💡 TIP
To prevent issues with users building your package that may not have thedowndocbinary already installed on their system, we suggest including the[bin]extra in your package’s build dependencies. -
Include the hook name within
[tool.hatch.metadata.hooks]to enable README-file conversion[tool.hatch.metadata.hooks.downdoc-readme]or
[tool.hatch.metadata.hooks] downdoc-readme = {}
-
Using a path to a custom README file
[tool.hatch.metadata.hooks.downdoc-readme] path = "README2.adoc"
-
A full example of a `+pyproject.toml+` file
[project]
name = "my-cool-project"
version = "0.1.0"
dynamic = ["readme"]
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "Pydowndoc[bin]"]
[tool.hatch.metadata.hooks.downdoc-readme]
path = "README2.adoc"
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
path |
str |
README.adoc |
The location of your AsciiDoc to be converted to Markdown, to be used as the project’s README file |
Upgrading
uv tool upgrade Pydowndoc-bin
If added as a uv project dependency
uv sync --upgrade-package Pydowndoc
If installed using pip
path/to/venv/python -m pip install --upgrade Pydowndoc
Uninstallation
If added as a uv project dependency
uv remove Pydowndoc
If installed as a uv tool
uv tool uninstall Pydowndoc-bin
If installed with pip
path/to/venv/python -m pip uninstall Pydowndoc
Reporting Issues
If there are issues with the Python API for this package, or you are encountering installation problems, please report these on the GitHub issues tracker for this project.
If you have problems with the conversion process of your AsciiDoc files to Markdown, please report these upstream, directly to the downdoc project.
Windows & macOS Wheels
Windows and macOS wheels are provided to enable use of this project on non-linux hosts. However, these versions have not had the same level of testing as the linux version. Therefore, if you encounter any bugs with these other versions, report them on the GitHub issues tracker for this project.
Licencing
The compiled binary of the distributed downdoc software is shared under the MIT licence as described in the upstream project’s licence file.
All other code in this project is distrubuted under the Apache-2.0 licence.
Metadata
Release files for Pydowndoc 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydowndoc-1.4.1.tar.gz | 16.6 kB | Without provenance | Details for pydowndoc-1.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydowndoc-1.4.1-py3-none-any.whl | Python 3 | none | any | Details for pydowndoc-1.4.1-py3-none-any.whl |
Total release size: 28.6 kB
Release files / pydowndoc-1.4.1.tar.gz
| Download URL | pydowndoc-1.4.1.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
002e1a797f64cccd0cfe09c9e5a3f092e0dcc188ec4bee07bbddae66b892c3b5
|
|
BLAKE2b-256 checksum How to use checksums |
a71f985a711a38d2ec1f854133929fe41c0b15cf7d2a449a303b9a9bbc51c1db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.22
|
Release files / pydowndoc-1.4.1-py3-none-any.whl
| Download URL | pydowndoc-1.4.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93743cf1cf5ea605f218be0e02af585b7c215d34799c23d0e7f2e5f728611495
|
|
BLAKE2b-256 checksum How to use checksums |
1a6c41cf08aeb4520613e2c7d5d5f769bb7cf5389e6be1c181992bb9137dee9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.22
|
Security for Pydowndoc 1.4.1
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.