Skip to content

Commit bb040bb

Browse files
authored
Tighten docs cross-references (#61)
Refresh the rendered docs so readers can move from install to first command, CLI behavior, API detail, and contributor material through direct links and current examples. - Link rendered docs objects and page references with MyST/Sphinx roles. - Refresh quickstart, contributor, code-style, release, API, and changelog prose. - Add the root `just build-docs` entrypoint used by the required docs gate. Local validation: `rm -rf docs/_build; uv run ruff check . --fix --show-fixes; uv run ruff format .; uv run mypy .; uv run py.test --reruns 0 -vvv; just build-docs;`
2 parents 37b25f0 + 34d7a9c commit bb040bb

10 files changed

Lines changed: 107 additions & 47 deletions

File tree

CHANGES

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
To install the unreleased g version, see [developmental releases](https://g.git-pull.com/quickstart.html#developmental-releases).
3+
To install the unreleased g version, see {ref}`developmental-releases`.
44

55
[pip](https://pip.pypa.io/en/stable/):
66

@@ -12,7 +12,12 @@ $ pip install --user --upgrade --pre g
1212

1313
```console
1414
$ pipx install --suffix=@next 'g' --pip-args '\--pre' --force
15-
// Usage: g@next --help
15+
```
16+
17+
Then use the suffixed command:
18+
19+
```console
20+
$ g@next --help
1621
```
1722

1823
[uv](https://docs.astral.sh/uv/getting-started/features/#python-versions):
@@ -41,7 +46,7 @@ g 0.0.10 turns g's documentation into a usable CLI reference and moves the docs
4146

4247
`g --version` and `g -V` now print g's installed version instead of forwarding those flags to `git`, `svn`, or `hg`. This gives users a direct way to confirm which wrapper version is on `PATH` while keeping the normal proxy behavior unchanged for VCS commands.
4348

44-
The implementation preserves the existing {func}`g.run` test hook: in test mode the version path returns cleanly instead of exiting through `argparse`, so the behavior can be asserted without special subprocess handling.
49+
The implementation preserves the existing {func}`g.run` test hook: in test mode the version path returns cleanly instead of exiting through {mod}`argparse`, so the behavior can be asserted without special subprocess handling.
4550

4651
#### First-party CLI reference page (#46)
4752

@@ -67,6 +72,16 @@ The API page now uses card-style autodoc signatures and badge styling from `sphi
6772
- The manual CLI "Usage" section was renamed to "Usage examples" so it no longer collides with the argparse-generated `usage` anchor (#54).
6873
- Light and dark mode CSS for argparse metadata and header links now handles Furo's automatic theme mode correctly (#46).
6974

75+
### Documentation
76+
77+
#### Clearer paths through the documentation (#61)
78+
79+
The docs now guide readers from install to first command, CLI behavior, or
80+
contributor material without requiring them to understand g's internals first.
81+
Command examples are easier to scan one action at a time, and cross-links from
82+
release notes, API details, and project pages take readers directly to the
83+
matching reference material.
84+
7085
### Development
7186

7287
- Root `conftest.py` remains type-checked while the temporary docs-extension mypy path excludes only the extension-local `docs/_ext/conftest.py` case that caused duplicate module discovery (#46).
@@ -149,13 +164,13 @@ g 0.0.5 fixes the main user-facing failure mode outside a repository. Running `g
149164

150165
### Fixes
151166

152-
#### Running outside a VCS directory no longer raises `AssertionError` (#24)
167+
#### Running outside a VCS directory no longer raises {exc}`AssertionError` (#24)
153168

154169
When no `.git`, `.svn`, or `.hg` marker is found while walking upward from the current directory, g now reports that no VCS was found and returns without trying to spawn a subprocess. The test suite covers the non-repository case directly.
155170

156171
### Development
157172

158-
The CLI test fixtures were rewritten into typed `NamedTuple` records, and the `G_IS_TEST` environment flag remains the path for asserting subprocess behavior without leaking `Popen` objects into user output (#24).
173+
The CLI test fixtures were rewritten into typed {class}`typing.NamedTuple` records, and the `G_IS_TEST` environment flag remains the path for asserting subprocess behavior without leaking {class}`subprocess.Popen` objects into user output (#24).
159174

160175
## g 0.0.4 (2024-03-24)
161176

@@ -177,11 +192,11 @@ Poetry moved from `1.7.1` to `1.8.1`, and the CI helper actions were updated to
177192

178193
## g 0.0.3 (2023-12-09)
179194

180-
g 0.0.3 tightens the development harness around the small CLI wrapper. The release moves more configuration into `pyproject.toml`, strengthens docs and lint expectations, and fixes the visible `Popen` repr that could appear after running `g`.
195+
g 0.0.3 tightens the development harness around the small CLI wrapper. The release moves more configuration into `pyproject.toml`, strengthens docs and lint expectations, and fixes the visible {class}`subprocess.Popen` repr that could appear after running `g`.
181196

182197
### Fixes
183198

184-
#### `g` no longer prints a `Popen` representation after commands (#19)
199+
#### `g` no longer prints a {class}`subprocess.Popen` representation after commands (#19)
185200

186201
{func}`g.run` now returns the subprocess only when `G_IS_TEST` is set. Normal CLI usage no longer appends output such as `<Popen: returncode: 1 args: ['git']>` after the delegated VCS command.
187202

docs/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Internal API
22

3+
Most users do not need this page. Start with {doc}`quickstart` or
4+
{doc}`cli/index` if you only want the command-line wrapper.
5+
36
```{note}
47
These APIs are private and can break between versions. If you want to use them directly, file an issue on the tracker.
58
```

docs/cli/index.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,22 @@ $ g status
3939

4040
Is equivalent to:
4141

42+
In a git repo:
43+
44+
```console
45+
$ git status
46+
```
47+
48+
In an svn repo:
49+
50+
```console
51+
$ svn status
52+
```
53+
54+
In an hg repo:
55+
4256
```console
43-
$ git status # if in a git repo
44-
$ svn status # if in an svn repo
45-
$ hg status # if in an hg repo
57+
$ hg status
4658
```
4759

4860
(cli-main)=
@@ -60,8 +72,17 @@ $ hg status # if in an hg repo
6072

6173
```console
6274
$ g status
75+
```
76+
77+
```console
6378
$ g commit -m "Fix bug"
79+
```
80+
81+
```console
6482
$ g log --oneline -10
83+
```
84+
85+
```console
6586
$ g diff HEAD~1
6687
```
6788

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"sphinx_autodoc_argparse.exemplar",
3737
],
3838
intersphinx_mapping={
39-
"py": ("https://docs.python.org/", None),
40-
"libvcs": ("http://libvcs.git-pull.com/", None),
39+
"py": ("https://docs.python.org/3/", None),
40+
"libvcs": ("https://libvcs.git-pull.com/", None),
4141
},
4242
linkcode_resolve=make_linkcode_resolve(g, about["__github__"]),
4343
html_favicon="_static/favicon.ico",

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ pip install --user g
3737
$ uv tool install g
3838
```
3939

40-
See [Quickstart](quickstart.md) for all installation methods and first steps.
40+
See {doc}`quickstart` for all installation methods and first steps.
4141

4242
## At a glance
4343

docs/project/code-style.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
# Code Style
22

3+
Use this page when you are changing g itself and want the same local checks CI
4+
expects.
5+
36
## Formatting
47

58
g uses [ruff](https://github.com/astral-sh/ruff) for linting and formatting.
69

710
```console
8-
$ uv run ruff format .
11+
$ uv run ruff check . --fix
912
```
1013

1114
```console
12-
$ uv run ruff check . --fix
15+
$ uv run ruff format .
1316
```
1417

1518
## Type Checking
1619

1720
[mypy](https://mypy-lang.org/) is used for static type checking.
1821

1922
```console
20-
$ uv run mypy
23+
$ uv run mypy .
2124
```

docs/project/contributing.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Development
22

3-
[uv] is a required package to develop.
3+
Use this page when you want to change g itself. If you only want to install and
4+
run the command, start with {doc}`/quickstart`.
45

56
## Bootstrap the project
67

7-
Install and [git] and [uv]
8+
Install [git] and [uv].
89

910
Clone:
1011

@@ -27,9 +28,15 @@ $ uv sync --all-extras --dev
2728

2829
## Tests
2930

30-
`uv run py.test`
31+
```console
32+
$ uv run py.test
33+
```
34+
35+
The Makefile wrapper runs the same test command.
3136

32-
Helpers: `make test`
37+
```console
38+
$ make test
39+
```
3340

3441
## Automatically run tests on file save
3542

@@ -42,14 +49,15 @@ Helpers: `make test`
4249

4350
Default preview server: http://localhost:8034
4451

45-
[sphinx-autobuild] will automatically build the docs, watch for file changes and launch a server.
52+
[sphinx-autobuild] builds the docs, watches for file changes, and launches a
53+
server.
4654

4755
From home directory: `make start_docs`
4856
From inside `docs/`: `make start`
4957

5058
[sphinx-autobuild]: https://github.com/executablebooks/sphinx-autobuild
5159

52-
### Manual documentation (the hard way)
60+
### Manual documentation
5361

5462
`cd docs/` and `make html` to build. `make serve` to start http server.
5563

@@ -72,10 +80,10 @@ The project uses [ruff] to handle formatting, sorting imports and linting.
7280
uv:
7381
7482
```console
75-
$ uv run ruff
83+
$ uv run ruff check .
7684
```
7785
78-
If you setup manually:
86+
If you set up manually:
7987
8088
```console
8189
$ ruff check .
@@ -109,7 +117,7 @@ uv:
109117
$ uv run ruff check . --fix
110118
```
111119
112-
If you setup manually:
120+
If you set up manually:
113121
114122
```console
115123
$ ruff check . --fix
@@ -119,7 +127,7 @@ $ ruff check . --fix
119127

120128
#### ruff format
121129

122-
[ruff format] is used for formatting.
130+
Use [ruff format] for formatting.
123131

124132
````{tab} Command
125133
@@ -129,7 +137,7 @@ uv:
129137
$ uv run ruff format .
130138
```
131139
132-
If you setup manually:
140+
If you set up manually:
133141
134142
```console
135143
$ ruff format .
@@ -147,7 +155,7 @@ $ make ruff_format
147155

148156
### mypy
149157

150-
[mypy] is used for static type checking.
158+
Use [mypy] for static type checking.
151159

152160
````{tab} Command
153161
@@ -157,7 +165,7 @@ uv:
157165
$ uv run mypy .
158166
```
159167
160-
If you setup manually:
168+
If you set up manually:
161169
162170
```console
163171
$ mypy .
@@ -185,14 +193,9 @@ requires [`entr(1)`].
185193
## Releasing
186194

187195
[uv] handles virtualenv creation, package requirements, versioning,
188-
building, and publishing. Therefore there is no setup.py or requirements files.
189-
190-
Update `__version__` in `__about__.py` and `pyproject.toml`::
196+
building, and publishing. There is no `setup.py` or requirements file.
191197

192-
git commit -m 'build(g): Tag v0.1.1'
193-
git tag v0.1.1
194-
git push
195-
git push --tags
198+
See {doc}`/project/releasing` before preparing a release.
196199

197200
[uv]: https://github.com/astral-sh/uv
198201
[entr(1)]: http://eradman.com/entrproject/

docs/project/releasing.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@
22

33
## Release Process
44

5-
Releases are triggered by git tags and published to PyPI via OIDC trusted publishing.
5+
Use this page when you are preparing a g release. Tags trigger publishing to
6+
PyPI via OIDC trusted publishing, so create and push them only when you intend
7+
to publish.
68

79
1. Update `CHANGES` with the release notes
810

9-
2. Bump version in `src/g/__about__.py` (or wherever version is defined -- check pyproject.toml)
11+
2. Bump the version in `src/g/__about__.py` and `pyproject.toml`
1012

11-
3. Tag:
13+
3. Commit the release files with the subject `Tag v<version>`
14+
15+
4. Tag:
1216

1317
```console
1418
$ git tag v<version>
1519
```
1620

17-
4. Push:
21+
5. Push the branch and tag:
1822

1923
```console
2024
$ git push && git push --tags
2125
```
2226

23-
5. CI builds and publishes to PyPI automatically
27+
6. CI builds and publishes to PyPI automatically
28+
29+
For AI agents: do not create or push tags unless the user explicitly asks.
30+
Prepare the release files and commit only.

docs/quickstart.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
## Installation
66

7-
For latest official version:
7+
Install g once, then run `g` where you already run `git`, `svn`, or `hg`.
8+
Use one of these commands for the latest official version.
89

910
```console
1011
$ pip install --user g
1112
```
1213

13-
Or install with [uv](https://docs.astral.sh/uv/):
14+
Or install it as a [uv] tool:
1415

1516
```console
1617
$ uv tool install g
@@ -28,13 +29,13 @@ Run g once without installing globally:
2829
$ uvx g
2930
```
3031

31-
Upgrading:
32+
Upgrade an existing install the same way.
3233

3334
```console
3435
$ pip install --user --upgrade g
3536
```
3637

37-
Or with uv:
38+
With [uv]:
3839

3940
```console
4041
$ uv tool upgrade g
@@ -62,7 +63,12 @@ In their versions you will see notification like `a1`, `b1`, and `rc1`, respecti
6263

6364
```console
6465
$ pipx install --suffix=@next 'g' --pip-args '\--pre' --force
65-
// Usage: g@next --help
66+
```
67+
68+
Then use the suffixed command:
69+
70+
```console
71+
$ g@next --help
6672
```
6773

6874
- [uv tool install][uv-tools]\:
@@ -83,7 +89,7 @@ In their versions you will see notification like `a1`, `b1`, and `rc1`, respecti
8389
$ uvx --from 'g' --prerelease allow g
8490
```
8591

86-
via trunk (can break easily):
92+
For unreleased trunk builds, expect breakage:
8793

8894
- [pip]\:
8995

justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build-docs:
2+
just -f docs/justfile html

0 commit comments

Comments
 (0)