Generate .pre-commit-config.yaml from language and framework presets
Project description
pc-init
Generate a pre-commit or prek .pre-commit-config.yaml for your project from curated language and framework presets — so you get the right linters, formatters, and quality tools wired up with a single command instead of copying configs between repos.
Works with prek and pre-commit
Motivation
Every new repository needs a .pre-commit-config.yaml.
Each language and framework has its own recommended linters, formatters, and quality tools, each with its own hook URL and revision.
pc-init encodes those choices in version-controlled presets so you run one command instead of copying configs and looking up hook URLs.
The bundled presets pin specific hook revisions — run pre-commit autoupdate or prek autoupdate after generation to pull in the latest versions.
Awesome Pre-commit Hooks
The curated hooks bundled with pc-init are also published as a standalone reference at awesome-pre-commit-hooks — a browsable list of every hook organised by language and framework.
Installation
uv tool install pc-init
Usage
Usage: pc-init [OPTIONS] COMMAND [ARGS]...
Generate a .pre-commit-config.yaml for your project.
Options:
--lang TEXT Language preset to include (repeatable, or
comma-delimited: --lang=py,js). Run `pc-init list` to
see supported values from the active catalog.
--framework TEXT Framework preset to layer on top of language baselines
(repeatable, or comma-delimited: --framework=react,django).
Run `pc-init list` to see supported values from the
active catalog.
--force Overwrite existing .pre-commit-config.yaml without
prompting.
--output TEXT Output file path. [default: .pre-commit-config.yaml]
--presets TEXT Preset catalog to use. Accepts a local directory path or
a git repository URL (https://, git@, git://, ssh://).
The directory / repo root must contain lang/ and
framework/ subdirectories. Defaults to the bundled
presets.
--version Show version and exit.
--help Show this message and exit.
Commands:
list List available language and framework presets in the active catalog.
List available presets
Run pc-init list to discover all supported languages and frameworks in the active catalog (bundled or custom):
pc-init list
Languages:
docker, go, img, js, md, nb, py, ru, sh, sql, tf, toml, ts, yaml
Frameworks:
django, git, k8s, react, sphinx
Use --presets to list what a custom catalog provides:
pc-init list --presets /path/to/my-presets
pc-init list --presets https://github.com/org/my-presets
Supported presets
Languages — pass as --lang:
| ID | Language |
|---|---|
py |
Python |
js |
JavaScript |
go |
Go |
ru |
Rust |
sh |
Shell / Bash |
ts |
TypeScript |
nb |
Jupyter Notebooks |
md |
Markdown |
img |
Images |
docker |
Docker |
sql |
SQL |
tf |
Terraform |
toml |
TOML |
yaml |
YAML |
Language aliases python, javascript, typescript, rust, golang, shell, bash, image, notebook, jupyter, dockerfile, and terraform are also accepted.
Frameworks — pass as --framework:
| ID | Framework |
|---|---|
react |
React |
django |
Django |
sphinx |
Sphinx documentation |
git |
Commit message linting |
k8s |
Kubernetes |
Language suggestions for frameworks
Some framework presets declare the languages they are typically used with.
If none of your --lang selections match, pc-init prints an informational note and a ready-to-run command that adds the missing languages:
Note: framework 'react' is typically used with: js, ts
Try: pc-init --lang=py,js,ts --framework=react
The suggested command preserves your existing --lang values so it is safe to run with --force — no hooks you already selected will be removed.
Examples
Python project:
pc-init --lang py
JavaScript project with React:
pc-init --lang js --framework react
Python + Django, overwriting an existing config:
pc-init --lang py --framework django --force
Multiple languages (two equivalent forms):
pc-init --lang py --lang js
pc-init --lang=py,js
Custom presets
Point --presets at a local directory or a git repository that contains lang/ and framework/ subdirectories in the same layout as the bundled presets.
Local directory:
pc-init --lang py --presets /path/to/my-presets
Git repository:
pc-init --lang py --presets https://github.com/org/my-presets
Check the config files
To check the config files with pre-commit and prek for a specific language or framework:
pre-commit validate-config lang/py/preset.yaml
prek validate-config lang/py/preset.yaml
Update bundled presets
Update a config file with the command:
pre-commit autoupdate lang/py/preset.yaml
prek autoupdate lang/py/preset.yaml
Check and update all presets
To pull the latest hook revisions into all bundled preset files:
find . -name "preset*.yaml" | xargs -I{} prek validate-config {}
find . -name "preset*.yaml" | xargs -I{} prek autoupdate -c {}
find . -name "preset*.yaml" | xargs -I{} pre-commit validate-config {}
find . -name "preset*.yaml" | xargs -I{} pre-commit autoupdate -c {}
Contributing
See CONTRIBUTING.md for development setup, preset guidelines, and the pull request checklist.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pc_init-0.3.1.tar.gz.
File metadata
- Download URL: pc_init-0.3.1.tar.gz
- Upload date:
- Size: 34.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cebfea35794c9aedf27263afec8e074e68ec63b2d07bd8925f13dc77ef21166
|
|
| MD5 |
d88cefc460e823d312ee809cee4f698a
|
|
| BLAKE2b-256 |
61b405400905c5f3b7fbd7aa7a793388b612b7cd92fe4de87fe3bc26bc64536c
|
Provenance
The following attestation bundles were made for pc_init-0.3.1.tar.gz:
Publisher:
test-build-publish.yml on cleder/gpc-init
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pc_init-0.3.1.tar.gz -
Subject digest:
3cebfea35794c9aedf27263afec8e074e68ec63b2d07bd8925f13dc77ef21166 - Sigstore transparency entry: 1966433115
- Sigstore integration time:
-
Permalink:
cleder/gpc-init@cba36aa53b2e804ffdd96dd83c4fd255ed29a9be -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cleder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-build-publish.yml@cba36aa53b2e804ffdd96dd83c4fd255ed29a9be -
Trigger Event:
push
-
Statement type:
File details
Details for the file pc_init-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pc_init-0.3.1-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f66055c4f2c6675cb61d726652744a887b35a4d01173e73c52a5a99e340e1aa
|
|
| MD5 |
f773c547f35fb46b89bb2707b0adcadb
|
|
| BLAKE2b-256 |
3d617b659d6023f84ab1d36c5392edbe576fed8fb0793471bf41cc44745075be
|
Provenance
The following attestation bundles were made for pc_init-0.3.1-py3-none-any.whl:
Publisher:
test-build-publish.yml on cleder/gpc-init
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pc_init-0.3.1-py3-none-any.whl -
Subject digest:
5f66055c4f2c6675cb61d726652744a887b35a4d01173e73c52a5a99e340e1aa - Sigstore transparency entry: 1966433327
- Sigstore integration time:
-
Permalink:
cleder/gpc-init@cba36aa53b2e804ffdd96dd83c4fd255ed29a9be -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cleder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-build-publish.yml@cba36aa53b2e804ffdd96dd83c4fd255ed29a9be -
Trigger Event:
push
-
Statement type: