Skip to content

Commit 249a5a9

Browse files
committed
docs(developing): Overhaul dev docs
1 parent 69a753c commit 249a5a9

File tree

1 file changed

+117
-12
lines changed

1 file changed

+117
-12
lines changed

docs/developing.md

+117-12
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)`].
94+
95+
````
96+
97+
````{tab} Configuration
98+
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+
````
33137

34-
## Formatting / Linting
138+
````{tab} Watch
35139
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`:
140+
```console
141+
$ make watch_mypy
142+
```
38143
39-
`make black isort`: Run `black` first, then `isort` to handle import nuances
40-
`make flake8`, to watch (requires `entr(1)`): `make watch_flake8`
144+
requires [`entr(1)`].
145+
````
41146

42147
## Releasing
43148

0 commit comments

Comments
 (0)