skillfed

pymunk

Pymunk is a easy-to-use pythonic 2D physics library

pymunk v7.3.0 379.1K downloads/30d#7,111 on PyPI1,062
Permissive license MIT Active released

What it is and what it does

Pymunk wraps the Chipmunk2D physics engine in a Pythonic API, letting you simulate 2D rigid bodies, collisions, and constraints without writing C code. You create a Space (simulation container), add bodies with shapes, set gravity and other properties, then step the simulation forward in time. It's designed to integrate with game frameworks or run standalone for physics demos and scientific simulations.

The library has been actively maintained since 2007 and is used in published research, game competition winners, and autonomous vehicle simulations. It requires Python 3.9 or later and depends only on cffi; binary wheels are available for Windows, macOS, and Linux on multiple architectures, making installation straightforward via pip.

Use it for:

  • Add realistic gravity, collisions, and rigid body dynamics to a game without implementing physics from scratch
  • Simulate mechanical systems, pendulums, or constraint-based structures for research or educational demonstrations
  • Prototype 2D physics interactions in a notebook or standalone script for algorithm validation
  • Build interactive physics sandboxes where users can create and manipulate bodies and constraints in real time
  • Test collision detection and response logic for game level design or agent navigation

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pymunk is a 2D rigid body physics simulation library for Python, providing collision detection, body dynamics, and constraint solving built on the Chipmunk2D engine.

Yes. Pymunk is a mature, actively maintained library with no known vulnerabilities, permissive MIT licensing, and a single lightweight dependency. Install friction is medium but manageable via prebuilt wheels. It is the right choice if you need 2D rigid body physics in Python—especially for games or simulations—and want to avoid implementing collision and constraint solvers yourself.

Install

pymunk on PyPI

pip

pip install pymunk

uv

uv add pymunk

poetry

poetry add pymunk

Installing pymunk

Before you install

Medium install friction due to compiled wheels for multiple platforms and Python versions. Active maintenance with recent release (58 days ago) and 1062 repository stars. Single runtime dependency (cffi) is lightweight.

License in practice

MIT license permits commercial and private use with minimal restrictions—suitable for games, simulations, and research projects without licensing concerns.

Quickstart

pip install pymunk

import pymunk

space = pymunk.Space()
space.gravity = 0, -981
body = pymunk.Body()
body.position = 50, 100
poly = pymunk.Poly.create_box(body)
poly.mass = 10
space.add(body, poly)
space.step(0.02)

Requires Python 3.9 or later; binary wheels available for common platforms, but compilation from source requires a C compiler.

Verify before relying

  • Whether performance is suitable for real-time game loops at typical frame rates
  • Stability and API compatibility guarantees across minor version updates
  • Whether constraint types and joint options cover specific simulation needs

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — cffi
Maintenance actively maintained — 58 days since the last release
Last repo commit
First released
Downloads 379,140/month — #7,111 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymunk-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl; pymunk-7.3.0-cp310-cp310-macosx_11_0_arm64.whl; pymunk-7.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymunk-7.3.0-cp310-cp310-musllinux_1_2_aarch64.whl; pymunk-7.3.0-cp310-cp310-musllinux_1_2_x86_64.whl; pymunk-7.3.0-cp310-cp310-win32.whl; pymunk-7.3.0-cp310-cp310-win_amd64.whl; pymunk-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl; pymunk-7.3.0-cp311-cp311-macosx_11_0_arm64.whl; pymunk-7.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymunk-7.3.0-cp311-cp311-musllinux_1_2_aarch64.whl; pymunk-7.3.0-cp311-cp311-musllinux_1_2_x86_64.whl; pymunk-7.3.0-cp311-cp311-win32.whl; pymunk-7.3.0-cp311-cp311-win_amd64.whl; pymunk-7.3.0-cp312-cp312-macosx_10_13_x86_64.whl; pymunk-7.3.0-cp312-cp312-macosx_11_0_arm64.whl; pymunk-7.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Keywords: pygame, 2d, physics, rigid body

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Games/EntertainmentTopic :: Scientific/Engineering :: PhysicsTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: pygame

Tags

2d physics simulation pythonrigid body physics librarycollision detection 2dgame physics enginepymunk chipmunk2d physics gamesphysics constraints solver
game-physicssimulation2d-graphics

More Libraries packages