Bootstraps a python project.
Project description
Tool that helps in the creation of python projects.
Quick Start
- Install via executable, pip, or local development
- Run the executable
Overview
PythonProjectBootstrapper
creates a python project that adheres to modern best practices for python package development. It also generates Continuous Integration / Delivery / Deployment workflows that maximize the free functionality offered by GitHub for open-source solutions.
Functionality Provided in Generated Projects
- Simple local development through
Build.py
(see Local Development for more information) - Python bootstrapping via PythonBootstrapper
- Source code formatting via black
- Static source analysis via pylint
- Test execution via pytest
- Code coverage extraction via coverage
- Semantic version generation via AutoGitSemVer
- Python wheel creation
- Wheel deployment to PyPi
- Executable generation via cx_Freeze
- Full Continuous Integration, Continuous Delivery, and Continuous Deployment (via GitHub Actions) for everything listed above
- [Optional] Build artifact signing via Minisign
- [Optional] Participation in the Open Source Security Foundation (OpenSSF) Best Practices Badge Program
- [Optional] Generation of development environment docker images in support of FAIR principles
Project Content Customization
Please see DEVELOPMENT.md for information on the generated content and how to make common modifications to that content.
How to use PythonProjectBootstrapper
Running the Executable
From a terminal window, run one of the commands below. You will be asked a series of questions when generating a python project, then guided through configuration activities to ensure that the project is ready for use.
Scenario | Command Line | Output |
---|---|---|
Create a project for a python package | PythonProjectBootstrapper package <output_dir> |
┌──────────────────────────────────────────────────────────────────────────────── Python Package ─────────────────────────────────────────────────────────────────────────────────┐ │ │ │ This project creates a Python package hosted on GitHub that uploads a Python wheel to PyPi. It also includes opt-in functionality to create docker images that ensure the exact │ │ reproducibility of all commits (which is especially useful for scientific software). │ │ │ │ If you continue, you will be asked a series of questions about your project and given step-by-step instructions on how to set up your project so that it works with 3rd party │ │ solutions (GitHub, PyPi, etc.). │ │ │ │ The entire process should take about 20 minutes to complete. │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Enter 'yes' to continue or 'no' to exit: |
Display Help | PythonProjectBootstrapper --help |
Usage: PythonProjectBootstrapper [OPTIONS] PROJECT:{package} OUTPUT_DIR ┌─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ * project PROJECT:{package} Project to build. [default: None] [required] │ │ * output_dir DIRECTORY Directory to populate. [default: None] [required] │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ┌─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ --configuration-filename FILE Filename that contains template configuration values; see │ │ https://cookiecutter.readthedocs.io/en/stable/advanced/user_config.html for more info. │ │ [default: None] │ │ --replay Do not prompt for input, instead read from saved json. │ │ --yes Answer yes to all prompts. │ │ --version Display the current version and exit. │ │ --install-completion [bash|zsh|fish|powershell|pwsh] Install completion for the specified shell. [default: None] │ │ --show-completion [bash|zsh|fish|powershell|pwsh] Show completion for the specified shell, to copy it or customize the installation. [default: None] │ │ --help Show this message and exit. │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
Version | PythonProjectBootstrapper --version |
PythonProjectBootstrapper v0.2.0 |
Installation via Executable
Download an executable for Linux, MacOS, or Windows to use the functionality provided by this repository without a dependency on Python.
- Download the archive for the latest release here; the files will begin with
exe.
and contain the name of your operating system. - Decompress the archive
Installation via pip
Install the PythonProjectBootstrapper package via pip (Package Installer for Python) to use it with your python code.
pip install PythonProjectBootstrapper
Local Development
Follow these steps to prepare the repository for local development activities.
-
Clone this repository
-
Bootstrap the local repository by running...
Operating System Command Linux / MacOS Standard:
Bootstrap.sh
Standard + packaging:
Bootstrap.sh --package
Windows Standard:
Bootstrap.cmd
Standard + packaging:
Bootstrap.cmd --package
-
Activate the development environment by running...
Operating System Command Linux / MacOS . ./Activate.sh
Windows Activate.cmd
-
Invoke
Build.py
Command Description Example Notes black
Validates that the source code is formatted by black. Validation:
python Build.py black
Perform formatting:
python Build.py black --format
pylint
Validates the source code using pylint. python Build.py pylint
pytest
Runs automated tests using pytest. Without Code Coverage:
python Build.py pytest
With Code Coverage:
python Build.py pytest --code-coverage
update_version
Updates the semantic version of the package based on git commits using AutoGitSemVer. python Build.py update_version
package
Creates a Python wheel package for distribution; outputs to the /dist
directory.python Build.py package
Requires --package
when bootstrapping in step #2.publish
Publishes a Python wheel package to PyPi. https://test.pypi.org:
python Build.py publish
https://pypi.org:
python Build.py publish --production
Requires --package
when bootstrapping in step #2.build_binary
Builds an executable for your package that can be run on machines without a python installation; outputs to the /build
directory.python Build.py build_binary
Requires --package
when bootstrapping in step #2. -
[Optional] Deactivate the development environment by running...
Operating System Command Linux / MacOS . ./Deactivate.sh
Windows Deactivate.cmd
Similar Tools
There are other tools available that offer similar functionality, each emphasizing different domains, conventions, or workflows. They are listed here in the event that one of them is a better fit for the specifics of your scenario.
Tool | Description |
---|---|
Scientific Python: guide, cookie, & sp-repo-review | A copier/cookiecutter template for new Python projects based on the Scientific Python Developer Guide. |
cookiecutter-cms | A cookiecutter template for those interested in developing computational molecular packages in Python. |
LINCC Frameworks Python Project Template | This project template codifies LINCC-Framework's best practices for python code organization, testing, documentation, and automation. |
Cookiecutter Django | Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. |
cookiecutter-pylibrary | Enhanced cookiecutter template for Python libraries. |
Templating Systems
PythonProjectBootstrapper uses cookiecutter as its underlying templating engine, but others are available within python. Some are listed here if you want to use them directly.
Tool | Description |
---|---|
cookiecutter | A cross-platform command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, C projects. |
copier | A library and CLI app for rendering project templates. |
License
PythonProjectBootstrapper is licensed under the MIT license.
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 Distributions
Built Distribution
Hashes for PythonProjectBootstrapper-0.3.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b147f322169aeb0dc589cf881f55ee7a43907dfd3b53bfc91ffcf634126696e2 |
|
MD5 | d52f41c22940e1c6450b8bd9b89a42ed |
|
BLAKE2b-256 | 652f76234f7e1afc3c30a31632fb66543318617e523b9e94fc9257f4c8a933f2 |