Skip to content

Repository files navigation

readme-update 🦀

PyPI Downloads

Tired of updating documentation?

This tool updates your README.md with a one line description for each of the python scripts in a directory you point it to (and recursively). It adds the text for lines that start with "Description: " and "Link: ". It ignores any that don't have the description.

You can supply alternative --table-fields to create a table with columns for the provided fields. The --link-fields argument is used to signal which of the --table-fields should be rendered as links like this [Link](this/is/the/link).

The idea is that links should link to higher level documentation (if it exists).

This can be used as a pre-commit for python projects with standalone scripts for specific processes.

It will update in place if the # Scripts block exists or else it will append it to the end of the README.md

example_usage.py shows how to call the script from python.

Here is an example output from the tool:

Scripts

NameDescriptionLink
example1.pyThis is an example file that links to my own github.Link
example2.pySome other description.
example3.pyLink
::

Installation

pip install readme-update

Or

uv add readme-update

Usage

Assuming its is run from this location.

root/
scripts/
example_script.py
README.md
uv run -m update_readme \
--scripts-root "./scripts" \
--readme-path "./README.md"

Args

ArgumentTypeRequiredDefaultDescription
--scripts-rootstrPath to the root of the scripts to scan
--readme-pathstr'./README.md'Path to the README file that will be modified
--table-fieldslist["Description", "Link"]Fields to dynamically add to the README.md table.
--link-fieldslist["Link"]Which of the provided table fields should be rendered as links.

Ret codes

RetCodeintdescription
NoModification0The Repo Map reflects the current state of the repo.
ModifiedReadme1The README was updated.
NoPyFiles2No python files found at the scripts-root location.
FailedParsingFile3Failed to read README file
FailedToWriteReadme4The given README.md path does not match the expected basename.
InvalidLinkFields5The given link_fields are not a subset of the given table_fields.

Repo map

├── .github
│ └── workflows
│ ├── ci.yaml
│ └── publish.yaml
├── python
│ └── update_readme
│ ├── __init__.py
│ └── __main__.py
├── scripts
│ ├── example1.py
│ ├── example2.py
│ └── example3.py
├── src
│ ├── core
│ │ ├── adapters.rs
│ │ ├── domain.rs
│ │ └── mod.rs
│ ├── api.rs
│ └── lib.rs
├── tests
│ └── integration_tests.rs
├── .pre-commit-config.yaml
├── Cargo.lock
├── Cargo.toml
├── README.md
├── pyproject.toml
└── uv.lock
::

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages