Skip to main content

Generate pixel graphics for the Tidbyt

Project description

Indiepixel

PyPI - Version

Contributions more than welcome!

Basically… pixlet in Python.

Why?

This is an example for generating images for the Tidbyt device, a nice LED display. The company that made the Tidbyt got acquihired and won't be developing the software much in the future.

Pixlet was very convenient, but is an oddball for a tech stack: implemented in Go for people to consume in Starlark. Starlark is a niche language. It'd be nice to support a mainstream language.

This is a WIP implementation of the same concepts as pixlet in Python.

Getting started

First, install indiepixel with uv.

I use mise to manage my versions, so I'd start out with

mise install python uv

But that's optional if you have global installations of Python and uv that you like. Also: this process works without uv, with pip etc: if you're a Python expert, you can probably piece that together.

Initialize your project:

uv init

Then install indiepixel

uv add indiepixel

Create a widget file, like clock.py:

import datetime
from indiepixel import Box, Root, Row, Text

def main():
    now = datetime.datetime.now()
    return Root(
        child=Box(
            Row(children=[
                Text(content=now.strftime("%I:%M %p"), color="#fff"),
            ]),
            padding=2,
            background="#000",
        ),
    )

Then run it:

uv run indiepixel clock.py

Open http://localhost:5000 in your browser and you'll see the clock rendering. You can also point indiepixel at a directory of widget files and it'll show all of them in its web interface.

Deploying

I like to deploy this with Render but it's totally up to you. Again, Python experts probably can just figure this out, but with Render:

Set up Render to deploy from a repo containing your pyproject.toml and clock.py (or whatever widgets you've written)

Render doesn't support uv and it's rough to install. So dump those dependencies into requirements.txt so the old-fashioned package managers can understand them:

uv pip freeze > requirements.txt

Your render start command will look like:

indiepixel src/clock.py

And add an environment variable like:

PYTHON_VERSION=3.13.2

To your environment so that it uses a modern version of Python.

Development

Environment setup

First make sure you have uv installed.

Install dependencies with:

uv sync

Install pre-commit hooks:

uv run pre-commit install

Running examples

To run examples:

uv run indiepixel examples/cli/gradient.py

Running tests

uv run pytest

Linting and formatting

uv run pre-commit run --all-files

Or run ruff directly

uv run ruff check
uv run ruff format --check

Publishing

This needs you to build before publishing:

  1. Bump version in pyproject.toml
  2. uv build
  3. uv publish

Status

* = currently not tidbyt-compatible

  • WebP generation
  • Rendering the tb-8 pixel font without anti-aliasing
  • Fonts
  • Components
    • Text
    • Box*
    • Rect*
    • Column
    • Row
    • Root
    • Stack
    • Circle
    • PieChart
    • Image
    • Animation
    • WrappedText
      • Resizing
      • Animation
    • Plot
    • Row/Column expanded, main_align, cross_align

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

indiepixel-0.9.0.tar.gz (332.4 kB view details)

Uploaded Source

Built Distribution

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

indiepixel-0.9.0-py3-none-any.whl (319.2 kB view details)

Uploaded Python 3

File details

Details for the file indiepixel-0.9.0.tar.gz.

File metadata

  • Download URL: indiepixel-0.9.0.tar.gz
  • Upload date:
  • Size: 332.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.18

File hashes

Hashes for indiepixel-0.9.0.tar.gz
Algorithm Hash digest
SHA256 3e96e9c9a56333636c41946b8952d11c8e30fd383281ef66f1c880c3aadd76ee
MD5 c9d7825072f82b347d510f0134e2c231
BLAKE2b-256 5cb7d23ab9d4790e9af3f956eee52c3094f3a8523ed6e773a3eedebf241a9798

See more details on using hashes here.

File details

Details for the file indiepixel-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: indiepixel-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 319.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.18

File hashes

Hashes for indiepixel-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a53d7c11909e5ca8812ae167a0934bb62e1cb33cac19c71eee65d23e5f9643af
MD5 425063889038244bcda865c0c38b36d2
BLAKE2b-256 d895294ae823544394184f5f4f675f40b98d77e67c452cba89f954af19c4f314

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