Passer
A Python 2D game framework in the spirit of Sparrow and Starling — the Flash-style display list, reborn on moderngl (rendering) and pyglet (window, input, audio).
The sparrow (genus Passer) flies again — this time in Python.
Leggi il README in italiano.
from passer import App, Quad
app = App(400, 300, "Hello Passer")
quad = app.stage.add_child(Quad(100, 100, color=0xFF3355))
quad.align_pivot()
quad.x, quad.y = 200, 150
app.run(lambda dt: setattr(quad, "rotation", quad.rotation + dt))
Why
Sparrow brought Flash's display list to iOS, and Starling carried it to a whole generation of 2D games: a scene graph with hierarchical transforms, tweens, jugglers and texture atlases — an ergonomics the Python 2D ecosystem (flat sprite lists) never had. Passer brings that architecture to Python, with a batching renderer on modern OpenGL that can be tested headless, down to the pixel.
Features
- Scene graph —
Sprite,Quad,Image,Mesh, hierarchical transforms (pivot, scale, rotation, skew), bubbling events, touch and keyboard input, hit testing that follows actual geometry - Starling 2 rendering core — CPU-transformed mesh batching
(
MeshBatch/BatchProcessor): one draw call per state run - Mesh styles — plug your own GLSL shader into any mesh without
breaking batching (
MeshStyle/MeshEffect) - Distance field text & shapes — crisp at any scale, with outline, glow and drop shadow in a single pass; built-in SDF generator (exact euclidean distance transform, pure Python)
- Masks — stencil-based, rotated and nested, inverted masks included
- Blend modes — add, multiply, screen, erase, mask, below + custom
- Canvas & Polygon — filled polygons (ear-clipping triangulation), circles, rounded rectangles, quadratic/cubic Bézier paths
- Filters — blur, color matrix, drop shadow, glow, and
FilterChainto compose them; pooled render targets - RenderTexture — draw once, render forever (trails, painting, destructible terrain)
- Animation —
Juggler,Tween(with transitions),MovieClip, delayed calls - Text — AngelCode bitmap fonts, embedded 8px "mini" font (plus its distance-field twin, generated at runtime)
- AssetManager — enqueue folders, load with progress, fetch everything by name; atlas regions found automatically
- Desktop citizenship — letterbox scaling (fit/integer/stretch), fullscreen, mouse wheel, hover
Install
pip install passer-2d
Requires Python ≥ 3.10 and OpenGL 3.3. Linux, Windows and macOS (everything pyglet + moderngl support).
Tested where it counts
The whole rendering pipeline is exercised by 134 tests that render on a headless standalone GL context and assert on real pixels — masks, blend modes, filters, distance fields, triangulation. No window needed; they run in CI.
Demos
The demos/ folder is a tour: a mini platformer with the
original Sparrow assets, vector night scenes, playing cards drawn with
Bézier curves, plasma shaders, stencil-mask lanterns, drop shadows,
SDF typography, and the three-line AssetManager pantry.
Heritage & license
Passer is a conceptual port of the Sparrow Framework and of Starling 2
(© Gamua GmbH, Simplified BSD) — same architecture, pythonic API
(snake_case, properties, duck typing). Passer itself is released
under the Simplified BSD license; see LICENSE.md.
A heads-up for contributors: the codebase is documented in Italian (docstrings and comments) — the author's native tongue. The API itself is plain English.
Release files for passer-2d 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| passer_2d-0.9.1.tar.gz | 110.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| passer_2d-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 199.3 kB
Release files / passer_2d-0.9.1.tar.gz
| Download URL | passer_2d-0.9.1.tar.gz |
|---|---|
| Size | 110.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c030297279b83d557e5989aad282c3280b32ff82f09246dc213a64adfc4d79f
|
|
BLAKE2b-256 checksum How to use checksums |
0bbd450e01874de294da3e55a40fa9c5642fc049d6fb06d003c9693d11da07e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / passer_2d-0.9.1-py3-none-any.whl
| Download URL | passer_2d-0.9.1-py3-none-any.whl |
|---|---|
| Size | 88.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
290b5c9b85ccf50dc6b9e02dab55d7af29c1334f719ff89674176b60e7ee87d5
|
|
BLAKE2b-256 checksum How to use checksums |
d61c724f09a5369897fc2420be8d2916dcbef1b378445d12ef3925235b0a4de2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|