Skip to content

Commit 313e172

Browse files
committed
docs: Add initial notes on development guidelines
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent ee97541 commit 313e172

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

DEVELOPERS.md

+91-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,102 @@
11
# Developing guidelines
22

3-
## Development Setup
3+
If you already cloned the repository and you know that you need to deep dive in the code,
4+
here are some guidelines to set up your environment.
5+
6+
7+
## Development environment setup
8+
9+
### Python versions
10+
11+
To manage multiple Python versions on my system, I use [`pyenv`].
12+
See the `pyenv` documentation on how to install and configure the tool.
13+
14+
Install the supported python versions and enable them for this project:
15+
16+
```shell
17+
$ for v in 3.6 3.7 3.8 3.9 3.10; do pyenv install "${v}:latest"; done
18+
$ pyenv versions --bare | xargs pyenv local
19+
```
20+
21+
22+
### Dependencies
23+
24+
This project uses [`poetry`] to manage dependencies and virtual environments.
25+
See `poetry`'s [installation instructions] on how to install `poetry` on your system.
26+
27+
I have opted to use [`pipx`] to install and manage `poerty` itself.
28+
I also use `pipx` to manage other python executables that I want readily available on my system.
29+
30+
Once `poetry` is available on your system, install the development dependencies:
31+
32+
```shell
33+
$ poetry install --with dev,test,coverage,docs --sync
34+
```
35+
36+
A virtual environment will be created automatically by `poetry`.
37+
To enter a shell with the virtual environment loaded use the `shell` command:
38+
39+
```shell
40+
$ poetry shell
41+
```
42+
43+
Note that `poetry` doesn't need you to load the virtual environment.
44+
It will automatically load the virtual environment as you interact with the `poetry` commands.
45+
446

547
## Running Tests
648

49+
The tests are written with the [`pytest`] test framework.
50+
To run the tests invoke `pytest` through `poetry`:
51+
52+
```shell
53+
$ poetry run pytest
54+
```
55+
56+
However, the above will only run the tests for the latest python version.
57+
To test all python versions invoke the test runner [`tox`]:
58+
59+
```shell
60+
$ poetry run tox
61+
```
62+
63+
This works because different python versions were made available through `pyenv`.
64+
65+
766
## Coding Rules
867

68+
Coding style is encoded through the configurations of [`black`] and [`isort`].
69+
To enforce the rules run:
70+
71+
```shell
72+
$ poetry run black src/ tests/ example/
73+
$ poetry run isort src/ tests/ example/
74+
```
75+
76+
Additional rules and suggestions are generated by [`flake8`].
77+
Check your code with:
78+
79+
```shell
80+
$ poetry run flake8 src/
81+
```
82+
83+
984
## Commit Message Guidelines
1085

86+
(TODO)
87+
88+
1189
## Writing Documentation
1290

91+
(TODO)
92+
93+
94+
[`poetry`]: https://python-poetry.org/
95+
[installation instructions]: https://python-poetry.org/docs/#installation
96+
[`pipx`]: https://pypa.github.io/pipx/
97+
[`pyenv`]: https://github.com/pyenv/pyenv
98+
[`pytest`]: https://docs.pytest.org/
99+
[`tox`]: https://tox.wiki/
100+
[`black`]: https://black.readthedocs.io/
101+
[`isort`]: https://pycqa.github.io/isort/
102+
[`flake8`]: https://flake8.pycqa.org/

0 commit comments

Comments
 (0)