Spend less time setting up and configuring your new Python packages and comply with the Netherlands eScience Center Software Development Guide from the start.
Use this Cookiecutter template to generate an empty Python package. Features include:
Boilerplate tests and documentation,
Open source software license,
Default Github actions for building, testing and deployment
Code style checking,
The file structure of the generated package looks like:
path/to/package/ ├── .editorconfig └── .github/ └── workflows ├── build.yml └── pypi_deploy.yml ├── .gitignore ├── .prospector.yml ├── CHANGELOG.rst ├── CODE_OF_CONDUCT.rst ├── CONTRIBUTING.rst ├── docs │ ├── conf.py │ ├── index.rst │ └── ... ├── LICENSE ├── MANIFEST.in ├── NOTICE ├── package │ ├── __init__.py │ ├── __version__.py │ └── package.py ├── README.rst ├── project_setup.rst ├── requirements.txt ├── setup.cfg ├── setup.py └── tests ├── __init__.py ├── test_lint.py └── test_package.py
path/to/package/package/(please choose a better name for your software!).
We recommend developing your software in an isolated Python environment and assume you are familiar with either virtualenv + pip or conda (check the guide if you are not).
We recommend installing cookiecutter outside the virtual environment you will be using for developing your software. This way, you don't have to install cookiecutter for every new project.
If you are using virtualenv + pip:
pip install --user cookiecutter
If you are using conda:
conda install -c conda-forge cookiecutter
To create a new package, type:
You will be asked to supply the following information:
|project_name||My Python Project||Full project/package name.|
|project_slug||my_python_project||This will be the name of the directory to be created and the git repository. It is safest not to use dashes (-) or spaces in this name.|
|project_short_description||The information that you enter here will end up in the README, documentation, license, and setup.py, so it may be a good idea to prepare something in advance.|
|github_organization||GitHub organization that will contain this project's repository. This can also be your github user name.|
|open_source_license||Apache 2.0 (1)||The software license under which the code is made available.|
|apidoc||no (1)||Add support for automatically generating a module index from the
|full_name||John Smith||Your full name, e.g. John Smith.|
|firstname.lastname@example.org||Your (work) email address|
|copyright_holder||Name(s) of the organization(s) or person(s) who hold the copyright of the software (e.g., Netherlands eScience Center).|
|email@example.com||Email address of the person who should be contacted in case of violations of the Code of Conduct.|
$ virtualenv -p python3 env $ . env/bin/activate
$ conda create -n env python=3 $ source activate env
(On windows use
activate env to activate the conda environment.)
The template has two Ci workflows. They can be found in .github/workflows folder.
This workflow install the dependencies, builds the package and runs tests.
You can learn more about Python packaging at this link.
Suggestions/improvements/edits are most welcome. Please read the contribution guidelines before creating an issue or a pull request.