docs(build): Update docs with inflect and new layout

This commit is contained in:
hygienic-books 2022-07-05 19:49:33 +02:00
parent bfbc829f91
commit fb26d472f2

View File

@ -9,12 +9,16 @@ cookiecutter https://quico.space/Quico/py-cookiecutter-templates.git --directory
Cookiecutter interactively prompts you for the following info, here with example answers: Cookiecutter interactively prompts you for the following info, here with example answers:
``` ```
project_slug [project-slug]: dockerhost-firewalld-update project_slug [project-slug]: update-firewall-source
Select rich_logging: Select use_rich_logging:
1 - yes 1 - yes
2 - no 2 - no
Choose from 1, 2 [1]: Choose from 1, 2 [1]:
Select uses_config_ini: Select use_config_ini:
1 - yes
2 - no
Choose from 1, 2 [1]:
Select use_inflect:
1 - yes 1 - yes
2 - no 2 - no
Choose from 1, 2 [1]: Choose from 1, 2 [1]:
@ -24,33 +28,38 @@ Done, directory structure and files for your next Python project are ready for y
## Explanation and terminology ## Explanation and terminology
Your three answers translate as follows into rendered files. Your answers translate as follows into rendered files.
1. The `project_slug` is used as a directory name for your Python project where spaces and underscores are replaced-with-dashes. It's also used for a few example variables where `we_use_underscores` instead. 1. The `project_slug` is used as a directory name for your Python project where spaces and underscores are replaced-with-dashes. It's also used for a few example variables where `we_use_underscores` instead.
``` ```
. .
└── dockerhost-firewalld-update └── update-firewall-source
  ├── dockerhost-firewalld-update.py ├── examples
  ├── examples │   └── config.ini.example
  │   └── config.ini.example ├── requirements.in
  ├── requirements.in ├── requirements.txt
  └── requirements.txt └── update-firewall-source.py
``` ```
2. The `rich_logging` variable adds settings and examples that make ample use of the [Rich package](https://github.com/Textualize/rich/) for beautiful logging. You typically want this so it defaults to `yes`. Just hit `Enter` to confirm. The setting also adds necessary requirements.
3. With `uses_config_ini` you're getting a boat load of functions, presets, variables and examples that integrate a config.ini file via the `configparser` module. 2. The `use_rich_logging` variable adds settings and examples that make ample use of the [Rich package](https://github.com/Textualize/rich/) for beautiful logging. You typically want this so it defaults to `yes`. Just hit `Enter` to confirm. The setting also adds necessary requirements.
3. With `use_config_ini` you're getting a boat load of functions, presets, variables and examples that integrate a config.ini file via the `configparser` module.
4. Lastly with `use_inflect` you're adding the `inflect` module which does grammatically correct text rendering such as plural and singular. It also includes a few examples.
## Result ## Result
### Enable Rich and configparser ### Enable Rich, configparser and inflect
Above example of a Python project with Rich and `configparser` enabled will give you a directory structure like this: Above example of a Python project with all of Rich, `configparser` and `inflect` enabled will give you a directory structure like this:
``` ```
. .
└── dockerhost-firewalld-update └── update-firewall-source
  ├── dockerhost-firewalld-update.py ├── examples
  ├── examples │   └── config.ini.example
  │   └── config.ini.example ├── requirements.in
  ├── requirements.in ├── requirements.txt
  └── requirements.txt └── update-firewall-source.py
``` ```
You can see real-life example file content over at [examples/rich-and-config](examples/rich-and-config). Cookiecutter has generated all necessary dependencies with pinned versions and a `rich-and-config.py` script file to get you started. You can see real-life example file content over at [examples/rich-and-config](examples/rich-and-config). Cookiecutter has generated all necessary dependencies with pinned versions and a `update-firewall-source.py` script file to get you started.