Helpers to bild a CLI program
Project description
cli-base-utilities
Helpers to build a CLI program
start development
~$ git clone https://github.com/jedie/cli-base-utilities.git
~$ cd cli-base-utilities
~/cli-base-utilities$ ./dev-cli.py --help
dev CLI
Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ check-code-style Check code style by calling darker + flake8 │
│ coverage Run tests and show coverage report. │
│ fix-code-style Fix code style of all cli_base source code files via darker │
│ install Run pip-sync and install 'cli_base' via pip as editable. │
│ mypy Run Mypy (configured in pyproject.toml) │
│ publish Build and upload this project to PyPi │
│ safety Run safety check against current requirements files │
│ test Run unittests │
│ tox Run tox │
│ update Update "requirements*.txt" dependencies files │
│ update-test-snapshot-files Update all test snapshot files (by remove and recreate all snapshot │
│ files) │
│ version Print version and exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
app CLI
Usage: ./cli.py [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ update-readme-history Update project history base on git commits/tags in README.md │
│ version Print version and exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
DEMO app CLI
Usage: ./cli.py [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ demo-endless-loop Just a useless example command, used in systemd DEMO: It just │
│ print some information in a endless loop. │
│ demo-verbose-check-output-error DEMO for a error calling │
│ cli_base.cli_tools.subprocess_utils.verbose_check_output() │
│ edit-settings Edit the settings file. On first call: Create the default one. │
│ print-settings Display (anonymized) MQTT server username and password │
│ systemd-debug Print Systemd service template + context + rendered file │
│ content. │
│ systemd-remove Write Systemd service file, enable it and (re-)start the │
│ service. (May need sudo) │
│ systemd-setup Write Systemd service file, enable it and (re-)start the │
│ service. (May need sudo) │
│ systemd-status Display status of systemd service. (May need sudo) │
│ systemd-stop Stops the systemd service. (May need sudo) │
│ version Print version and exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Generate project history base on git commits/tags
Add a test case similar to cli_base/tests/test_readme_history.py into your project.
Add the needed start
/end
comments into your README.
To make a new release, do this:
- Increase your project version number
- Run tests to update the README
- commit the changes
- Create release
It's recommended to use git hookd (via pre-commit) to update the README.
For this, add in your pyproject.toml
:
[tool.cli_base]
version_module_name = "<your_package>" # Must provide the `__version__` attribute
Copy&paste .pre-commit-config.yaml into your project.
Add pre-commit
to your requirements and install the git hooks by:
.venv/bin/pre-commit install
.venv/bin/pre-commit autoupdate
history
- v0.7.0rc3
- 2023-12-16 - Bugfix update_readme_history(): Use
__version__
from module - 2023-12-16 - NEW: "update-readme-history" git hook using "pre-commit"
- 2023-12-16 - fix tests
- 2023-12-16 - Bugfix type hints
- 2023-12-16 - Add update-readme-history to app CLI
- 2023-12-16 - Move DEMO into
./cli_base/demo/
- 2023-12-16 - Simplify App CLI
- 2023-12-16 - Remove PACKAGE_ROOT from app CLI
- 2023-12-16 - Update requirements
- 2023-12-16 - Skip test_readme_history() on CI
- 2023-12-16 - Bugfix update_readme_history(): Use
- v0.6.0
- 2023-12-02 - NEW: Code style tools
- v0.5.0
- 2023-12-01 - fix flake8
- 2023-12-01 - NEW: test utils: AssertLogs() context manager
- 2023-12-01 - Bugfix expand_user() if SUDO_USER is the same as current user
- 2023-12-01 - Add "run_coverage()" to "dev_tools" and polish tox, unittest, too.
- 2023-12-01 - add tests for EraseCoverageData()
- 2023-12-01 - Apply manageprojects updates
- v0.4.5
- 2023-11-30 - Configure unittests via "load_tests Protocol" hook
- 2023-11-30 - Update requirements and add "flake8-bugbear"
- 2023-11-30 - Remove function calls in function agruments
Expand older history entries ...
- v0.4.4
- 2023-11-01 - Bugfix "AssertionError: Expected only one line" in Git.first_commit_info()
- v0.4.3
- 2023-11-01 - Git history renderer: Collapse older entries
- v0.4.2
- 2023-11-01 - Remove duplicate git commits and keep only test last one, e.g.: "update requirements"
- 2023-11-01 - Bugfix git history: Add commits before the first tag
- v0.4.1
- 2023-10-08 - Remove commit URLs from history and handle release a new version
- 2023-10-08 - NEW: Generate a project history base on git commits/tags.
- 2023-10-08 - Update requirements
- 2023-09-26 - Update README.md
- v0.4.0
- 2023-09-24 - fix tests
- 2023-09-24 - Add UpdateTestSnapshotFiles() Context Manager
- 2023-09-24 - coverage: Refactor setup and add helpers
- 2023-09-24 - Update requirements
- v0.3.0
- 2023-08-17 - Bugfix tests run in terminal
- 2023-08-17 - update requirements
- 2023-08-17 - NEW: cli_base.cli_tools.git and cli_base.cli_tools.version_info
- v0.2.0
- 2023-08-09 - Project setup updates
- 2023-05-22 - Update README.md
- 2023-05-22 - Rename project "cli-base" to "cli-base-utilities"
- 2023-05-22 - Add github CI config
- 2023-05-22 - Add subprocess_utils from manageprojects
- 2023-05-21 - init
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for cli-base-utilities-0.7.0rc3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fb14552c6fce9eccfacc15de1597360eaceb5ab4ea806aca12c9cbf01a3641 |
|
MD5 | d1de31d8a93ea008d6739dfa61c94ac4 |
|
BLAKE2b-256 | df64ea2b4d66d0996cbe825f496f2c717b0fd2455430daac2117478483083693 |
Close
Hashes for cli_base_utilities-0.7.0rc3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4f0ebdbab04e2d45f01b9219b06353392d8bab9b37e1f8e98b3c7de82f6f41d |
|
MD5 | a563da8f6473a7c3ded17ff6fd01a582 |
|
BLAKE2b-256 | 6043a09132d961eef21a6f301de6c7678bf91ba4940f183bface37d76fb673b0 |