skillfed

PyRect

PyRect is a simple module with a Rect class for Pygame-like rectangular areas.

pyrect v0.2.0 2.9M downloads/30d#2,834 on PyPI13
Permissive license BSD DORMANT released

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 pyrect

uv

uv add pyrect

poetry

poetry add pyrect

Installing 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

Development Status :: 4 - BetaEnvironment :: MacOS XEnvironment :: Win32 (MS Windows)Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

pygame rect class standalonerectangular area geometryrect coordinates and dimensionspygame-like rect without pygamerectangle position and sizerect collision and positioninggeometric rectangle math
geometrypygame-compatibleno-dependencies

More Graphics packages