Generate docs from your cookiecutter template
Project description
cookiecutter-autodocs
Generate docs for a cookiecutter template's inputs. Pre-commit hook and github-action
Why?
Cookiecutter is a powerful tool to create templates for all sorts of projects, but one of its downsides is it relies on a plain JSON file for its input (cookiecutter.json). Because JSON does not allow comments, you cannot document your inputs without writing the documentation separately.
cookiecutter-autodocs allows you to write your Cookiecutter's input as a Toml file, cookiecutter.desc. In this file you can add defaults, info about the variable type, and a description of each variable.
An example cookiecutter.desc
[project_slug]
default = "new_project"
description = "The name of the project."
type = "string"
[python_version]
default = "3.11.2"
description = "What python version to use with this project"
type = "string"
[dev_requirements]
default = []
description = "What dev requirements does this project have"
type = "list(string)"
[author]
default = ""
description = "Who's the author?"
type = "string"
You can then generate a cookiecutter.json
from this cookiecutter.desc
file.
cookiecutter-autodocs generate cookiecutter -i cookiecutter.decs -o cookiecutter.json
cat cookiecutter.json
{
"project_slug": "new_project",
"python_version": "3.11.2",
"dev_requirements": [],
"author": ""
}
You can also use the cookiecutter.desc
file to generate additional documentation, like a markdown table:
cookiecutter-autodocs generate markdown -i cookiecutter.desc
+-----------------------------------------------------------------------------------------------+
| name | description | default | type |required|
+----------------+--------------------------------------------+-----------+------------+--------+
| project_slug | The name of the project. |new_project| string | False |
+----------------+--------------------------------------------+-----------+------------+--------+
| python_version |What python version to use with this project| 3.11.2 | string | False |
+----------------+--------------------------------------------+-----------+------------+--------+
|dev_requirements|What dev requirements does this project have| [] |list(string)| False |
+----------------+--------------------------------------------+-----------+------------+--------+
| author | Who's the author? | | string | True |
+-----------------------------------------------------------------------------------------------+
Installation
CLI
pip install cookiecutter-autodocs
Documentation
See ReadTheDocs for usage and more detailed documentation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cookiecutter_autodocs-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e2d7bbbc813038ad21799625fa32e1458a9570adc19225e42b7bc47d8fcb66 |
|
MD5 | ea9c27046d373c1cb838bee374d26ce3 |
|
BLAKE2b-256 | 5377dbf9c8e86a32beb023a0ab5cf64e7a1ce81107739f8f23368f9efb69932a |
Hashes for cookiecutter_autodocs-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 181836481786c0c61f202cf6db3ed7646a6226d4829f92bc6ff99c5956a9b7f7 |
|
MD5 | a4a39d5ce894fc290fce0ad470805a6d |
|
BLAKE2b-256 | 355761e963a1c732794e55adfeab739e71ed2b11ec3d73b71fde04eb2f8f27f9 |