Skip to main content

Mechanical Markdown

PyPI version codecov

If you are using markdown to create tutorials for your users, these markdown files will often be a series of shell commands that a user will copy and paste into their shell of choice, along with detailed text description of what each command is doing.

If you are regularly releasing software and having to manually verify your tutorials by copy pasting commands into a terminal every time you create a release, this is the package for you.

The mechanical-markdown package is a Python library and corresponding shell script that allow you to run annotated markdown tutorials in an automated fashion. It will execute your markdown tutorials and verify the output according to expected stdout/stderr that you can embed directly into your markdown tutorials.

Installing

This package requires a working python3 environment. You can install it using pip:

pip install mechanical-markdown

This will install the Python module, and create the mm.py CLI script.

Quick Start

Check out the examples for some quick and easy examples.

Usage

CLI

A command line utility called mm.py is included with this package.

% mm.py --help
usage: mm.py [-h] [--dry-run] [--manual] [--shell SHELL_CMD] markdown_file

Auto validate markdown documentation

positional arguments:
  markdown_file

options:
  -h, --help            show this help message and exit
  --dry-run, -d         Print out the commands we would run based on markdown_file
  --manual, -m          If your markdown_file contains manual validation steps, pause for user input
  --shell SHELL_CMD, -s SHELL_CMD
                        Specify a different shell to use

API

Creating a MechanicalMarkdown instance from a string which contains a markdown document:

from mechanical_markdown import MechanicalMarkdown

mm = MechanicalMarkdown(markdown_string, shell="bash -c")

MechanicalMarkdown methods

# Returns a string describing the commands that would be run
output = mm.dryrun()
print(ouput)

# Run the commands in the order they were specified and return a boolean for succes or failure
# Also returns a report summarizing what was run and stdout/sterr for each command
success, report = exectute_steps(manual, validate_links=False, link_retries=3)
print(report)

Contributing

Issues and contributions are always welcome! Please make sure your submissions have appropriate unit tests (see tests).

This project was created to support dapr/quickstarts. We're sharing it with the hope that it might be as usefull for somebody else as it was for us.

Metadata

Release files for mechanical-markdown 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mechanical-markdown 0.8.0
File Size Uploaded Provenance
mechanical_markdown-0.8.0.tar.gz 16.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mechanical-markdown 0.8.0
File Interpreter ABI Platform
mechanical_markdown-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.7 kB

Release files / mechanical_markdown-0.8.0.tar.gz

Download URL mechanical_markdown-0.8.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
672301d7eb98aa6a660a974e5d64132bcf25fc3641015d1eb29b5ac292b6cac0
BLAKE2b-256 checksum
How to use checksums
e50ee980b8d3882fb9e4c0ba9c4966a6d0d1e99ef65e8fbf026354498bc20e29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / mechanical_markdown-0.8.0-py3-none-any.whl

Download URL mechanical_markdown-0.8.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a7c1746b087c43bd50ce320cc479ff5eb2da3b43ae6d334ac36571d086d156e
BLAKE2b-256 checksum
How to use checksums
3c895a2b00dee852fe95da4f4aff3393fb4caa22b8ecedb029b90aa5ed02177d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Security for mechanical-markdown 0.8.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page