Lithophane & Spiral Betty Generator
Project description
🌟 Lumina
Lumina is a powerful Python toolkit for makers, artists, and 3D printing enthusiasts. Transform your images into stunning physical art pieces.
✨ What Can You Create?
| Feature | Description | Output |
|---|---|---|
| 🖼️ Lithophanes | 3D-printable light art | .stl mesh |
| 🌀 Spiral Betty | Spiral art for laser/CNC engraving | .png image |
🚀 Quick Start
Installation
pip install lumina-tools
Or from source:
git clone https://github.com/AtaCanYmc/lumina.git
cd lumina
pip install -e .
Create a Lithophane
from lumina import flat_lithophane
mesh = flat_lithophane(
"photo.jpg",
shape="heart", # rect, circle, heart
width_mm=100,
max_thickness=3.0
)
mesh.save("lithophane.stl")
Create Spiral Art
from lumina import generate_spiral_betty_png
import cv2
spiral = generate_spiral_betty_png("portrait.jpg", radius_mm=50)
cv2.imwrite("spiral_art.png", spiral)
Spiral then Lithophane (chain example)
You can chain the spiral generator and the lithophane generator: first produce a Spiral Betty PNG, then feed that PNG to flat_lithophane to create an STL.
from lumina import generate_spiral_betty_png, flat_lithophane
import cv2
# 1) Generate a spiral PNG from an input image
input_photo = "portrait.jpg" # your source image
spiral_png = "portrait_spiral.png"
spiral_img = generate_spiral_betty_png(image_path=input_photo, radius_mm=50)
cv2.imwrite(spiral_png, spiral_img)
# 2) Create a lithophane from the generated spiral PNG
mesh = flat_lithophane(
image_path=spiral_png,
shape="rect",
width_mm=100,
max_thickness=3.0,
min_thickness=0.5,
)
mesh.save("portrait_spiral_lithophane.stl")
💻 CLI Usage
# Lithophane
python -m lumina.cli flat photo.jpg --shape circle --width 120
# Spiral art
python -m lumina.cli spiral portrait.jpg --radius 100 --lines 40
🎨 Features
- Multiple Shapes: Rectangle, Circle, Heart
- Smart Framing: Auto-generated shape-conforming frames
- True Mesh Cutting: Clean edges without artifacts
- Flexible Output: STL meshes, C-arrays, PNG images
- CLI & Python API: Use from terminal or integrate into your projects
🧪 Continuous Integration (CI) & Local Checks (updated)
This repository includes GitHub Actions workflows and pre-commit hooks to keep code quality high and releases reproducible. Below is the current, recommended workflow for local development and what CI enforces.
What CI does now
- Installs runtime dependencies and the package itself (editable) so tests can import
lumina:pip install -r requirements.txtthenpip install -e .
- Runs style checks in check-only mode (so CI does not mutate files):
isort --check-only .black --check .ruff check .
- Runs
pytestwith coverage and uploads the generatedcoverage.xmlartifact. The artifact name is generated per matrix job/run (to avoid 409 conflicts) and CI uploads to Codecov if configured.
Why this matters
- CI no longer runs
pre-commit run --all-filesin a way that modifies files; instead it enforces that the repository is already formatted. Developers must run formatting locally and commit the results to avoid CI failures. - The workflow installs the package under test so tests won't fail with
ModuleNotFoundError: No module named 'lumina'.
Quick local setup (recommended)
- Create and activate a virtualenv:
python -m venv .venv
source .venv/bin/activate
- Install dependencies and the package in editable mode:
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- Install and use pre-commit hooks (one-time):
pip install pre-commit
pre-commit install
# Apply hooks & auto-fixes locally
pre-commit run --all-files
# Stage and commit the changes made by hooks
git add -A
git commit -m "Apply pre-commit formatting"
- Run tests & coverage locally:
pip install pytest pytest-cov
pytest -q --cov=lumina --cov-report=xml:coverage.xml
Publishing to PyPI
- To publish, create a git tag (
git tag vX.Y.Z && git push --tags) and ensure repository secretPYPI_API_TOKENis set (token created on PyPI). - The
publish.ymlworkflow builds sdist and wheel and publishes to PyPI.
Secrets for CI
PYPI_API_TOKEN: required for automatic PyPI publishing.CODECOV_TOKEN(optional): set this if you want Codecov upload to use a token (for private repos); for public repos Codecov may work without it.
Notes & recommendations
- Run
pre-commit run --all-fileslocally before pushing; CI will reject pushes that aren’t formatted. - If you prefer CI to be less strict about formatting, we can remove
--fixfrom theruffpre-commit hook or make lint checks non-blocking in CI. I can apply that change if you want. - Artifact uploads in CI are named uniquely per matrix job and set to
overwrite: trueto avoid409 Conflictwhen re-running or retrying jobs.
If you want, I can also add a short CONTRIBUTING.md section that enforces pre-commit + explains required commit hooks for contributors.
📖 Documentation
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
📄 License
MIT License - see LICENSE for details.
Made with ❤️ for the maker community
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 lumina_tools-0.1.8.tar.gz.
File metadata
- Download URL: lumina_tools-0.1.8.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d03b02c42b0cfe1b185446dee46bd17120106296cff1af508d4dbe48d4074f0
|
|
| MD5 |
a50ffd4f46dda8b42d0456d29a76b20e
|
|
| BLAKE2b-256 |
b417aec0cba98137adea733c52a8ea8e6d5143e7d17d01f5ba08c7fe52c9ac5d
|
File details
Details for the file lumina_tools-0.1.8-py3-none-any.whl.
File metadata
- Download URL: lumina_tools-0.1.8-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3d8bb22a1843373282ae3c1d8233370c2b50042bf9b0817f321edda7811098d
|
|
| MD5 |
b8f8c45c19a22050fc75abf443d7845f
|
|
| BLAKE2b-256 |
518a29e034f395491bbb4d4d349c796519f56fceb01adfcaac3b1fb84eb5f340
|