Skip to main content

PyEnforce
A comprehensive quality assurance CLI for enforcing strict Python code standards.

Python Enforcer is a command-line tool that wraps industry-standard static analysis tools with curated, strict configurations. It ensures code quality, security, and maintainability by providing a unified interface to run these checks.

Features

  • Centralized Configuration: Bundles strict configurations for all supported tools, ensuring consistency across projects.
  • Unified Interface: Run multiple quality checks using a single command-line tool.
  • Tool Suite: Integrates six specialized tools:
    • Ruff: Linting and formatting.
    • Mypy: Static type checking.
    • Pylint: Code analysis.
    • Bandit: Security linting.
    • Semgrep: Static analysis for security and bugs.
    • Vulture: Dead code detection.

Installation

Install pyenforce from PyPI (or from source) with the dependencies you need.

Minimal Install

Installs only the CLI runner. You must install the underlying tools (like ruff or mypy) separately or have them in your environment.

pip install pyenforce

Install with Specific Tools

Install pyenforce along with specific tools you plan to use.

# Install with Ruff
pip install "pyenforce[ruff]"

# Install with Mypy
pip install "pyenforce[mypy]"

# Install with multiple tools
pip install "pyenforce[ruff,mypy]"

Install with All Tools

Install the CLI and the complete suite of supported tools.

pip install "pyenforce[all]"

Usage

Run any of the supported tools using the pye command followed by the tool name:

pye <tool> [args...]

Available Commands

Tool Command Purpose
Ruff pye fmt Code formatter for consistent code style.
Ruff pye ruff Lightning-fast linter covering style, complexity, and imports.
Mypy pye mypy Verifies type hints and catches type errors.
Pylint pye pylint Analyzes code quality and design patterns.
Bandit pye bandit Detects common security vulnerabilities.
Semgrep pye semgrep Advanced pattern matching for bugs and security issues.
Vulture pye vulture Identifies unused code.

Examples

Run a specific tool (e.g., Ruff):

pye ruff

Pass additional arguments (e.g., run Mypy on a specific directory):

pye mypy src/

Pre-commit Usage

To use pyenforce with pre-commit, add the following to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/HH-MWB/pyenforce
    rev: v0.1.0
    hooks:
      - id: ruff-format
      - id: ruff-check
      - id: mypy
      - id: pylint
      - id: bandit
      - id: semgrep
      - id: vulture

If you need to add extra dependencies (e.g., plugins) to a hook using additional_dependencies in your .pre-commit-config.yaml, you must re-include the base dependency. pre-commit overwrites the list instead of merging it.

Example: Adding a plugin to pylint:

  - repo: https://github.com/HH-MWB/pyenforce
    rev: v0.1.0
    hooks:
      - id: pylint
        additional_dependencies:
          - ".[pylint]"     # Required: Re-adds Pylint
          - "pylint-django" # Your extra dependency

License

This repository is licensed under the MIT License.

Metadata

Release files for pyenforce 0.1.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 pyenforce 0.1.0
File Size Uploaded
pyenforce-0.1.0.tar.gz 162.2 kB Details

Built distribution (wheel)

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

Total release size: 173.2 kB

Release files / pyenforce-0.1.0.tar.gz

Download URL pyenforce-0.1.0.tar.gz
Size 162.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8edf115eb11edd6ea0d1de7891d894b4f2e4945f9a383edee4c62b7de173dfac
BLAKE2b-256 checksum
How to use checksums
795c14631bb9c1770f19b8737a9939d12ea19cc6d219227ab7193b5892cfe488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 27, 2025.

Transparency log

Release files / pyenforce-0.1.0-py3-none-any.whl

Download URL pyenforce-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e0dcca7e2067853d0e5e327bfc27ee8b86532617879cfe8beb543115e7378e8
BLAKE2b-256 checksum
How to use checksums
6e3507904aa7912e5fdba7e00f33484f766fada9f82dff09809e8f753e043c0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 27, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.0

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