You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a template repository for any Python project that comes with the following dev tools:
4
+
5
+
* black: auto-formats code
6
+
* isort: sorts the imports
7
+
* flake8: looks for common errors
8
+
* pyupgrade: upgrades Python syntax
9
+
10
+
All of those checks are run as pre-commit hooks using the `pre-commit` library.
11
+
12
+
It includes `pytest` for testing plus the `pytest-cov` plugin to measure coverage.
13
+
14
+
The checks and tests are all run using Github actions on every pull request and merge to main.
15
+
16
+
This repository is setup for Python 3.10. To customize that, change the `VARIANT` argument in `.devcontainer/devcontainer.json`, and change the flag passed into `pyupgrade` in `.precommit-config.yaml` and `.github/workflows/python.yaml`.
17
+
18
+
## Development instructions
19
+
20
+
## With devcontainer
21
+
22
+
This repository comes with a devcontainer (a Dockerized Python environment). If you open it in Codespaces, it should automatically initialize the devcontainer.
23
+
24
+
Locally, you can open it in VS Code with the Dev Containers extension installed.
25
+
26
+
## Without devcontainer
27
+
28
+
If you can't or don't want to use the devcontainer, then you should first create a virtual environment:
29
+
30
+
```
31
+
python3 -m venv .venv
32
+
source .venv/bin/activate
33
+
```
34
+
35
+
Then install the dev tools and pre-commit hooks:
36
+
37
+
```
38
+
pip3 install --user -r requirements-dev.txt
39
+
pre-commit install
40
+
```
41
+
42
+
## Adding code and tests
43
+
44
+
This repository starts with a very simple `main.py` and a test for it at `tests/main_test.py`.
45
+
You'll want to replace that with your own code, and you'll probably want to add additional files
46
+
as your code grows in complexity.
47
+
48
+
When you're ready to run tests, just run:
49
+
50
+
```
51
+
pytest
52
+
```
53
+
54
+
### 🔎 Found an issue or have an idea for improvement?
55
+
56
+
Help me make this template repository better by letting us know and opening an issue!
0 commit comments