lib-cli-exit-tools 1.1.0__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/.env.example +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/.github/workflows/ci.yml +1 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/.github/workflows/codeql.yml +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/.github/workflows/release.yml +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/.gitignore +1 -0
- lib_cli_exit_tools-1.2.0/AGENTS.md +226 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/CHANGELOG.md +8 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/CONTRIBUTING.md +0 -0
- lib_cli_exit_tools-1.1.0/README.md → lib_cli_exit_tools-1.2.0/DEVELOPMENT.md +15 -207
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/LICENSE +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/Makefile +0 -0
- lib_cli_exit_tools-1.2.0/PKG-INFO +337 -0
- lib_cli_exit_tools-1.2.0/README.md +306 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/codecov.yml +0 -0
- lib_cli_exit_tools-1.2.0/docs/system-design/reference.md +341 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/notebooks/Quickstart.ipynb +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/packaging/README.md +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/packaging/brew/Formula/lib-cli-exit-tools.rb +7 -2
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/packaging/conda/recipe/meta.yaml +2 -2
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/packaging/nix/flake.nix +20 -22
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/pyproject.toml +2 -2
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/qlty.toml +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/__init__.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/_utils.py +131 -0
- lib_cli_exit_tools-1.2.0/scripts/build.py +66 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/bump.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/bump_major.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/bump_minor.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/bump_patch.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/bump_version.py +121 -15
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/clean.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/dev.py +0 -0
- lib_cli_exit_tools-1.2.0/scripts/generate_nix_flake.py +191 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/install.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/menu.py +8 -1
- lib_cli_exit_tools-1.2.0/scripts/push.py +62 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/release.py +3 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/run_cli.py +0 -0
- lib_cli_exit_tools-1.2.0/scripts/test.py +360 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/scripts/version_current.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/src/lib_cli_exit_tools/__init__.py +13 -0
- lib_cli_exit_tools-1.2.0/src/lib_cli_exit_tools/__init__conf__.py +230 -0
- lib_cli_exit_tools-1.2.0/src/lib_cli_exit_tools/__main__.py +11 -0
- lib_cli_exit_tools-1.2.0/src/lib_cli_exit_tools/cli.py +157 -0
- lib_cli_exit_tools-1.2.0/src/lib_cli_exit_tools/lib_cli_exit_tools.py +685 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/src/lib_cli_exit_tools/py.typed +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/tests/test_cli.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/tests/test_cli_extra.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/tests/test_exit_tools.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/tests/test_extend_cli.py +0 -0
- {lib_cli_exit_tools-1.1.0 → lib_cli_exit_tools-1.2.0}/tests/test_lib_extra.py +0 -0
- lib_cli_exit_tools-1.1.0/AGENTS.md +0 -96
- lib_cli_exit_tools-1.1.0/PKG-INFO +0 -364
- lib_cli_exit_tools-1.1.0/scripts/build.py +0 -39
- lib_cli_exit_tools-1.1.0/scripts/push.py +0 -33
- lib_cli_exit_tools-1.1.0/scripts/test.py +0 -129
- lib_cli_exit_tools-1.1.0/src/lib_cli_exit_tools/__init__conf__.py +0 -108
- lib_cli_exit_tools-1.1.0/src/lib_cli_exit_tools/__main__.py +0 -4
- lib_cli_exit_tools-1.1.0/src/lib_cli_exit_tools/cli.py +0 -45
- lib_cli_exit_tools-1.1.0/src/lib_cli_exit_tools/lib_cli_exit_tools.py +0 -372
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Repository Guidelines
|
|
2
|
+
|
|
3
|
+
## On session start
|
|
4
|
+
|
|
5
|
+
Review the system prompt files in `/media/srv-main/softdev/*/projects/softwarestack/systemprompts` and keep their guidance in working memory:
|
|
6
|
+
|
|
7
|
+
- core_programming_solid.md
|
|
8
|
+
- python_solid_architecture_enforcer.md
|
|
9
|
+
- python_clean_architecture.md
|
|
10
|
+
- python_clean_code.md
|
|
11
|
+
- python_small_functions_style.md
|
|
12
|
+
- python_libraries_to_use.md
|
|
13
|
+
- python_structure_template.md
|
|
14
|
+
- self_documenting.md
|
|
15
|
+
- self_documenting_template.md
|
|
16
|
+
|
|
17
|
+
always apply those Rules :
|
|
18
|
+
|
|
19
|
+
- core_programming_solid.md
|
|
20
|
+
|
|
21
|
+
when writing or refracturing Bash scripts, apply those Rules :
|
|
22
|
+
|
|
23
|
+
- core_programming_solid.md
|
|
24
|
+
- bash_clean_architecture.md
|
|
25
|
+
- bash_clean_code.md
|
|
26
|
+
- bash_small_functions.md
|
|
27
|
+
|
|
28
|
+
when writing or refracturing Python scripts, apply those Rules :
|
|
29
|
+
- core_programming_solid.md
|
|
30
|
+
- python_solid_architecture_enforcer.md
|
|
31
|
+
- python_clean_architecture.md
|
|
32
|
+
- python_clean_code.md
|
|
33
|
+
- python_small_functions_style.md
|
|
34
|
+
- python_libraries_to_use.md
|
|
35
|
+
- python_lib_structure_template.md
|
|
36
|
+
|
|
37
|
+
## Project Structure & Module Organization
|
|
38
|
+
|
|
39
|
+
- `src/lib_cli_exit_tools/`: Python package.
|
|
40
|
+
- `scripts/`: shared automation (build/test/release) reused from scaffold.
|
|
41
|
+
- `packaging/`: Conda, Homebrew, and Nix specs kept in sync via scripts.
|
|
42
|
+
- `tests/`: placeholder suite skipping until logging features exist.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Build, Test, and Development Commands
|
|
46
|
+
|
|
47
|
+
- `make help` — list all targets with one‑line docs.
|
|
48
|
+
- `make test` — run ruff (lint + format check), pyright, pytest with coverage (enabled by default), and upload to Codecov (if configured via `.env`).
|
|
49
|
+
- Auto‑bootstrap: `make test` installs dev tools (`pip install -e .[dev]`) if linters/test deps are missing. Use `SKIP_BOOTSTRAP=1 make test` to disable.
|
|
50
|
+
- Coverage control: `COVERAGE=on|auto|off` (default `on` locally). Uses a unique `COVERAGE_FILE` each run to avoid DB locks.
|
|
51
|
+
- Before uploading to Codecov the harness creates an allow-empty commit (`test: auto commit before Codecov upload`) so the report attaches to a revision. Reset or amend if you do not want to keep it.
|
|
52
|
+
- `make build` — build Python wheel/sdist and attempt Conda/Homebrew/Nix builds (auto‑installs missing tools when needed).
|
|
53
|
+
- `make push` — runs the full `scripts/test.py` flow, prompts for/accepts a commit message (or `COMMIT_MESSAGE`), creates an allow-empty commit if needed, then pushes to the selected remote.
|
|
54
|
+
- `make clean` — remove caches, coverage, and build artifacts (includes `dist/` and `build/`).
|
|
55
|
+
|
|
56
|
+
### Versioning & Releases
|
|
57
|
+
|
|
58
|
+
- Single source of truth for the package version is `pyproject.toml` (`[project].version`).
|
|
59
|
+
- Runtime code reads metadata via `importlib.metadata`; do not duplicate the version in code files.
|
|
60
|
+
- On a version bump, update only `pyproject.toml` and the `CHANGELOG.md` entry; do not edit `src/lib_cli_exit_tools/__init__conf__.py` for versioning.
|
|
61
|
+
- Tag releases `vX.Y.Z` and push tags; CI will build artifacts and publish when configured.
|
|
62
|
+
|
|
63
|
+
### Common Make Targets (Alphabetical)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
| Target | One-line description |
|
|
67
|
+
|-------------------|--------------------------------------------------------------------------------|
|
|
68
|
+
| `build` | Build wheel/sdist and attempt Conda/Brew/Nix builds (auto-installs tools). |
|
|
69
|
+
| `bump` | Bump version (VERSION=X.Y.Z or PART=major\|minor\|patch) and update changelog. |
|
|
70
|
+
| `bump-major` | Increment major version ((X+1).0.0). |
|
|
71
|
+
| `bump-minor` | Increment minor version (X.Y.Z → X.(Y+1).0). |
|
|
72
|
+
| `bump-patch` | Increment patch version (X.Y.Z → X.Y.(Z+1)). |
|
|
73
|
+
| `clean` | Remove caches, coverage, and build artifacts (includes `dist/` and `build/`). |
|
|
74
|
+
| `dev` | Install package with dev extras. |
|
|
75
|
+
| `help` | Show this table. |
|
|
76
|
+
| `install` | Editable install. |
|
|
77
|
+
| `menu` | Interactive TUI menu (make menu). |
|
|
78
|
+
| `push` | Commit changes once and push to GitHub (no CI monitoring). |
|
|
79
|
+
| `release` | Tag vX.Y.Z, push, sync packaging, run gh release if available. |
|
|
80
|
+
| `run` | Run module entry (`python -m ... --help`). |
|
|
81
|
+
| `test` | Lint, format, type-check, run tests with coverage, upload to Codecov. |
|
|
82
|
+
| `version-current` | Print current version from `pyproject.toml`. |
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Coding Style & Naming Conventions
|
|
86
|
+
|
|
87
|
+
## Testing Guidelines
|
|
88
|
+
|
|
89
|
+
- Unit and integration-style tests live under `tests/`; keep them up to date when adding features.
|
|
90
|
+
- Extend coverage for new CLI or library behaviour (the suite exercises CLI commands, package metadata, and automation scripts).
|
|
91
|
+
- When adding functionality, replace or remove placeholders and ensure `make test` remains green.
|
|
92
|
+
- write good doctests which clearly show how the function works and what are the intensions. Use it as an enhancement of the inline documentation
|
|
93
|
+
|
|
94
|
+
## Commit & Pull Request Guidelines
|
|
95
|
+
|
|
96
|
+
## Architecture Overview
|
|
97
|
+
- apply python_clean_architecture.md
|
|
98
|
+
|
|
99
|
+
## Security & Configuration Tips
|
|
100
|
+
- `.env` is only for local tooling (CodeCov tokens, etc.); do not commit secrets.
|
|
101
|
+
- Rich logging should sanitize payloads before rendering once implemented.
|
|
102
|
+
|
|
103
|
+
## Translations (Docs)
|
|
104
|
+
|
|
105
|
+
## Translations (App UI Strings)
|
|
106
|
+
|
|
107
|
+
## Changes in WEB Documentation
|
|
108
|
+
|
|
109
|
+
- when asked to update documentation - only do that in the english docs under /website/docs because other languages will be translated automatically,
|
|
110
|
+
unless stated otherwise by the user. In doubt - ask the user
|
|
111
|
+
|
|
112
|
+
## Changes in APP Strings
|
|
113
|
+
|
|
114
|
+
- when i18 strings are changed, only to that in sources/\_locales/en because other languages will be translated automatically,
|
|
115
|
+
unless stated otherwise by the user. In doubt - ask the user
|
|
116
|
+
|
|
117
|
+
## commit/push/GitHub policy
|
|
118
|
+
|
|
119
|
+
- run "make test" before any push to avoid lint/test breakage.
|
|
120
|
+
- after push, monitor errors in the github actions and try to correct the errors
|
|
121
|
+
|
|
122
|
+
## Jupyter Notebooks
|
|
123
|
+
use at least nbformat >=4.5
|
|
124
|
+
- "nbformat": 4,
|
|
125
|
+
- "nbformat_minor": 5
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
# 📘 Documentation Review & Enhancement Prompt
|
|
130
|
+
|
|
131
|
+
You are a **senior software developer specializing in code documentation and system design clarity**. Your task is to review, correct, and enhance all documentation (external and inline) across the codebase with the following principles and workflow.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## **Principles**
|
|
136
|
+
|
|
137
|
+
* Documentation should emphasize **WHY** and **WHAT**, not just **HOW**.
|
|
138
|
+
* All docs must align with the system’s design-level documentation in `docs/systemdesign/*`.
|
|
139
|
+
* Every module, function, dataclass, and constant should be documented with clear intent, expected use, and system relevance.
|
|
140
|
+
* Documentation must be **authoritative, consistent, and actionable** for developers, maintainers, and system designers.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## **Workflow Checklist**
|
|
145
|
+
|
|
146
|
+
### **Step 1 – System Alignment**
|
|
147
|
+
|
|
148
|
+
* [ ] For every feature, function, configuration, dataclass, and constant:
|
|
149
|
+
|
|
150
|
+
* [ ] Verify alignment with `docs/systemdesign/*`.
|
|
151
|
+
* [ ] Document it in `docs/systemdesign/module_reference.md` using the template in `systemprompts/self_documenting.md`.
|
|
152
|
+
* [ ] Ensure consistent terminology and style with system docs.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### **Step 2 – Module-Level Documentation**
|
|
157
|
+
|
|
158
|
+
* [ ] At the top of each module, create or update a **header block** that:
|
|
159
|
+
|
|
160
|
+
* [ ] States the **purpose and intention** of the module.
|
|
161
|
+
* [ ] Outlines its **contents** (functions, classes, constants).
|
|
162
|
+
* [ ] Explains how it connects to the **overall system design**.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### **Step 3 – Function Documentation**
|
|
167
|
+
|
|
168
|
+
For every function:
|
|
169
|
+
|
|
170
|
+
* [ ] Document **Why** it exists (its role in the system).
|
|
171
|
+
* [ ] Document **What** it does (conceptual description).
|
|
172
|
+
* [ ] Document **Inputs** (parameters, types, ranges, meaning).
|
|
173
|
+
* [ ] Document **Outputs** (return values, meaning, edge cases).
|
|
174
|
+
* [ ] Document **Side Effects** (state changes, I/O, mutations).
|
|
175
|
+
* [ ] Add or refine **doctests** that:
|
|
176
|
+
|
|
177
|
+
* [ ] Demonstrate common use cases.
|
|
178
|
+
* [ ] Cover edge cases.
|
|
179
|
+
* [ ] Illustrate not just mechanics but **intent**.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### **Step 4 – Dataclasses & Structures**
|
|
184
|
+
|
|
185
|
+
* [ ] For each dataclass:
|
|
186
|
+
|
|
187
|
+
* [ ] Document each field’s **expected value and type**.
|
|
188
|
+
* [ ] Explain **why the field exists**.
|
|
189
|
+
* [ ] Describe how it interacts with other parts of the system.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### **Step 5 – Constants & Magic Numbers**
|
|
194
|
+
|
|
195
|
+
* [ ] For each constant or magic number:
|
|
196
|
+
|
|
197
|
+
* [ ] Explain **what it represents**.
|
|
198
|
+
* [ ] Explain **why this value was chosen**.
|
|
199
|
+
* [ ] Reference relevant standards, business rules, or domain logic.
|
|
200
|
+
* [ ] Replace unexplained “magic numbers” with named constants if possible.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### **Step 6 – Corrections & Enhancements**
|
|
205
|
+
|
|
206
|
+
* [ ] Remove or rewrite **obsolete documentation**.
|
|
207
|
+
* [ ] Correct **inaccurate or unclear explanations**.
|
|
208
|
+
* [ ] Fill in **missing documentation**.
|
|
209
|
+
* [ ] Reframe overly technical notes to emphasize **intent and reasoning**.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## ✅ Definition of Done (DoD)
|
|
214
|
+
|
|
215
|
+
Documentation is considered **complete and high quality** when:
|
|
216
|
+
|
|
217
|
+
1. **System Consistency**: Every documented element aligns with `docs/systemdesign/*` and is included in `docs/systemdesign/module_reference.md`.
|
|
218
|
+
2. **Module Headers**: Each module has a clear header block with purpose, contents, and system role.
|
|
219
|
+
3. **Function Docs**: Every function has complete, accurate, and intent-driven documentation, including doctests for clarity and correctness.
|
|
220
|
+
4. **Dataclass Docs**: Every dataclass field is fully described with expected type, purpose, and relevance.
|
|
221
|
+
5. **Constants**: Every constant or magic number has a clear explanation or has been replaced with a meaningful named constant.
|
|
222
|
+
6. **Corrections**: All obsolete, unclear, or incorrect docs have been fixed.
|
|
223
|
+
7. **Completeness**: No feature, function, configuration, dataclass, or constant is left undocumented.
|
|
224
|
+
8. **Clarity**: Documentation emphasizes **WHY** and **WHAT**, making the codebase understandable without digging into implementation details.
|
|
225
|
+
|
|
226
|
+
---
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0] - 2025-09-25
|
|
4
|
+
|
|
5
|
+
- use rich-click instead of click, minor fixes
|
|
6
|
+
|
|
7
|
+
## [1.1.1] - 2025-09-18
|
|
8
|
+
|
|
9
|
+
- Documentation and doctest updates
|
|
10
|
+
|
|
3
11
|
## [1.1.0] - 2025-09-16
|
|
4
12
|
|
|
5
13
|
- introduced lib_cli_exit_tools.run_cli helper to reduce boilerplate code. see cli.py as example
|
|
File without changes
|
|
@@ -1,102 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Development Guide
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://github.com/bitranox/lib_cli_exit_tools/actions/workflows/ci.yml)
|
|
5
|
-
[](https://github.com/bitranox/lib_cli_exit_tools/actions/workflows/codeql.yml)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
[](https://mybinder.org/v2/gh/bitranox/lib_cli_exit_tools/HEAD?labpath=notebooks%2FQuickstart.ipynb)
|
|
8
|
-
[](https://pypi.org/project/lib_cli_exit_tools/)
|
|
9
|
-
[](https://pypi.org/project/lib_cli_exit_tools/)
|
|
10
|
-
[](https://docs.astral.sh/ruff/)
|
|
11
|
-
[](https://codecov.io/gh/bitranox/lib_cli_exit_tools)
|
|
12
|
-
[](https://qlty.sh/gh/bitranox/projects/lib_cli_exit_tools)
|
|
13
|
-
[](https://snyk.io/test/github/bitranox/lib_cli_exit_tools)
|
|
3
|
+
This guide aggregates everything maintainers need for building, testing, and releasing `lib_cli_exit_tools`.
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
- Portable signal handling (SIGINT, SIGTERM/SIGBREAK)
|
|
17
|
-
- Consistent exception → exit code mapping
|
|
18
|
-
- Concise error printing with optional traceback and subprocess stdout/stderr capture
|
|
19
|
-
|
|
20
|
-
## Install
|
|
21
|
-
|
|
22
|
-
Pick one of the options below. All methods register the `lib_cli_exit_tools` and `cli-exit-tools` commands on your PATH.
|
|
23
|
-
|
|
24
|
-
### 1) Standard virtualenv (pip)
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
python -m venv .venv
|
|
28
|
-
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
|
|
29
|
-
pip install -e .[dev] # dev install
|
|
30
|
-
# or for runtime only:
|
|
31
|
-
pip install .
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 2) Per-user (no venv)
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pip install --user .
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Note: respects PEP 668; avoid on system Python if “externally managed”. Ensure `~/.local/bin` (POSIX) is on PATH.
|
|
41
|
-
|
|
42
|
-
### 3) pipx (isolated, recommended for end users)
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
pipx install .
|
|
46
|
-
pipx upgrade lib_cli_exit_tools
|
|
47
|
-
# From Git tag/commit:
|
|
48
|
-
pipx install "git+https://github.com/bitranox/lib_cli_exit_tools@v0.1.0"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 4) uv (fast installer/runner)
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
uv pip install -e .[dev]
|
|
55
|
-
uv tool install .
|
|
56
|
-
uvx lib_cli_exit_tools --help
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 5) From artifacts
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
python -m build
|
|
63
|
-
pip install dist/lib_cli_exit_tools-*.whl
|
|
64
|
-
pip install dist/lib_cli_exit_tools-*.tar.gz # sdist
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### 6) Poetry / PDM (project-managed envs)
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Poetry
|
|
71
|
-
poetry add lib_cli_exit_tools # as dependency
|
|
72
|
-
poetry install # for local dev
|
|
73
|
-
|
|
74
|
-
# PDM
|
|
75
|
-
pdm add lib_cli_exit_tools
|
|
76
|
-
pdm install
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 7) From Git via pip (CI-friendly)
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
pip install "git+https://github.com/bitranox/lib_cli_exit_tools@v0.1.0#egg=lib_cli_exit_tools"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### 8) Conda/mamba (optional)
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
mamba create -n cli-exit python=3.12 pip
|
|
89
|
-
mamba activate cli-exit
|
|
90
|
-
pip install .
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 9) System package managers (optional distribution)
|
|
94
|
-
|
|
95
|
-
- Homebrew formula (macOS): `brew install lib_cli_exit_tools` (if published)
|
|
96
|
-
- Nix: flake/package for reproducible installs
|
|
97
|
-
- Deb/RPM via `fpm` for OS-native packages
|
|
98
|
-
|
|
99
|
-
### Make Targets
|
|
5
|
+
## Make Targets
|
|
100
6
|
|
|
101
7
|
| Target | Description |
|
|
102
8
|
|-------------------|--------------------------------------------------------------------------------------------|
|
|
@@ -115,54 +21,43 @@ pip install .
|
|
|
115
21
|
| `build` | Build wheel/sdist and attempt conda, brew, and nix builds (auto-installs tools if missing) |
|
|
116
22
|
| `menu` | Interactive TUI to run targets and edit parameters (requires dev dep: textual) |
|
|
117
23
|
|
|
118
|
-
|
|
24
|
+
### Target Parameters (env vars)
|
|
119
25
|
|
|
120
26
|
- Global
|
|
121
27
|
- `PY` (default: `python3`) — Python interpreter used to run scripts
|
|
122
28
|
- `PIP` (default: `pip`) — pip executable used by bootstrap/install
|
|
123
|
-
|
|
124
29
|
- `install`
|
|
125
30
|
- No specific parameters (respects `PY`, `PIP`).
|
|
126
|
-
|
|
127
31
|
- `dev`
|
|
128
32
|
- No specific parameters (respects `PY`, `PIP`).
|
|
129
|
-
|
|
130
33
|
- `test`
|
|
131
34
|
- `COVERAGE=on|auto|off` (default: `on`) — controls pytest coverage run and Codecov upload
|
|
132
35
|
- `SKIP_BOOTSTRAP=1` — skip auto-install of dev tools if missing
|
|
133
36
|
- `TEST_VERBOSE=1` — echo each command executed by the test harness
|
|
134
37
|
- Also respects `CODECOV_TOKEN` when needed for uploads
|
|
135
|
-
|
|
136
38
|
- `run`
|
|
137
39
|
- No parameters via `make` (always shows `--help`). For custom args: `python scripts/run_cli.py -- <args>`.
|
|
138
|
-
|
|
139
40
|
- `version-current`
|
|
140
41
|
- No parameters
|
|
141
|
-
|
|
142
42
|
- `bump`
|
|
143
43
|
- `VERSION=X.Y.Z` — explicit target version
|
|
144
44
|
- `PART=major|minor|patch` — semantic part to bump (default if `VERSION` not set: `patch`)
|
|
145
45
|
- Examples:
|
|
146
46
|
- `make bump VERSION=1.0.2`
|
|
147
47
|
- `make bump PART=minor`
|
|
148
|
-
|
|
149
48
|
- `bump-patch` / `bump-minor` / `bump-major`
|
|
150
49
|
- No parameters; shorthand for `make bump PART=...`
|
|
151
|
-
|
|
152
50
|
- `clean`
|
|
153
51
|
- No parameters
|
|
154
|
-
|
|
155
52
|
- `push`
|
|
156
53
|
- `REMOTE=<name>` (default: `origin`) — git remote to push to
|
|
157
|
-
|
|
158
54
|
- `build`
|
|
159
55
|
- No parameters via `make`. Advanced: use the script directly, e.g. `python scripts/build.py --no-conda --no-nix`.
|
|
160
|
-
|
|
161
56
|
- `release`
|
|
162
57
|
- `REMOTE=<name>` (default: `origin`) — git remote to push to
|
|
163
58
|
- Advanced (via script): `python scripts/release.py --retries 5 --retry-wait 3.0`
|
|
164
59
|
|
|
165
|
-
|
|
60
|
+
## Interactive Menu (Textual)
|
|
166
61
|
|
|
167
62
|
`make menu` launches a colorful terminal UI (powered by `textual`) to browse targets, edit parameters, and run them with live output.
|
|
168
63
|
|
|
@@ -178,7 +73,7 @@ Run the menu:
|
|
|
178
73
|
make menu
|
|
179
74
|
```
|
|
180
75
|
|
|
181
|
-
|
|
76
|
+
### Target Details
|
|
182
77
|
|
|
183
78
|
- `test`: single entry point for local CI — runs ruff lint + format check, pyright, pytest (including doctests) with coverage (enabled by default), and uploads coverage to Codecov if configured (reads `.env`).
|
|
184
79
|
- Auto‑bootstrap: `make test` will try to install dev tools (`pip install -e .[dev]`) if `ruff`/`pyright`/`pytest` are missing. Set `SKIP_BOOTSTRAP=1` to skip this behavior.
|
|
@@ -189,88 +84,7 @@ make menu
|
|
|
189
84
|
- `pipx-*` and `uv-*`: isolated CLI installations for end users and fast developer tooling.
|
|
190
85
|
- `which-cmd`/`verify-install`: quick diagnostics to ensure the command is on PATH.
|
|
191
86
|
|
|
192
|
-
##
|
|
193
|
-
|
|
194
|
-
Console script:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
# After install (pip/pipx/uv tool)
|
|
198
|
-
lib_cli_exit_tools --help
|
|
199
|
-
cli-exit-tools --help # alias
|
|
200
|
-
lib_cli_exit_tools info
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Embed in your own CLI
|
|
204
|
-
|
|
205
|
-
The `run_cli` helper wraps any Click command with lib_cli_exit_tools’ signal and error handling.
|
|
206
|
-
|
|
207
|
-
```python
|
|
208
|
-
from __future__ import annotations
|
|
209
|
-
|
|
210
|
-
import click
|
|
211
|
-
|
|
212
|
-
from lib_cli_exit_tools import run_cli
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
@click.command()
|
|
216
|
-
def hello() -> None:
|
|
217
|
-
"""Minimal Click command with automatic signal-aware exit handling."""
|
|
218
|
-
|
|
219
|
-
click.echo("Hello from lib_cli_exit_tools!")
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if __name__ == "__main__":
|
|
223
|
-
# run_cli handles SIGINT/SIGTERM/SIGBREAK, Click exceptions, and converts
|
|
224
|
-
# any other exception into an appropriate exit code.
|
|
225
|
-
raise SystemExit(run_cli(hello))
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Run it with:
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
python hello.py
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
Library:
|
|
235
|
-
|
|
236
|
-
```python
|
|
237
|
-
import lib_cli_exit_tools
|
|
238
|
-
|
|
239
|
-
lib_cli_exit_tools.config.traceback = False # show short messages
|
|
240
|
-
try:
|
|
241
|
-
raise FileNotFoundError("missing.txt")
|
|
242
|
-
except Exception as e:
|
|
243
|
-
code = lib_cli_exit_tools.get_system_exit_code(e) # 2 on POSIX
|
|
244
|
-
lib_cli_exit_tools.print_exception_message() # prints: FileNotFoundError: missing.txt
|
|
245
|
-
raise SystemExit(code)
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Command names registered on install
|
|
249
|
-
- lib_cli_exit_tools (default)
|
|
250
|
-
- cli-exit-tools (alias)
|
|
251
|
-
- python -m lib_cli_exit_tools (module entry)
|
|
252
|
-
|
|
253
|
-
If you installed with --user or in a venv, make sure the corresponding bin directory is on PATH:
|
|
254
|
-
- Linux/macOS venv: .venv/bin
|
|
255
|
-
- Linux/macOS user: ~/.local/bin
|
|
256
|
-
- Windows venv: .venv\Scripts
|
|
257
|
-
- Windows user: %APPDATA%\Python\PythonXY\Scripts
|
|
258
|
-
|
|
259
|
-
## Exit Codes
|
|
260
|
-
|
|
261
|
-
- SIGINT → 130, SIGTERM → 143 (POSIX), SIGBREAK → 149 (Windows)
|
|
262
|
-
- SystemExit(n) → n
|
|
263
|
-
- Common exceptions map to POSIX/Windows codes (FileNotFoundError, PermissionError, ValueError, etc.)
|
|
264
|
-
|
|
265
|
-
### Broken pipe behavior
|
|
266
|
-
- Default: exit 141 quietly (128+SIGPIPE), no noisy error output.
|
|
267
|
-
- Configure: `config.broken_pipe_exit_code = 0` to treat as benign truncation, or `32` (EPIPE).
|
|
268
|
-
|
|
269
|
-
### Sysexits mode (optional)
|
|
270
|
-
- Set `config.exit_code_style = "sysexits"` to map ValueError/TypeError → EX_USAGE(64),
|
|
271
|
-
FileNotFoundError → EX_NOINPUT(66), PermissionError → EX_NOPERM(77), generic OSError → EX_IOERR(74).
|
|
272
|
-
|
|
273
|
-
## Development
|
|
87
|
+
## Testing & Coverage
|
|
274
88
|
|
|
275
89
|
```bash
|
|
276
90
|
make test # ruff + pyright + pytest + coverage (default ON)
|
|
@@ -279,15 +93,19 @@ COVERAGE=off make test # disable coverage locally
|
|
|
279
93
|
COVERAGE=on make test # force coverage and generate coverage.xml/codecov.xml
|
|
280
94
|
```
|
|
281
95
|
|
|
282
|
-
###
|
|
96
|
+
### Local Codecov uploads
|
|
97
|
+
|
|
98
|
+
- `make test` (with coverage enabled) generates `coverage.xml` and `codecov.xml`, then attempts to upload via the Codecov CLI or the bash uploader.
|
|
99
|
+
- For private repos, set `CODECOV_TOKEN` (see `.env.example`) or export it in your shell.
|
|
100
|
+
- For public repos, a token is typically not required.
|
|
101
|
+
|
|
102
|
+
## Packaging Sync (Conda/Brew/Nix)
|
|
283
103
|
|
|
284
104
|
- `make test` and `make push` automatically align the packaging skeletons in `packaging/` with the current `pyproject.toml`:
|
|
285
105
|
- Conda: updates `{% set version = "X.Y.Z" %}` and both `python >=X.Y` constraints to match `requires-python`.
|
|
286
106
|
- Homebrew: updates the source URL tag to `vX.Y.Z` and sets `depends_on "python@X.Y"` to match `requires-python`.
|
|
287
107
|
- Nix: updates the package `version`, example `rev = "vX.Y.Z"`, and switches `pkgs.pythonXYZPackages` / `pkgs.pythonXYZ` to match the minimum Python version from `requires-python`.
|
|
288
|
-
|
|
289
108
|
- To run just the sync without bumping versions: `python scripts/bump_version.py --sync-packaging`.
|
|
290
|
-
|
|
291
109
|
- On release tags (`v*.*.*`), CI validates that packaging files are consistent with `pyproject.toml` and will fail if they drift.
|
|
292
110
|
|
|
293
111
|
## Versioning & Metadata
|
|
@@ -316,18 +134,8 @@ GitHub Actions workflows are included:
|
|
|
316
134
|
|
|
317
135
|
To publish a release:
|
|
318
136
|
1. Bump `pyproject.toml` version and update `CHANGELOG.md`.
|
|
319
|
-
2. Tag the commit (`git tag
|
|
137
|
+
2. Tag the commit (`git tag v1.1.0 && git push --tags`).
|
|
320
138
|
3. Ensure `PYPI_API_TOKEN` secret is configured in the repo.
|
|
321
139
|
4. Release workflow uploads wheel/sdist to PyPI.
|
|
322
140
|
|
|
323
141
|
Conda/Homebrew/Nix: use files in `packaging/` to submit to their ecosystems. CI also attempts builds to validate recipes, but does not publish automatically.
|
|
324
|
-
|
|
325
|
-
### Local Codecov uploads
|
|
326
|
-
|
|
327
|
-
- `make test` (with coverage enabled) generates `coverage.xml` and `codecov.xml`, then attempts to upload via the Codecov CLI or the bash uploader.
|
|
328
|
-
- For private repos, set `CODECOV_TOKEN` (see `.env.example`) or export it in your shell.
|
|
329
|
-
- For public repos, a token is typically not required.
|
|
330
|
-
|
|
331
|
-
## License
|
|
332
|
-
|
|
333
|
-
MIT
|
|
File without changes
|
|
File without changes
|