Contributing¶
This project is based on Geronimo-iaa's Python Template. This is a cookiecutter template for a typical Python library following modern packaging conventions. It utilizes popular libraries alongside Make and Graphviz to fully automate all development and deployment tasks.
Setup¶
Requirements¶
-
Make:
- macOS:
$ xcode-select --install
- Linux: https://www.gnu.org/software/make
- Windows: https://mingw.org/download/installer
- macOS:
Pyenv will manage all our python version.
- Python:
$ pyenv install 3.7.3
Note for MacOS 10.14 user:
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 pyenv install 3.7.3
Poetry will manage our dependencies and create our virtual environment for us.
- Graphviz:
- macOS:
$ brew install graphviz
- Linux: https://graphviz.org/download
- Windows: https://graphviz.org/download Needed to generate UML documentation
- macOS:
To confirm these system dependencies are configured correctly:
$ make doctor
Installation¶
Install project dependencies into a virtual environment:
$ make install
Note:
- this target create a dummy file .install
. The makefile rule depends on pyproject.toml and
poetry.lock file
- if for whatever reason, you have to force installation, just remove this .install
file and
execute a make install
Development Tasks¶
Manual¶
Run the tests:
$ make test
Run static analysis:
$ make check
Build the documentation:
$ make docs
Automatic¶
Keep all of the above tasks running on change:
$ make watch
In order to have OS X notifications,
brew install terminal-notifier
.
Integration With Visual Studio Code¶
Even if we use fabulous tool like pyenv, poetry, ... at the end, we just want to go on, and code.
So here, few detail of my installation.
-
.bashrc
# init pyenv with default python version if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi # add poetry in path export PATH="$HOME/.poetry/bin:$PATH" # Add Visual Studio Code (code) export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
-
poetry configuration: all is let with default
As now, i cannot have a working system with 'settings.virtualenvs.in-project' set to true or 'settings.virtualenvs.path' setted with a custom path.settings.virtualenvs.create = true settings.virtualenvs.in-project = false settings.virtualenvs.path = "/Users/xxxx/Library/Caches/pypoetry/virtualenvs" repositories = {}
-
How Launch Visual Studio Code within virtual environment created by poetry ? After do a
make install
, you have to do:poetry shell code .
poetry shell
will activate project virtual environment.
Continuous Integration¶
The CI server will report overall build status:
$ make ci
Release Tasks¶
Release to PyPI:
$ make upload