Skip to main content

Template for new Python projects.

Project description

PythonTemplateIt

Category Status and Links
General
CD/CI
PyPI
GitHub

Short description

PythonTemplateIt is a reusable template for Python projects with standardized packaging, linting, testing, environment bootstrapping, and GitHub workflow automation.


Module Overview

Key Features

  • Poetry-based project packaging and dependency management.
  • Published package layout rooted under src/pti/ for template imports such as import pti.pythontemplateit.
  • Pre-configured quality tooling (black, isort, flake8, pytest, pre-commit).
  • PowerShell and shell scripts for Python setup, optional React setup, private repository access, and Docker-assisted database provisioning.
  • Reusable CI/CD workflows for pull request validation and post-merge release/publish handling.
  • Release note and versioning conventions aligned to SemVer.

Project Structure

  • src/pti/: Template Python package source used by the published distribution.
  • src/: Application modules and package source code.
  • tests/: Unit and functional test suites with fixtures and test data.
  • scripts/: SQL/bootstrap assets.
  • legacy/: Archived or excluded legacy resources.
  • *.ps1: Setup and automation scripts for environment and toolchain tasks.

Getting Started

Prerequisites

  • Python 3.12+
  • Poetry
  • Docker (optional, for local MySQL service)
  • GitHub access token(s) for private package sources when needed

Setup

# 1) Generate .env from the SetupDotEnv script
.\SetupDotEnv.ps1

# 2) Configure private repository access for Poetry
.\SetupPrivateRepoAccess.ps1

# 3) Install Python tooling and project dependencies
.\InstallPy.ps1

# 4) Optional: configure GitHub CLI access
.\SetupGitHubAccess.ps1

# 5) Refresh development dependencies directly when needed
.\InstallDevEnv.ps1

# 6) Optional: start local MySQL service
.\SetUpDocker.ps1
# or
# docker compose up -d db

# 7) Run tests
poetry run pytest

Optional Frontend Bootstrap

# Use these only in repos that also contain a Node/React app
.\InstallReact.ps1
# or
bash ./install_react.sh

Common Commands

poetry install
poetry run pytest
poetry run pytest --cov=src --cov=tests --cov-report=term-missing
poetry run black src tests
poetry run isort src tests
poetry run flake8 src tests
poetry run pre-commit run --all-files

Automation Scripts

  • InstallPy.ps1: Bootstraps Poetry tooling, updates the repository remote when credentials are available, and installs Python dependencies.
  • InstallDevEnv.ps1: Installs development dependencies and configures pre-commit tooling.
  • InstallReact.ps1: Installs Node dependencies for React projects on Windows and configures pre-commit when available.
  • install_react.sh: Bash equivalent of the React installer for non-PowerShell environments.
  • SetupDotEnv.ps1: Generates .env values from environment variables.
  • SetupPrivateRepoAccess.ps1: Configures private package source credentials.
  • SetupGitHubAccess.ps1: Configures GitHub authentication for local automation.
  • SetUpDocker.ps1: Provisions Docker resources used by database-related workflows.
  • CreateDbSqlScript.ps1: Generates SQL bootstrap scripts for MySQL setup.

Active Workflows

  • .github/workflows/py-temp-pr-pub-no_docker-def.yaml: Pull request validation workflow.
  • .github/workflows/py-temp-publish-pub-build_release_notify_after_merge-def.yaml: Release build, publish, and notification workflow after merge to master.

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

pythontemplateit-0.7.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

pythontemplateit-0.7.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pythontemplateit-0.7.0.tar.gz.

File metadata

  • Download URL: pythontemplateit-0.7.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for pythontemplateit-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6f9e6878a0acbe8f2d5ee865e02345fd225c4289bd4da17ddf9f431e121b54c4
MD5 37b412de713598c96b67cd6217897c28
BLAKE2b-256 5e07ad250ac6879e5325efebb706e7e8223aaa373f145ee2840054a7f5ef8a28

See more details on using hashes here.

File details

Details for the file pythontemplateit-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: pythontemplateit-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for pythontemplateit-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5190e84982bf4223b5b0c2d591717564327d857892556aca7979cb2638f17eed
MD5 1acbe586cf3f099131d341d83fbb04c1
BLAKE2b-256 e12b7971a7d40f60baa1bcad5e89af2046f03fa1220ee7b2b921c11fdbc6e506

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