Skip to main content

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

Metadata

Release files for indiepixel 0.9.0

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

Source distribution (sdist)

Source distribution for indiepixel 0.9.0
File Size Uploaded
indiepixel-0.9.0.tar.gz 332.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for indiepixel 0.9.0
File Interpreter ABI Platform
indiepixel-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 651.5 kB

Release files / indiepixel-0.9.0.tar.gz

Download URL indiepixel-0.9.0.tar.gz
Size 332.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3e96e9c9a56333636c41946b8952d11c8e30fd383281ef66f1c880c3aadd76ee
BLAKE2b-256 checksum
How to use checksums
5cb7d23ab9d4790e9af3f956eee52c3094f3a8523ed6e773a3eedebf241a9798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.18

Release files / indiepixel-0.9.0-py3-none-any.whl

Download URL indiepixel-0.9.0-py3-none-any.whl
Size 319.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a53d7c11909e5ca8812ae167a0934bb62e1cb33cac19c71eee65d23e5f9643af
BLAKE2b-256 checksum
How to use checksums
d895294ae823544394184f5f4f675f40b98d77e67c452cba89f954af19c4f314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.18

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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