A template for Python projects
Project description
A template for Python projects
The purpose of this project is just to suggest a layout for Python projects including:
- source code
- tests
- deployment
Distribution
I have followed the tutorial provided here to configure the package deployment and installation. This is using the setuptools library.
Make sure to have the latest version of setuptools:
conda install setuptools wheel
pip install --upgrade setuptools wheel
The version, build and commit identifier are automatically collected when running the setup.py
module. It is
assumed that the project is using git as revision control system.
To install the package from the source tree, you can simply use pip:
pip install .
Or you can install the package such as Python looks into your source tree for the latest version:
pip install --editable .
To generate distributions:
python setup.py sdist bdist_wheel
The full list of classifiers can be found here.
Upload to Python Package Index
This package is uploaded into Test PyPi, the procedure is the following one:
Make sure to create an account by going there.
Then generate an API token from the account settings of Test PyPi.
Store the Token API into the $HOME/.pypirc
configuration file:
[testpypi]
username = __token__
password = pypi-...
Then make sure you have twine
installed:
conda install twine
pip install --upgrade twine
Build the distribution packages you want to upload:
python setup.py sdist bdist_wheel
Tests
I use pytest for testing, the test cases are collected into the tests
folder.
To run the tests from the source tree
PYTHONPATH=./src:${PYTHONPATH} pytests ./tests
If instead you want to run tests for the installed version:
pytests ./tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mylib_template-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb885e021045db7b76f68cf4b0476da23f822d83c404e893570ee6297d1475ca |
|
MD5 | 8d1dc2018be5a63fd0bc2982b3d9a0e0 |
|
BLAKE2b-256 | 718fa7f69353199b8ec64ae9b0008d0b6a41dcefa12c904cafd75bc96011d2d8 |