Skip to content

Commit 94cf8fd

Browse files
committed
docs(developing): Overhaul dev docs
1 parent 69a753c commit 94cf8fd

File tree

1 file changed

+127
-26
lines changed

1 file changed

+127
-26
lines changed

docs/developing.md

+127-26
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
[poetry] is a required package to develop.
44

5-
`git clone https://github.com/tmux-python/libtmux.git`
5+
```console
6+
$ git clone https://github.com/tmux-python/libtmux.git
7+
```
68

7-
`cd libtmux`
9+
```console
10+
$ cd libtmux
11+
```
812

9-
`poetry install -E "docs test coverage lint format"`
13+
```console
14+
$ poetry install -E "docs test coverage lint format"
15+
```
1016

1117
Makefile commands prefixed with `watch_` will watch files and rerun.
1218

@@ -21,23 +27,122 @@ Rerun tests on file change: `make watch_test` (requires [entr(1)])
2127

2228
Default preview server: http://localhost:8023
2329

30+
[sphinx-autobuild] will automatically build the docs, watch for file changes and launch a server.
31+
32+
From home directory: `make start_docs` From inside `docs/`: `make start`
33+
34+
[sphinx-autobuild]: https://github.com/executablebooks/sphinx-autobuild
35+
36+
### Manual documentation (the hard way)
37+
2438
`cd docs/` and `make html` to build. `make serve` to start http server.
2539

26-
Helpers:
27-
`make build_docs`, `make serve_docs`
40+
Helpers: `make build_docs`, `make serve_docs`
2841

2942
Rebuild docs on file change: `make watch_docs` (requires [entr(1)])
3043

31-
Rebuild docs and run server via one terminal: `make dev_docs` (requires above, and a
32-
`make(1)` with `-J` support, e.g. GNU Make)
44+
Rebuild docs and run server via one terminal: `make dev_docs` (requires above, and a `make(1)` with
45+
`-J` support, e.g. GNU Make)
46+
47+
## Formatting
48+
49+
The project uses [black] and [isort] (one after the other). Configurations are in `pyproject.toml`
50+
and `setup.cfg`:
51+
52+
- `make black isort`: Run `black` first, then `isort` to handle import nuances
53+
54+
## Linting
55+
56+
[flake8] and [mypy] run via CI in our GitHub Actions. See the configuration in `pyproject.toml` and
57+
`setup.cfg`.
58+
59+
### flake8
60+
61+
[flake8] provides fast, reliable, barebones styling and linting.
62+
63+
````{tab} Command
64+
65+
poetry:
66+
67+
```console
68+
$ poetry run flake8
69+
```
70+
71+
If you setup manually:
72+
73+
```console
74+
$ flake8
75+
```
76+
77+
````
78+
79+
````{tab} make
80+
81+
```console
82+
$ make flake8
83+
```
84+
85+
````
86+
87+
````{tab} Watch
88+
89+
```console
90+
$ make watch_flake8
91+
```
92+
93+
requires [`entr(1)`].
3394
34-
## Formatting / Linting
95+
````
3596

36-
The project uses [black] and [isort] (one after the other) and runs [flake8] via
37-
CI. See the configuration in `pyproject.toml` and `setup.cfg`:
97+
````{tab} Configuration
3898
39-
`make black isort`: Run `black` first, then `isort` to handle import nuances
40-
`make flake8`, to watch (requires `entr(1)`): `make watch_flake8`
99+
See `[flake8]` in setup.cfg.
100+
101+
```{literalinclude} ../setup.cfg
102+
:language: ini
103+
:start-at: "[flake8]"
104+
:end-before: "[isort]"
105+
106+
```
107+
108+
````
109+
110+
### mypy
111+
112+
[mypy] is used for static type checking.
113+
114+
````{tab} Command
115+
116+
poetry:
117+
118+
```console
119+
$ poetry run mypy .
120+
```
121+
122+
If you setup manually:
123+
124+
```console
125+
$ mypy .
126+
```
127+
128+
````
129+
130+
````{tab} make
131+
132+
```console
133+
$ make mypy
134+
```
135+
136+
````
137+
138+
````{tab} Watch
139+
140+
```console
141+
$ make watch_mypy
142+
```
143+
144+
requires [`entr(1)`].
145+
````
41146

42147
## Releasing
43148

@@ -68,23 +173,18 @@ the top::
68173

69174
`libtmux/__init__.py` and `__about__.py` - Set version
70175

71-
`git commit -m 'Tag v0.9.1'`
72-
73-
`git tag v0.9.1`
74-
75-
`pip install wheel twine`
76-
77-
`python setup.py sdist bdist_wheel`
78-
79-
`twine upload dist/*`
80-
81-
### Twine
176+
```console
177+
$ git commit -m 'Tag v0.9.1'
178+
```
82179

83-
`twine upload dist/*`
180+
```console
181+
$ git tag v0.9.1
182+
```
84183

85-
You will be asked for PyPI login information.
184+
After `git push` and `git push --tags`, CI will automatically build and deploy
185+
to PyPI.
86186

87-
### Releasing with Poetry (hypothetical)
187+
### Releasing with Poetry (manual)
88188

89189
This isn't used yet since package maintainers may want setup.py in the source.
90190
See https://github.com/tmux-python/tmuxp/issues/625.
@@ -107,3 +207,4 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
107207
[black]: https://github.com/psf/black
108208
[isort]: https://pypi.org/project/isort/
109209
[flake8]: https://flake8.pycqa.org/
210+
[mypy]: http://mypy-lang.org/

0 commit comments

Comments
 (0)