🔧 Pre-commit Hooks
Reusable pre-commit hooks for OpenSCAD projects.
Published on PyPI as kellerlab-pre-commit-hooks.
📌 What
Two hooks for OpenSCAD-based 3D printing projects:
| Hook | Description |
|---|---|
flatten-validate |
Runs scadm flatten --all and fails if flattened files have uncommitted changes |
optimize-images |
Resizes oversized JPEGs/PNGs, compresses them, and strips metadata (privacy) |
🔧 Usage
Add to your .pre-commit-config.yaml:
- repo: https://github.com/kellerlabs/pre-commit-hooks
rev: v0.1.0 # use latest tag
hooks:
- id: flatten-validate
- id: optimize-images
flatten-validate
Flattens OpenSCAD files via scadm and validates that the output is committed. Reads flatten config from scadm.json automatically.
- id: flatten-validate
# Override trigger pattern (default: always_run)
always_run: false
files: '^(scadm\.json|models/.*\.scad)'
Options:
| Arg | Default | Description |
|---|---|---|
--flatten-dir |
Read from scadm.json |
Override flatten output dirs (list of paths/globs) |
optimize-images
Resizes JPEGs and PNGs exceeding max width, compresses them, and strips metadata. EXIF data (including GPS coordinates) is removed from JPEGs; text metadata chunks are removed from PNGs.
- id: optimize-images
args: [--max-width=1920, --quality=85]
Options:
| Arg | Default | Description |
|---|---|---|
--max-width |
1920 |
Maximum image width in pixels |
--quality |
85 |
JPEG compression quality (1-95, ignored for PNG) |
Both hooks fail when files are modified, printing instructions to git add the changes. Re-run git commit after staging.
🏗️ Used In
- kellerlabs/homeracker — HomeRacker Core
- kellerlabs/homeracker-exclusive — HomeRacker MakerWorld models
🤝 Contributing
See CONTRIBUTING.md.
📜 License
MIT
Metadata
Release files for kellerlab-pre-commit-hooks 0.3.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kellerlab_pre_commit_hooks-0.3.14.tar.gz | 8.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kellerlab_pre_commit_hooks-0.3.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.5 kB
Release files / kellerlab_pre_commit_hooks-0.3.14.tar.gz
| Download URL | kellerlab_pre_commit_hooks-0.3.14.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
137c908dc4fcaacb0df3401b77d1d66c2b5aeb7d2d019aea2fe92ce8bba2e6d6
|
|
BLAKE2b-256 checksum How to use checksums |
bbff5ea2e61d296b7bea4ff9fae5567ae18f27dd4c592bbbfa493d12b506d31e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / kellerlab_pre_commit_hooks-0.3.14-py3-none-any.whl
| Download URL | kellerlab_pre_commit_hooks-0.3.14-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e427d7a3f41b181aff3bf26e1f8fc89403cfef9485601fd37d75fd2b147a36fc
|
|
BLAKE2b-256 checksum How to use checksums |
aa6e42e1e7485a9c0b5cba52b3a6cd42ea97d6c7b7577bb505345f4bdfec3fe4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency log