Skip to main content

A boilerplate for Python 3 projects

Project description

pyplate PyPi

Overview

A boilerplate for Python 3 projects

  • Styles code with black
  • Lints code with flake8
  • Sorts imports with isort
  • Validates git commits (and/or formats changes) with pre-commit
  • Configures VSCode to use black, flake8, isort, etc. You'll want to install the recommended VSCode extensions, when prompted, as defined in .vscode/extensions.json

Dev Prerequisites

  • python 3.12
  • pipx, an optional tool for prerequisite installs
  • poetry (install globally with pipx install poetry)
  • flake8 (install globally with pipx install flake8)
    • flake8-bugbear extension (install with pipx inject flake8 flake8-bugbear)
    • flake8-naming extension (install with pipx inject flake8 pep8-naming)
  • black (install globally with pipx install black)
  • pre-commit (install globally with pipx install pre-commit)
  • just, a Justfile command runner

Windows

Justfile support for Windows requires cygwin. Once installed your PATH will need to be updated to resolve cygpath.exe (probably C:\cygwin64\bin). Justfile will forward any targets with shebangs starting with / to cygwin for execution.

Consider using a bash terminal through WSL instead.

Updating python version:

  • Update python version in Dev Prerequisites above
  • Update [tool.poetry.dependencies] section of pyproject.toml
  • Update pyupgrade hook in .pre-commit-config.yaml
  • Update python version in .gitlab-ci.yml

Justfile Targets

  • install: installs poetry dependencies and pre-commit git hooks
  • update_boilerplate: fetches and applies updates from the boilerplate remote
  • test: runs pytest with test coverage report

Usage

To start a new project, clone this repository, then rename the origin remote to boilerplate

git remote rename origin boilerplate

Then add your new remote origin

git remote add origin <remote repository>

Remove and replace (or rename) the pysrc/pyplate module to start your new project. Be sure to also replace pyplate references in pyproject.toml with your new module / project name.

Be sure to update .gitlab-ci.yml as needed. The PACKAGE_NAME variable should match the pyproject.toml tool.poetry.name field, otherwise the CI may publish incorrectly.

For the gitlab CI to publish you need to add two environment variables to your gitlab repository:

You can also add this repository to an existing project as the boilerplate remote:

git remote add boilerplate git@gitlab.com:tysonholub/pyplate.git

The following should help apply the boilerplate history into an existing project. Depending on your existing project structure, you may want to move everything into a backup/ folder first, then refactor accordingly after merging the boilerplate remote.

git merge boilerplate/main --no-ff --allow-unrelated-histories

Then moving forward, run just update_boilerplate to pull latest changes from the boilerplate remote. NOTE: you must keep the boilerplate remote history intact to successfully merge updates from the boilerplate remote.

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

pyplate_boilerplate-1.0.1rc1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyplate_boilerplate-1.0.1rc1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file pyplate_boilerplate-1.0.1rc1.tar.gz.

File metadata

  • Download URL: pyplate_boilerplate-1.0.1rc1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/5.15.154+

File hashes

Hashes for pyplate_boilerplate-1.0.1rc1.tar.gz
Algorithm Hash digest
SHA256 f3e796129b3e1fd6e46f422298ed9f496692849693999a65adf2c00dc863a9f9
MD5 4518add2ee98aa49e7070fa8cb1ada96
BLAKE2b-256 1aaa55db2c2a64a8379f26f887d969bd7fa14c0831396e7844deaef836c4d261

See more details on using hashes here.

File details

Details for the file pyplate_boilerplate-1.0.1rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyplate_boilerplate-1.0.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7786e5cd0e2802d4844a0754e995f8a9f41d2b4e56e33b470cd964a5d66cdfd
MD5 e60fd963c566f30c2a9360cefc39a710
BLAKE2b-256 48b8f668fa5e5ddcfd58c6fc9901884839f48ad87b000a08b20305ad313bdeaf

See more details on using hashes here.

Supported by

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