2
2
3
3
[ poetry] is a required package to develop.
4
4
5
- ` git clone https://github.com/tmux-python/libtmux.git `
5
+ ``` console
6
+ $ git clone https://github.com/tmux-python/libtmux.git
7
+ ```
6
8
7
- ` cd libtmux `
9
+ ``` console
10
+ $ cd libtmux
11
+ ```
8
12
9
- ` poetry install -E "docs test coverage lint format" `
13
+ ``` console
14
+ $ poetry install -E " docs test coverage lint format"
15
+ ```
10
16
11
17
Makefile commands prefixed with ` watch_ ` will watch files and rerun.
12
18
@@ -21,23 +27,122 @@ Rerun tests on file change: `make watch_test` (requires [entr(1)])
21
27
22
28
Default preview server: http://localhost:8023
23
29
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
+
24
38
` cd docs/ ` and ` make html ` to build. ` make serve ` to start http server.
25
39
26
- Helpers:
27
- ` make build_docs ` , ` make serve_docs `
40
+ Helpers: ` make build_docs ` , ` make serve_docs `
28
41
29
42
Rebuild docs on file change: ` make watch_docs ` (requires [ entr(1)] )
30
43
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)`].
33
94
34
- ## Formatting / Linting
95
+ ````
35
96
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
38
98
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
+ ````
41
146
42
147
## Releasing
43
148
@@ -68,23 +173,18 @@ the top::
68
173
69
174
` libtmux/__init__.py ` and ` __about__.py ` - Set version
70
175
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
+ ```
82
179
83
- ` twine upload dist/* `
180
+ ``` console
181
+ $ git tag v0.9.1
182
+ ```
84
183
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.
86
186
87
- ### Releasing with Poetry (hypothetical )
187
+ ### Releasing with Poetry (manual )
88
188
89
189
This isn't used yet since package maintainers may want setup.py in the source.
90
190
See https://github.com/tmux-python/tmuxp/issues/625 .
@@ -107,3 +207,4 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
107
207
[ black ] : https://github.com/psf/black
108
208
[ isort ] : https://pypi.org/project/isort/
109
209
[ flake8 ] : https://flake8.pycqa.org/
210
+ [ mypy ] : http://mypy-lang.org/
0 commit comments