Skip to main content

🔧 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

🤝 Contributing

See CONTRIBUTING.md.

📜 License

MIT

Metadata

Release files for kellerlab-pre-commit-hooks 0.3.15

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

Source distribution (sdist)

Source distribution for kellerlab-pre-commit-hooks 0.3.15
File Size Uploaded Provenance Actions
kellerlab_pre_commit_hooks-0.3.15.tar.gz 8.5 kB With provenance Details for kellerlab_pre_commit_hooks-0.3.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kellerlab-pre-commit-hooks 0.3.15
File Interpreter ABI Platform Actions
kellerlab_pre_commit_hooks-0.3.15-py3-none-any.whl Python 3 none any Details for kellerlab_pre_commit_hooks-0.3.15-py3-none-any.whl

Total release size: 15.5 kB

Release files / kellerlab_pre_commit_hooks-0.3.15.tar.gz

Download URL kellerlab_pre_commit_hooks-0.3.15.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
289fe1fbbf37b0d1112d0e94ec5be1ed06cc52464e329cd40c22295d6b297b7e
BLAKE2b-256 checksum
How to use checksums
08048a15710d8a9d3c3dbfdb786a8450ae3d36c75d8a9a0067f0891b2acc6e8e
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 19, 2026.

Transparency log

Release files / kellerlab_pre_commit_hooks-0.3.15-py3-none-any.whl

Download URL kellerlab_pre_commit_hooks-0.3.15-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c9f141b729808bcd93df695f88348f63c62ce282629796fed03271bb0c18ca4
BLAKE2b-256 checksum
How to use checksums
dd18d206e3c641bae5c27f6db6fb1330c7eb6ba46937dcfaf492ffdd160744af
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 19, 2026.

Transparency log

Security for kellerlab-pre-commit-hooks 0.3.15

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kellerlab_pre_commit_hooks-0.3.15.tar.gz

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 19, 2026.

Transparency log

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