Commit ba722a1
authored
Feat: Centralized maintainer ownership for CLI help and docs (#180)
**Fishing for thoughts on this: Do it, part of it, none of it, tweak
it?**
Long-term I think we want to consider one or more DLL or mailing lists
for this to help with turnover. Could even use CDA to query for a group
of emails over a specific command.
Adds a centralized maintainer/ownership workflow for cwms-cli uses it to
surface maintainers in both the CLI help output and the docs.
This adds a user-friendly contact path for issue reporting. It is
optional where ownership is not yet defined, and is intended to
encourage users to report issues. *Issues* should always be created for
feature requests, bugs, etc. Having authors on sub commands helps
provide this contact path where making an issue might otherwise go
unreported. Having some email to report something would enable
maintainers to create followup issues.
(Issues do report a link to the github issues page for cwms-cli!)
## What this does
This introduces a single ownership source of truth in
`cwms-cli/maintainers.toml`.
From that file, the repo now generates and maintains:
- cwms-cli/.github/CODEOWNERS for GitHub review/accountability
- Poetry authors in cwms-cli/pyproject.toml
- runtime ownership metadata in
cwms-cli/cwmscli/_generated/ownership_data.py
- docs include fragments under cwms-cli/docs/_generated/maintainers
That generated data is then used in two user-facing places:
- CLI help output shows `Maintainers:` on help pages
<img width="588" height="328" alt="image"
src="https://github.com/user-attachments/assets/8ba3bf0a-33d7-49b8-b233-5bd39834fa9e"
/>
_Each command has author(s) associated_
- docs pages now show a maintainer note sourced from the same ownership
file
## Implementation details
The sync flow is handled by cwms-cli/scripts/sync_ownership.py
Current command ownership mapping:
- Charles: csv2cwms, blob, update, shared cwms-cli, shared load
- Eric: usgs, shefcritimport, shared cwms-cli, shared load
CLI help rendering was extended in
`cwms-cli/cwmscli/utils/click_help.py` to show maintainers centrally,
without hand-editing each command. Ownership lookup is handled by
`cwms-cli/cwmscli/ownership.py`, and nested commands inherit from the
nearest owned parent command.
Docs were updated to include generated maintainer blocks on the
current command pages:
- docs/cli.rst
- docs/cli/blob.rst
- docs/cli/csv2cwms.rst
- docs/cli/update.rst
- docs/cli/load_location_ids_all.rst
## Contributing / maintenance
cwms-cli/CONTRIBUTING.md was updated to document the new workflow.
Contributors now have explicit guidance to:
- treat maintainers.toml file to maintain contributors in
- run python scripts/sync_ownership.py after ownership edits
- use python scripts/sync_ownership.py --check to verify generated files
There is also enforcement in both local hooks and CI:
- pre-commit now runs a generated ownership files check *(Debatable if
we need this?)*
- GitHub Actions verifies generated ownership files are in sync ~(This
is probably enough to make sure it is not forgotten)~
## Benefits
This gives `cwms-cli` a clear ownership model with one place to maintain
it.
Benefits:
- maintainers are visible to users in CLI help and docs
- ownership and package author metadata stay aligned
- GitHub review routing now has an explicit CODEOWNERS base
- command ownership is easier to update during turnover
- changes to ownership are reviewable as normal repo diffs
- the same ownership data can be extended later without adding more
manual duplication
## Alternatives considered
### Git history / recent commits
This was considered but not used as the primary maintainer source.
Reason:
- recent commits do not reliably indicate who is responsible
- contributors may touch files without becoming maintainers
(Intentionally Opt-In) to maintaining
- ownership should survive turnover, refactors, and one-off fixes
- git activity is useful as a signal, but weak as a published
accountability source
### Manual per-command metadata in source files
This was also considered and partially existed already via __author__ in
csv2cwms.
Reason not chosen:
- duplicates data across multiple surfaces
- does not scale well across docs, package metadata, and GitHub
ownership
- becomes harder to maintain consistently over time
### CI-only generation
Not chosen.
Reason:
- CODEOWNERS must exist in the repository for GitHub to use it
- committed generated files give deterministic repo state and visible
diffs
- CI is better used to verify sync, not to be the only place generation
happens
## Verification
Verified locally with:
- python scripts\sync_ownership.py
- python scripts\sync_ownership.py --check
- poetry run python -m pytest tests\cli\test_all_commands_help.py
tests\cli\test_update_command.py -q
- python -m sphinx -nW -b html docs docs\_build\html
## Follow-up
This covers pages that already exist. For some of the sub commands they
do not all have dedicated docs yet.1 parent f1b631b commit ba722a1
21 files changed
Lines changed: 442 additions & 0 deletions
File tree
- .github
- workflows
- cwmscli
- _generated
- utils
- docs
- _generated/maintainers
- cli
- scripts
- tests/cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
63 | 90 | | |
64 | 91 | | |
65 | 92 | | |
| |||
71 | 98 | | |
72 | 99 | | |
73 | 100 | | |
| 101 | + | |
74 | 102 | | |
75 | 103 | | |
76 | 104 | | |
77 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
81 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
82 | 116 | | |
83 | 117 | | |
84 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments