Skip to main content

A command line app to create a Python project skeleton.

Project description

Python Project Generation Tool

PyPI version Codacy Badge CodeQL PyPI - License Weekly Downloads Total Downloads

A fully customizable Python application to bootstrap Poetry-based boilerplate for you to start developing your Python applications quicker! Includes linting and Pytest libraries, a task runner, pre-commit hooks, and optionally create a git repository and upload to GitHub. you can also fully customize the template used.

Full documentation for this project with usage examples is available at https://py-maker.seapagan.net/

Installation

It is best to install this package globally, rather than in a virtual environment, as it is intended to be used to create new projects.

Install the package globally using pip:

$ pip install pyproject-maker

If you cannot install globally due to permissions, you can install it to your user install directory:

$ pip install --user pyproject-maker

or use pipx (recommended)

$ pipx install pyproject-maker

Usage

To create a new project, run the following command:

$ pymaker new <project-folder>

This will create a new directory with the name you provide, and run the steps needed to get you started quickly:

  1. Copy the template files into the new directory
  2. Initialise a git repository
  3. Commit the boilerplate to Git

You will be asked a series of questions to customise the new project.

When it asks "Package Name?" you can choose two variants :

  1. If you wish for a standard Python package that can optionally be uploaded to http://pypi.org, enter a package name here. Note that underscores ("_") must be used as opposed to dashes ("-") to comply with Python package naming rules.
  2. Enter '-' to instruct the tool that you are not creating any package, just a standalone app, and then the main.py will just be placed in the project root.

You should now change into the new directory, install dependencies and activate the virtual environment:

$ cd <project-folder>
$ poetry install
$ poetry shell

Now, you can start developing :smile:

Linting

The generated project includes Ruff for linting and formatting. Mypy is installed for type checking.

Customise

For a 'package' project, the pyproject.toml file is set up to put the code in a sub-folder with the same name as chosen for the 'Package Name'. You can change this to whatever you require, just remember to update the pyproject.toml file to match.

You can also modify the template used to generate the new project.

Check the documentation at https://py-maker.seapagan.net/ for more details.

Task Runner

The task-runner Poe the Poet is installed as a development dependency which allows us to run simple tasks (similar to npm scripts).

These are run (from within the virtual environment) using the poe command and then the script name, for example:

$ poe pre

You can define your own, but there are 6 specific ones provided with the script.

  • pre : Run pre-commit run --all-files

  • ruff: Run Ruff linter on all Python files in the project.

  • format: Run Ruff formatter on all Python files in the project.

  • mypy: Run MyPy type-checker on all Python files in the project.

  • markdown: Run pymarkdown on all markdown files in the project.

  • lint: Runs ruff, format, mypy, and markdown in sequence

These are defined in the pyproject.toml file in the [tool.poe.tasks] section. Take a look at this file if you want to add or remove tasks.

Pre-commit

The generated project uses pre-commit to run some checks on the code before it is committed. This is a great tool to help keep your code clean.

To install pre-commit, run the following command from inside your venv:

$ pre-commit install
pre-commit installed at .git/hooks/pre-commit

GitHub Actions and Configuration

By default the generated project includes a GitHub Actions workflow to run Dependabot to keep your dependencies up to date. There are also standard templates for Pull Request and Issues.

The plan is to add more workflows in the future, for example running tests and more.

Contributing to Py-Maker

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.

A detailed overview on how to contribute can be found in the contributing guide and on the website.

If you are simply looking to start working with the codebase, navigate to the GitHub "issues" tab and start looking through interesting issues. There may be issues listed under documentation and good first issue where you could start out.

You can also triage issues which may include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions.

Maybe through using Py-Maker you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’...you can do something about it!

As contributors and maintainers to this project, you are expected to abide by our code of conduct. More information can be found at: Contributor Code of Conduct

License

This project is licensed under the terms of the MIT license.

MIT License

Copyright (c) 2023 Grant Ramsay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyproject_maker-0.10.1.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

pyproject_maker-0.10.1-py3-none-any.whl (80.9 kB view details)

Uploaded Python 3

File details

Details for the file pyproject_maker-0.10.1.tar.gz.

File metadata

  • Download URL: pyproject_maker-0.10.1.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-25-generic

File hashes

Hashes for pyproject_maker-0.10.1.tar.gz
Algorithm Hash digest
SHA256 65256039ea00377d0bb60f5ce2f36bae08b187504b9534a0ff49b2e1811d842f
MD5 b35e8d7e1b1be44fe8c3b3361551b288
BLAKE2b-256 e29ad3d4d68e365cca60196fb1017bdfe1f09a316289fdeb9c5d02596263b5b8

See more details on using hashes here.

Provenance

File details

Details for the file pyproject_maker-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: pyproject_maker-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 80.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-25-generic

File hashes

Hashes for pyproject_maker-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cb96eaf255c853a1a7594091283a84f7ad71bcc673685e498076d9269a16106
MD5 4e6a5c03d029c427c1ed827dffc1c714
BLAKE2b-256 3bfebb5a66cb503788036e2b5431dac70f13d95f209d4917953d7055440d94a1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page