MD-Click 2
raw JSON → 0.0.1 verified Fri May 01 auth: no python
A command line tool for automatically generating .md markdown files from Click-based CLI commands. Based on a fork, version 0.0.1 with weekly releases and Python >=3.8 support.
pip install md-click-2 Common errors
error ModuleNotFoundError: No module named 'mdclick' ↓
cause Import typo: missing underscore.
fix
Use:
from md_click import MdClick error ImportError: cannot import name 'MdClick' from 'md_click' ↓
cause Old version or wrong library (md-click v1 has different class name).
fix
Install md-click-2:
pip install md-click-2 and import: from md_click import MdClick Warnings
breaking The API changed from md-click v1. The class is now `MdClick` with required arguments `source_file` and `output_dir`. ↓
fix Update imports and instantiate MdClick with source_file and output_dir.
gotcha The library name uses a hyphen but Python import uses an underscore. Common mistake: `import md_click_2` (wrong) instead of `from md_click import MdClick`. ↓
fix Use `from md_click import MdClick`.
gotcha The `source_file` must be a path to a Python file that defines Click commands. If the file is not in the current directory, provide an absolute or relative path. ↓
fix Use `source_file='/path/to/your/cli.py'`.
Imports
- MdClick wrong
from mdclick import MdClickcorrectfrom md_click import MdClick
Quickstart
from md_click import MdClick
import click
@click.command()
def my_cli():
click.echo('Hello')
if __name__ == '__main__':
MdClick(source_file='my_cli.py', output_dir='docs').generate()