56 releases (32 stable)

new 1.0.31 Apr 25, 2024
1.0.25 Mar 29, 2024
1.0.3 Dec 30, 2023
0.6.14 Dec 13, 2023
0.6.10 Nov 28, 2023

#13 in Command line utilities

Download history 18/week @ 2024-01-06 7/week @ 2024-01-13 1/week @ 2024-01-20 14/week @ 2024-01-27 11/week @ 2024-02-03 51/week @ 2024-02-10 160/week @ 2024-02-17 1057/week @ 2024-02-24 416/week @ 2024-03-02 193/week @ 2024-03-09 328/week @ 2024-03-16 286/week @ 2024-03-23 208/week @ 2024-03-30 127/week @ 2024-04-06 260/week @ 2024-04-13 322/week @ 2024-04-20

1,003 downloads per month

MIT license

235KB
7K SLoC

Python Project Generator

Tests Status

Generates a Python project structure with github actions for continuous integration and continuous deployment. Both pure Python projects and Python projects with Rust modules using PyO3 can be created.

Pure Python project included packages

For package managment choose between:

Dev packages:

  • mypy for static type checking
  • pytest for testing
  • pytest-cov for test coverage reports
  • ruff for linting and code formatting

Python project with Rust modules included packages

  • maturin for package management
  • mypy for static type checking
  • pytest for testing
  • pytest-cov for test coverage reports
  • ruff for linting and code formatting
  • PyO3 for managing the Rust/Python FFI
  • justfile for running commands (to use this you will need to install just)

Installation

Install with cargo:

cargo install python-project-generator

Install on Arch with the AUR:

paru -S python-project-generator-bin

Install on Debian/Ubuntu:

Note: Change the version to match the version you want to install.

curl -LO https://github.com/sanders41/python-project-generator/releases/download/v1.0.16/python-project-generator_1.0.16_amd64.deb
sudo dpkg -i python-project-generator_1.0.16_amd64.deb

Python Project Generator can also be installed with binaries provided with each release here, or with cargo.

How to use

Create a new project

From your terminal run:

python-project create

You will be asked a series of questions that will be used to generate your project. The project generator will check pypi for the lastest version of the included packages and use those while generating the project. This feature can be disabled by using with either -s or --skip-download-latest-packages when running the generator. If either there is an issue with retrieving the latest versions or if you have decided to skip looking up the latest version, the packages will be be created with default versions.

python-project create -s

After running the generator a new directory will be created with the name you used for the Project Slug. Change to this directory then install the python packages and pre-commit hooks.

Pure Python Projects

Install the Python dependencies when using Poetry.

poetry install

Install the Python dependencies when using setuptools.

First create a virtual environment and activate it.

python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements-dev.txt

Install the pre-commit hooks.

pre-commit install

PyO3 projects

First create a virtual environment and activate it.

python -m venv .venv
. .venv/bin/activate

Install the dependencies and build the rust module.

just install

Install the pre-commit hooks.

pre-commit install

Now your project is ready to use.

Save custom default values

You can specify default values for many of the project options. For example to save a default creator:

python-project config creator "Wade Watts"

To see a full list of values that be set as defaults run:

python-project config --help

To view the current saved defaults:

python-project config show

To remove custom defaults:

python-project config reset

Contributing

If you are interested in contributing please see our contributing guide

Dependencies

~9–21MB
~322K SLoC