Skip to main content

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.
  • Dependabot automation for Poetry dependencies, GitHub Actions workflows, and Docker image updates.
  • Local Docker workflows provision MySQL and Redis services with health checks for template-based projects that need backing services.
  • 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.
  • docker-compose.yaml: Local MySQL and Redis service definitions for development and end-to-end environments.
  • 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 and Redis services)
  • 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 the local service stack
.\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: Recreates the local compose stack in detached mode and is intended for workflows where resetting local database state is acceptable.
  • 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, excluding Dependabot-triggered merges.
  • .github/dependabot.yaml: Automated dependency update checks for Poetry packages, GitHub Actions workflows, and Docker assets.

Metadata

Release files for PythonTemplateIt 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PythonTemplateIt 0.8.0
File Size Uploaded
pythontemplateit-0.8.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PythonTemplateIt 0.8.0
File Interpreter ABI Platform
pythontemplateit-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / pythontemplateit-0.8.0.tar.gz

Download URL pythontemplateit-0.8.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53bc35c69f3860a05a5e92d761ab5ff67b296d5dd7ce3567e8c8fecb6352ae5b
BLAKE2b-256 checksum
How to use checksums
717dccbac0b8a721927d2ec99fdd79c85218c71e68ffb03d353bf071d5eb617a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-1008-azure

Release files / pythontemplateit-0.8.0-py3-none-any.whl

Download URL pythontemplateit-0.8.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69e446f1dca5873134ae45d16ee2dd73d59522d04373657c79e70d68b5f8b4b0
BLAKE2b-256 checksum
How to use checksums
fc51453fded4acac43d364277c7fe41c373df18977d60c3723c5729f8c77147b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-1008-azure

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page