Package: cli-base-utilities
cli-base-utilitiesHelpers to build a CLI programhttps://pypi.org/project/cli-base-utilities/start development~$gitclonehttps://github.com/jedie/cli-base-utilities.git
~$cdcli-base-utilities
~/cli-base-utilities$./dev-cli.py--helpdev CLIUsage: ./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 CLIUsage: ./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 CLIUsage: ./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/tagsAdd a test case similar tocli_base/tests/test_readme_history.pyinto your project.
Add the neededstart/endcomments into your README.To make a new release, do this:Increase your project version numberRun tests to update the READMEcommit the changesCreate releaseIt's recommended to use git hookd (viapre-commit) to update the README.
For this, add in yourpyproject.toml:[tool.cli_base]version_module_name="<your_package>"# Must provide the `__version__` attributeCopy&paste.pre-commit-config.yamlinto your project.Addpre-committo your requirements and install the git hooks by:.venv/bin/pre-commitinstall
.venv/bin/pre-commitautoupdateUpdate pre-commit hooksUpdate version in.pre-commit-config.yamland make a release.The Problem: The hooks are broken, if the "new" version is not tagged yet.
To create a release, it's possible to use all git commands (commit, push, etc) with--no-verifyto skip the hooks.It's easier to temporarily uninstall the hooks, create the release and install the hooks again, e.g.:.../cli-base-utilities$.venv/bin/pre-commituninstall# ...bump version, commit, push, merge... create release....../cli-base-utilities$.venv/bin/pre-commitinstallhistoryv0.7.02023-12-16 - Add "Update pre-commit hooks" to README2023-12-16 - Bugfix update_readme_history(): Use__version__from module2023-12-16 - NEW: "update-readme-history" git hook using "pre-commit"2023-12-16 - fix tests2023-12-16 - Bugfix type hints2023-12-16 - Add update-readme-history to app CLI2023-12-16 - Move DEMO into./cli_base/demo/2023-12-16 - Simplify App CLI2023-12-16 - Remove PACKAGE_ROOT from app CLI2023-12-16 - Update requirements2023-12-16 - Skip test_readme_history() on CIv0.6.02023-12-02 - NEW: Code style toolsv0.5.02023-12-01 - fix flake82023-12-01 - NEW: test utils: AssertLogs() context manager2023-12-01 - Bugfix expand_user() if SUDO_USER is the same as current user2023-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 updatesv0.4.52023-11-30 - Configure unittests via "load_tests Protocol" hook2023-11-30 - Update requirements and add "flake8-bugbear"2023-11-30 - Remove function calls in function agrumentsExpand older history entries ...v0.4.42023-11-01 - Bugfix "AssertionError: Expected only one line" in Git.first_commit_info()v0.4.32023-11-01 - Git history renderer: Collapse older entriesv0.4.22023-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 tagv0.4.12023-10-08 - Remove commit URLs from history and handle release a new version2023-10-08 - NEW: Generate a project history base on git commits/tags.2023-10-08 - Update requirements2023-09-26 - Update README.mdv0.4.02023-09-24 - fix tests2023-09-24 - Add UpdateTestSnapshotFiles() Context Manager2023-09-24 - coverage: Refactor setup and add helpers2023-09-24 - Update requirementsv0.3.02023-08-17 - Bugfix tests run in terminal2023-08-17 - update requirements2023-08-17 - NEW: cli_base.cli_tools.git and cli_base.cli_tools.version_infov0.2.02023-08-09 - Project setup updates2023-05-22 - Update README.md2023-05-22 - Rename project "cli-base" to "cli-base-utilities"2023-05-22 - Add github CI config2023-05-22 - Add subprocess_utils from manageprojects2023-05-21 - init