Skip to main content

pr-sop

PyPI Python License Downloads

Opinionated PR governance checks. Config-driven, no LLM. Runs as a CLI, pre-commit hook, or GitHub Action.

Built by the author of sql-sop. Same naming, same philosophy: catch real drift fast, skip the ceremony.

Why Does This Exist?

Teams keep shipping PRs with broken CHANGELOG.md, pyproject.toml versions that do not match the __init__.py, or rev: pins in READMEs that still point at a tag three releases behind. Every repo hits these. Every review catches some and misses others.

pr-sop is a tiny, config-driven checker that runs before merge and surfaces the drift that review forgets. No LLM, no opinions beyond what you turn on in .prsop.yml. Three checks today, each optional, each under 100 lines.

Key Numbers

Checks 3 (2 errors, 1 warning)
Tests 29
Runtime under 1 second on a typical PR
PyPI downloads monthly live (new release, stats warming up)
Version 0.1.1

What it checks

ID Default severity What it catches
changelog-required error Files matching a glob pattern changed, but CHANGELOG.md was not updated, or the ## [Unreleased] section is missing or empty.
version-consistency error Version strings extracted from multiple files disagree. Catches the classic "bumped pyproject, forgot the __init__.py" drift.
precommit-rev-matches-tag warning rev: pins in configured files (README, pre-commit config) do not match the latest git tag. Since v0.1.1, only pins referencing this repo are flagged, so third-party hooks are ignored automatically.

Every check is optional and configured in .prsop.yml. A missing section means the check is off.

Quick start

pip install pr-sop

Drop a .prsop.yml at the repo root:

checks:
  changelog_required:
    severity: error
    paths:
      - "src/**/*.py"

  version_consistency:
    severity: error
    sources:
      - file: pyproject.toml
        pattern: '^version\s*=\s*"([^"]+)"'
      - file: src/mypkg/__init__.py
        pattern: '^__version__\s*=\s*"([^"]+)"'

  precommit_rev_matches_tag:
    severity: warning
    files:
      - README.md
      - .pre-commit-config.yaml

Run:

pr-sop check --base origin/main

Exit code is 1 if any error fired, 0 otherwise. Warnings never fail CI.

Example terminal output:

ERROR    changelog-required  src/myapp/api.py  3 changed paths match but CHANGELOG.md was not updated.
       -> Add a line under `## [Unreleased]` in CHANGELOG.md.
WARNING  precommit-rev-matches-tag  README.md:134  `rev: v0.3.2` does not match latest git tag `v0.4.1`.
       -> Update the rev to `v0.4.1`.

1 error(s), 1 warning(s) across 2 check(s).

GitHub Action

name: pr-sop
on:
  pull_request:
    branches: [main]

permissions:
  contents: read

jobs:
  prsop:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          fetch-tags: true

      - uses: Pawansingh3889/pr-sop@v0.1.1

Findings surface as native ::error:: and ::warning:: workflow commands (visible in the Files tab of the PR) plus a table in the workflow summary. No API calls, no token setup beyond the default GITHUB_TOKEN.

Consumer inputs on the action:

Input Default Description
config .prsop.yml Path to the config file relative to the repo root.
base auto Base ref to diff against. Empty defaults to the PR base, or origin/main otherwise.

Why not Danger?

Danger is great when you want to write repo-specific rules in JavaScript. pr-sop is the opposite: three opinionated rules you turn on with a YAML block, no Dangerfile to maintain. If you need custom logic, reach for Danger. If you keep forgetting to bump the CHANGELOG, reach for pr-sop.

Design

  • Checks are plugins (see pr_sop/checks/base.py). Each has an id, a pydantic config model, and a run(ctx) -> list[Finding].
  • No network calls. Reads your files, shells out to git.
  • Config validated by pydantic v2. Typos in .prsop.yml fail fast at load, not mid-scan.
  • Output: Rich terminal locally, workflow commands in Actions.
  • Single source of version truth via importlib.metadata, no hardcoded version string to drift.

Used by

  • sql-guard (aka sql-sop on PyPI), as the first external consumer since v0.1.0.

If you wire pr-sop into your repo and want to be listed, open a PR adding a bullet here.

Status

v0.1.1, alpha. The config schema and rule IDs are the parts most likely to stay stable across 0.x. Internal APIs in pr_sop/checks/ may move before v1.0. Check CHANGELOG.md before upgrading between minor versions.

Licence

MIT. See LICENSE and NOTICE for the reasoning.

Metadata

Release files for pr-sop 0.1.2

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

Source distribution (sdist)

Source distribution for pr-sop 0.1.2
File Size Uploaded Provenance Actions
pr_sop-0.1.2.tar.gz 21.7 kB Without provenance Details for pr_sop-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pr-sop 0.1.2
File Interpreter ABI Platform Actions
pr_sop-0.1.2-py3-none-any.whl Python 3 none any Details for pr_sop-0.1.2-py3-none-any.whl

Total release size: 36.7 kB

Release files / pr_sop-0.1.2.tar.gz

Download URL pr_sop-0.1.2.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0c61bf501828d52cf8c21074623e7c5c542c031cb7d99d399ffc4057712050d1
BLAKE2b-256 checksum
How to use checksums
0e7727e0f773429623bf7bfa59b1e42bf33ef01d253dba79365596b3cd8459c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pr_sop-0.1.2-py3-none-any.whl

Download URL pr_sop-0.1.2-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6065a27afb433b7667efbf90f56159ffcf7970d8d6412ed0a44148b0005f7160
BLAKE2b-256 checksum
How to use checksums
bbf3f60f34142747f80a5d3efe2ac336cd30b2b9d3c37dd61cdc2787eb122cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for pr-sop 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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