Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

Commit 17c967b

Browse files
authored
readme complete 1st draft
1 parent 96ab39a commit 17c967b

1 file changed

Lines changed: 56 additions & 6 deletions

File tree

README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ black makes sure the flake8 checks pass by autoformatting all the .py files.
7373
Quotting the the [black documentation](https://black.readthedocs.io/en/stable/?badge=stable) directly:
7474
*"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."*
7575

76+
Black is part of the requirements.dev.txt file and can be installed with pip.
7677
To format a directory with black run the terminal command:
7778
`black examplepackage` or file.py etc.
7879

@@ -83,11 +84,24 @@ Some IDEs have format on save features and can be configured to use black:
8384

8485
## pydocstyle
8586
[pydocstyle](http://www.pydocstyle.org/en/stable/) is a static analysis tool for checking compliance with Python docstring conventions.
86-
By using pydocstyle we make sure that all modules and functions have consistent and good documentation.
87+
By using pydocstyle we make sure that all modules and functions have consistent and good documentation.
88+
89+
pydocstyle is part of the requirements.dev.txt file and can be installed with pip.
90+
To run a pydocstyle check you simply execute the terminal command:
91+
`pydocstyle examplepackage` *or any other dir that contains python files*
92+
93+
You can configure pydocstyle by adding a section for it in the [setup.cfg](setup.cfg) file. For this template we're using the numpy documentation convention and we're choosing to ignore some specific standards (e.g. D400 - docstring should be in imperative mood)
8794

8895
## pytest
89-
*[insert description]*
96+
Quotting the the [pytest documentation](https://docs.pytest.org/en/6.2.x/index.html) directly:
97+
*"The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries."*
98+
99+
The tests for the package live in the [examplepackage/tests](examplepackage/tests) directory. Files in the main directory and its subdirectories that start with test_ and end with .py are recognised by pytest as test containing files (more rules for discovery [here](https://docs.pytest.org/en/6.2.x/goodpractices.html#conventions-for-python-test-discovery)).
90100

101+
pytest is part of the requirements.dev.txt file and can be installed with pip.
102+
To run a pytest check you simply execute the terminal command:
103+
`pytest examplepackage` *or any other dir that contains python files*
104+
91105
## Sphinx documentation
92106
[Sphinx](https://www.sphinx-doc.org/en/master/) is a tool that makes it easy to create intelligent and beautiful documentation.
93107
The [docs/](docs) diretory is where the configuration for sphinx lives. The dependencies for the docs are in [docs/requiremetns.txt](docs/requiremetns.txt).
@@ -110,10 +124,41 @@ The build directory that contains the html version of the docs is in the .gitign
110124
Sphinx has many functionalities so for more details read the official documentation.
111125

112126
## setup.cfg
113-
*[insert description]*
127+
[setup.cfg](setup.cfg) has many roles, for this template we're using it to configure things like flake8 and pydocstyle.
128+
129+
example syntax:
130+
```python
131+
[flake8]
132+
# inline with Black code formatter
133+
max-line-length = 88
134+
```
135+
136+
More details:
137+
* https://docs.python.org/3/distutils/configfile.html
138+
* https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html
114139

115140
## setup.py
116-
*[insert description]*
141+
[setup.py](setup.py) is what makes the package here pip-installable. We also add the package dependencies there (e.g. pandas==1.0).
142+
Here is the a simple setup.py:
143+
```python
144+
from setuptools import setup, find_packages
145+
146+
setup(
147+
name="examplepackage",
148+
version="x.x",
149+
packages=find_packages(),
150+
description="package description",
151+
author="author name",
152+
install_requires=[
153+
"numpy>=1.0",
154+
"pandas==1.0",
155+
],
156+
)
157+
```
158+
159+
More details on the setupscript:
160+
* https://docs.python.org/3/distutils/setupscript.html
161+
* https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html
117162

118163
## Installing a package in Development mode
119164
`pip install -e .` or `pip install --editable .` installs the package in editable (development) mode.
@@ -125,8 +170,7 @@ Usefull links:
125170
## .gitignore
126171
The title is pretty self explanatory.
127172

128-
.gitignore is a file where you can add files and directories that you want git to ignore. The [.gitignore](.gitignore) in this template has the typical content.
129-
e.g. .venv, the directory that contains the python virtual environment, should not be push to github and is in .gitignore.
173+
.gitignore is a file where you can add files and directories that you want git to ignore. The [.gitignore](.gitignore) in this template has the typical content. For example .venv, the directory that contains the python virtual environment, should not be push to github and is in .gitignore.
130174

131175
## Github Actions
132176
From the official https://github.com/features/actions page:
@@ -139,6 +183,12 @@ This runs the following actions for every pull-request and every push to merge:
139183
3. build and test (with pytest) for all the combinations of the chosen operating systems and python versions.
140184
e.g. macos-latest and python 3.7, 3.8
141185

186+
With this configuration, reviewers can instantly spot whether the code meets the minimum standards and passes the tests:
187+
![image](https://user-images.githubusercontent.com/64217214/133000246-0239d1d5-eb8c-49d6-9479-ad7db96d9d36.png)
188+
189+
Github Actions and Azure pipelines have many similarities, read more here:
190+
https://docs.microsoft.com/en-us/dotnet/architecture/devops-for-aspnet-developers/actions-vs-pipelines
191+
142192
## Licences
143193
Details about the mainstream OSS (Open source software) licences can be found here:
144194
https://opensource.org

0 commit comments

Comments
 (0)