Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,5 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: codecov-umbrella # Optional: can be removed if not specifically needed
fail_ci_if_error: true
env: # Ensure environment variables are available if action needs them
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
```
name: codecov-umbrella
fail_ci_if_error: true
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,69 @@

Convert argparse based executable scripts to markdown documents. It is based on [argdown](https://github.com/9999years/argdown) but has a simpler interface and a cleaner code.
### Installation
For end-users, install `argmark` using pip:
```bash
pip install argmark
```
For development, please see the "Development" section below.

### Usage
Using `argmark` is very simple. For a sample python file [sample_argparse.py](tests/sample_argparse.py):
Using `argmark` is very simple. Once installed, you can run it against a Python script that defines an `ArgumentParser`. For example, given a file `your_script.py`:

```python
import argparse

parser = argparse.ArgumentParser(
prog="sample_argparse.py",
description="Just a test",
prog="your_script.py",
description="A sample script description.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"-f", "--files", help="Files to read.", required=True, nargs="+",
)
values = parser.parse_args()
parser.add_argument(
"--limit", type=int, default=10, help="Maximum number of items to process."
)
# For argmark to find the parser, it needs to be accessible
# when the script is processed. Often, parse_args() is called.
# If not, ensure the parser object is discoverable by argmark's gen_help.
if __name__ == '__main__': # Or called directly if script is simple
args = parser.parse_args()
```

Run `argmark -f sample_argparse.py` and it would generate:
Run `argmark -f your_script.py` (or the path to your script) and it would generate `your_script.md`:
```markdown

sample_argparse.py
your_script.py
==================

# Description


Just a test
A sample script description.

# Usage:


```bash
usage: sample_argparse.py [-h] -f FILES [FILES ...]

usage: your_script.py [-h] -f FILES [FILES ...] [--limit LIMIT]
```
# Arguments

# Arguments

|short|long|default|help|
| :---: | :---: | :---: | :---: |
|`-h`|`--help`||show this help message and exit|
|`-f`|`--files`|`None`|Files to read.|
||`--limit`|`10`|Maximum number of items to process.|

```

When developing `argmark` locally (after installing as shown in the "Development" section), you can invoke it from the project root using `uv`:
```bash
# Ensure your virtual environment is active
uv run argmark -- --files path/to/your_script.py
```
Note the `--` which separates arguments for `uv run` from arguments passed to the `argmark` script itself.



## License
Expand Down
Loading