PyRect
PyRect is a simple module with a Rect class for Pygame-like rectangular areas.
What it is and what it does
PyRect is a lightweight, standalone implementation of a rectangular area class modeled after Pygame's Rect. It lets you create rectangles by specifying top-left corner coordinates, width, and height, then read and modify a rich set of derived attributes—edges (top, left, bottom, right), corners (topleft, topright, etc.), center points, and dimensions—with automatic recalculation of dependent values whenever you change one. The package supports both integer and floating-point coordinates (via an enableFloat flag) and maintains compatibility across Python 2 and 3.
You would use PyRect when you need geometric rectangle operations without importing the full Pygame library—for example, in game logic, UI layout, collision detection, or any code that manipulates rectangular regions. It has no external dependencies and is designed as a drop-in alternative for projects that don't need the rest of Pygame.
Use it for:
- Game development: manage rectangular collision areas and sprite bounds without a full game engine
- UI layout: calculate and adjust rectangular regions for window or widget positioning
- Geometric calculations: compute rectangle intersections, containment, and coordinate transformations
- Collision detection: use rect attributes to test overlap and containment between game objects
- Graphics rendering: define rectangular drawing areas and viewport regions in custom renderers
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyRect provides a Rect class for representing and manipulating rectangular areas, with attributes and calculations similar to Pygame's Rect but as a standalone module.
Yes, if you need Pygame-like rect operations without Pygame and can tolerate a dormant package. The library is small, dependency-free, and stable for its core use case. However, install friction is high (source distribution only), and the last release was in 2022—verify that it meets your Python version and feature needs before committing. No known security vulnerabilities.
Install
pyrect on PyPI
pip
pip install pyrectuv
uv add pyrectpoetry
poetry add pyrectInstalling PyRect
Before you install
Installation friction is high due to source distribution only (PyRect-0.2.0.tar.gz). The package is dormant—last release was 2022-03-16, though the repository remains active with a recent commit on 2024-08-18. No runtime dependencies.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute PyRect freely provided you retain the license notice.
Quickstart
pip install pyrect
import pyrect
r = pyrect.Rect(0, 0, 10, 20)
print(r.width, r.height, r.center)
Verify before relying
- Whether the package is actively maintained or accepting contributions despite dormant status
- Whether high install friction (source distribution only) reflects ongoing build/packaging constraints
- Compatibility with modern Python versions beyond those explicitly listed in classifiers
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | dormant — 1,612 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,895,059/month — #2,834 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: PyRect-0.2.0.tar.gz
Keywords: pygame, rect, rectangular, rectangle, area
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
PyWinBoxPyWinBox manages window positions, sizes, and…
permissive · top 15,000 on PyPI
rectpackRectpack solves the 2D bin packing problem by…
permissive · top 15,000 on PyPI
rectangle-packerPacks a set of rectangles with fixed…
permissive · top 15,000 on PyPI
squarifyComputes treemap layout rectangles from a list…
permissive · top 15,000 on PyPI
pyzbarDecodes one-dimensional barcodes and QR codes…
permissive · top 5,000 on PyPI
py3dbpSolves the 3D bin packing problem by fitting…
permissive · top 5,000 on PyPI
PyScreezePyScreeze captures screenshots and locates…
permissive · top 5,000 on PyPI