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
{{ message }}
This repository was archived by the owner on May 26, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ A python project template for educational purposes
17
17
**venv** stands for virtual environment and is part of the python standard library (i.e. you don't have to install it).
18
18
Python virtual environments' role is to create an isolated python environment for each project so that there are no dependency issues etc. from conflicting project requirements (e.g. Project A need pandas 1.0 and Project B needs pandas 1.1).
19
19
20
-
The command `python -m venv .venv` creates a directory call .venv.
20
+
The terminal command `python -m venv .venv` creates a directory call .venv.
21
21
You can activate the virtual environment with `source .venv/bin/activate`.
22
22
23
23
To enable the new venv in jupyter notebooks follow the instructions here:
@@ -37,32 +37,50 @@ For this project we have 3 files where the requirements are stored:
37
37
*[docs/requirements.txt](docs/requirements.txt) has the dependencies for building the documentation.
38
38
*[setup.py](setup.py) has the **examplepackage** dependencies as part of the `install_requires` parameter of the `setup` function. More info in the dedicated section below.
39
39
40
-
The command `pip installs -r requirements.txt` install requirements from the specified file.
40
+
The terminal command `pip installs -r requirements.txt` install requirements from the specified file.
41
41
42
42
Alternatives to using requirements.txt files are conda enviroment yaml files (if you choose to use a conda env that is):
flake8 checks if the code is uggly according to [PEP8](https://www.python.org/dev/peps/pep-0008/).
50
+
46
51
Quotting the the [flake8 documentation](https://flake8.pycqa.org/en/latest/manpage.html) directly:
47
-
*flake8 is a command-line utility for enforcing style consistency across Python projects. By default it includes lint checks provided by the PyFlakes project, PEP-0008 inspired style checks provided by the PyCodeStyle project, and McCabe complexity checking provided by the McCabe project. It will also run third-party extensions if they are found and installed.*
52
+
*"flake8 is a command-line utility for enforcing style consistency across Python projects. By default it includes lint checks provided by the PyFlakes project, PEP-0008 inspired style checks provided by the PyCodeStyle project, and McCabe complexity checking provided by the McCabe project. It will also run third-party extensions if they are found and installed."*
48
53
49
-
In summary, flake8 checks if the code is uggly according to [PEP8](https://www.python.org/dev/peps/pep-0008/).
50
54
flake8 is part of the requirements.dev.txt file and can be installed with pip.
51
-
To run a flake8 check you simply execute the command:
55
+
To run a flake8 check you simply execute the terminal command:
52
56
`flake8 examplepackage`*or any other dir that contains python files*
53
57
54
-
You can configure flake8 by adding a section for flake8 in the setup.cfg[setup.cfg] file. For example you can choose to instruct flake8 to ignore certain errors or change the default line length.
58
+
You can configure flake8 by adding a section for flake8 in the [setup.cfg](setup.cfg) file. For example you can choose to instruct flake8 to ignore certain errors or change the default line length.
55
59
56
60
## black
61
+
black makes sure the flake8 checks pass by autoformatting all the .py files.
62
+
63
+
Quotting the the [black documentation](https://black.readthedocs.io/en/stable/?badge=stable) directly:
64
+
*"Black makes code review faster by producing the smallest diffs possible. Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead."*
65
+
66
+
To format a directory with black run the terminal command:
67
+
`black examplepackage` or file.py etc.
68
+
69
+
Black (like flake8) is configurable but through a .toml file (not setup.cfg) that is currently excluded from this template.
70
+
71
+
Some IDEs have format on save features and can be configured to use black:
72
+
* Visual studio code: https://dev.to/adamlombard/how-to-use-the-black-python-code-formatter-in-vscode-3lo0
73
+
74
+
## pydocstyle
57
75
*[insert description]*
58
76
59
77
## pytest
60
78
*[insert description]*
61
79
62
-
## setup.py
80
+
## setup.cfg
63
81
*[insert description]*
64
82
65
-
## setup.cfg
83
+
## setup.py
66
84
*[insert description]*
67
85
68
86
## Installing a package in Development mode
@@ -71,9 +89,6 @@ You can configure flake8 by adding a section for flake8 in the setup.cfg[setup.c
0 commit comments