Skip to main content

Lithophane & Spiral Betty Generator

Project description

🌟 Lumina

Python 3.10+ License: MIT Tests

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.txt then pip install -e .
  • Runs style checks in check-only mode (so CI does not mutate files):
    • isort --check-only .
    • black --check .
    • ruff check .
  • Runs pytest with coverage and uploads the generated coverage.xml artifact. 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-files in 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)

  1. Create and activate a virtualenv:
python -m venv .venv
source .venv/bin/activate
  1. Install dependencies and the package in editable mode:
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
  1. 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"
  1. 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 secret PYPI_API_TOKEN is set (token created on PyPI).
  • The publish.yml workflow 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-files locally before pushing; CI will reject pushes that aren’t formatted.
  • If you prefer CI to be less strict about formatting, we can remove --fix from the ruff pre-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: true to avoid 409 Conflict when 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

lumina_tools-0.1.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lumina_tools-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file lumina_tools-0.1.0.tar.gz.

File metadata

  • Download URL: lumina_tools-0.1.0.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

Hashes for lumina_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f079a8feee5e523072f2b8abd055dcbda1fbe16c084c3307f35a5dfe5e8a5c8
MD5 b2c81d5874f7a830b0e6ebc489dd98bb
BLAKE2b-256 1d2ffdb4926c4621e211b8917a23005fa1ad475f04909ecd66e8f95503ac7b53

See more details on using hashes here.

File details

Details for the file lumina_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lumina_tools-0.1.0-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

Hashes for lumina_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ead24701a18ec59a105499f479c0014b79dd5c0df64f924f3f1829c496c25eef
MD5 8b68e8c2994ce8065c4f15888dad2b5e
BLAKE2b-256 35e3957db39456db4dbdbbe928d6679283fe56f7710907203b41b90dbe5ef071

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page