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.12

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.12
File Size Uploaded
kellerlab_pre_commit_hooks-0.3.12.tar.gz 8.4 kB Details

Built distribution (wheel)

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

Total release size: 15.4 kB

Release files / kellerlab_pre_commit_hooks-0.3.12.tar.gz

Download URL kellerlab_pre_commit_hooks-0.3.12.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
28f8c10665a0c1eeaf252b4f0ebc6b4b025f7f82b9fad88b6b56c28c7c63037a
BLAKE2b-256 checksum
How to use checksums
626fe5fa1809844bbb55ff7fb28863efecabf48cbbf35797221c952a36cc0dd6
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 Sep 28, 2026.

Transparency log

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

Download URL kellerlab_pre_commit_hooks-0.3.12-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b982a9752d082c27fc956ec44d46275629a18b63ee3d843fa0a86a9bf611c34a
BLAKE2b-256 checksum
How to use checksums
07892f6cb209dd398c33175c17bbcedec89b48a7b5f2f6d320e66e6f83517aa7
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 Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.14

2 release files

This release

0.3.12 This release

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

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