pymunk

Pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python

https://github.com/viblo/pymunk

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

library physics-2d physics-engine physics-simulation pygame pyglet python python-library
Last synced: 4 months ago · JSON representation ·

Repository

Pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python

Basic Info
  • Host: GitHub
  • Owner: viblo
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage: http://www.pymunk.org
  • Size: 30.2 MB
Statistics
  • Stars: 1,013
  • Watchers: 17
  • Forks: 191
  • Open Issues: 20
  • Releases: 15
Topics
library physics-2d physics-engine physics-simulation pygame pyglet python python-library
Created about 12 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog License Citation

README.rst

Pymunk
======

.. image::  https://raw.githubusercontent.com/viblo/pymunk/master/docs/src/_static/pymunk_logo_animation.gif

Pymunk is an easy-to-use pythonic 2D physics library that can be used whenever 
you need 2D rigid body physics from Python. Perfect when you need 2D physics 
in your game, demo or simulation! It is built on top of Munk2D, a fork of the 
very capable 2D physics library `Chipmunk2D `_.

The first version was released in 2007 and Pymunk is still actively developed 
and maintained today, more than 15 years of active development!

Pymunk has been used with success in many projects, big and small. For example: 
3 Pyweek game competition winners, dozens of published scientific 
papers and even in a self-driving car simulation! See the Showcases section on 
the Pymunk webpage for some examples.

2007 - 2025, Victor Blomqvist - vb@viblo.se, MIT License

This release is based on the latest Pymunk release (7.1.0), 
using Munk2D 2.0.1 rev ade7ed72849e60289eefb7a41e79ae6322fefaf3.


Installation
------------

In the normal case Pymunk can be installed from PyPI with pip::

    > pip install pymunk

It has one direct dependency, CFFI.

Pymunk can also be installed with conda, from the conda-forge channel::

    > conda install -c conda-forge pymunk

For more detailed installation instructions, please see the complete Pymunk 
documentation.

Example
-------

Quick code example::
    
    import pymunk               # Import pymunk..

    space = pymunk.Space()      # Create a Space which contain the simulation
    space.gravity = 0,-981      # Set its gravity

    body = pymunk.Body()        # Create a Body
    body.position = 50,100      # Set the position of the body

    poly = pymunk.Poly.create_box(body) # Create a box shape and attach to body
    poly.mass = 10              # Set the mass on the shape
    space.add(body, poly)       # Add both body and shape to the simulation

    print_options = pymunk.SpaceDebugDrawOptions() # For easy printing 

    for _ in range(100):        # Run simulation 100 steps in total
        space.step(0.02)        # Step the simulation one step forward
        space.debug_draw(print_options) # Print the state of the simulation

This will print (to console) the state of the simulation. For more visual, 
detailed and advanced examples, take a look at the included demos.  
They are included in the Pymunk install, in the pymunk.examples subpackage. 
They can be run directly. To list the examples::

    > python -m pymunk.examples -l

And to run one of them::

    > python -m pymunk.examples.index_video


Contact & Support
-----------------
.. _contact-support:

**Homepage**
    http://www.pymunk.org/

**Stackoverflow**
    You can ask questions/browse old ones at Stackoverflow, just look for 
    the Pymunk tag. http://stackoverflow.com/questions/tagged/pymunk

**E-Mail**
    You can email me directly at vb@viblo.se

**Issue Tracker**
    Please use the issue tracker at Github to report any issues you find. This 
    is also the place for feature requests:
    https://github.com/viblo/pymunk/issues
    
Regardless of the method you use I will try to answer your questions as soon 
as I see them. (And if you ask on Stackoverflow other people might help as 
well!)


Documentation
-------------

The full documentation including API reference, showcase of usages and 
screenshots of examples is available on the Pymunk homepage, 
http://www.pymunk.org


The Pymunk Vision
-----------------

    "*Make 2D physics easy to include in your game*"

It is (or is striving to be):

* **Easy to use** - It should be easy to use, no complicated code should be 
  needed to add physics to your game or program.
* **"Pythonic"** - It should not be visible that a c-library (Chipmunk) is in 
  the bottom, it should feel like a Python library (no strange naming, OO, 
  no memory handling and more)
* **Simple to build & install** - You shouldn't need to have a zillion of 
  libraries installed to make it install, or do a lot of command line tricks.
* **Multi-platform** - Should work on both Windows, \*nix and OSX.
* **Non-intrusive** - It should not put restrictions on how you structure 
  your program and not force you to use a special game loop, it should be 
  possible to use with other libraries like Pygame and Pyglet. 

  
Dependencies / Requirements
---------------------------

Basically Pymunk have been made to be as easy to install and distribute as 
possible, usually `pip install` will take care of everything for you.

- Python (Runs on CPython 3.8 and later and Pypy3)
- Chipmunk (Prebuilt and included when using binary wheels)
- CFFI (will be installed automatically by Pip)
- Setuptools (should be included with Pip)

* GCC and friends (optional, you need it to compile Pymunk from source. On 
  windows Visual Studio is required to compile)
* Pygame or Pygame-CE (optional, you need it to run the Pygame based demos)
* Pyglet (optional, you need it to run the Pyglet based demos)
* Matplotlib & Jupyter Notebook (optional, you need it to run the Matplotlib 
  based demos)
* Numpy (optional, you need to it run a few demos)
* Sphinx & aafigure & sphinx_autodoc_typehints (optional, you need it to build 
  documentation)


Older Pythons
-------------

- Support for Python 2 (and Python 3.0 - 3.5) was dropped with Pymunk 6.0.
- Support for Python 3.6 was dropped with Pymunk 6.5.2.
- Support for Python 3.7 was dropped with Pymunk 6.9.0.
- Support for Python 3.8 was dropped with Pymunk 7.0.0.

If you use any of these legacy versions of Python, please use an older 
Pymunk version. (It might work on newer Pymunks as well, but it's not tested, 
and no wheels are built.)

Owner

  • Name: Victor Blomqvist
  • Login: viblo
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software and want to cite it, please do so as below."
authors:
  - family-names: "Blomqvist"
    given-names: "Victor"
title: "Pymunk"
abstract: "A easy-to-use pythonic rigid body 2d physics library"
version: 7.1.0
date-released: 2025-06-29
url: "https://pymunk.org"

GitHub Events

Total
  • Create event: 8
  • Release event: 4
  • Issues event: 44
  • Watch event: 100
  • Issue comment event: 178
  • Push event: 82
  • Pull request review comment event: 6
  • Pull request review event: 10
  • Pull request event: 13
  • Fork event: 10
Last Year
  • Create event: 8
  • Release event: 4
  • Issues event: 44
  • Watch event: 100
  • Issue comment event: 178
  • Push event: 82
  • Pull request review comment event: 6
  • Pull request review event: 10
  • Pull request event: 13
  • Fork event: 10

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 1,375
  • Total Committers: 21
  • Avg Commits per committer: 65.476
  • Development Distribution Score (DDS): 0.343
Past Year
  • Commits: 80
  • Committers: 4
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.113
Top Committers
Name Email Commits
Victor vb@v****e 904
vb@viblo.se vb@v****e@7****a 359
google@viblo.se g****e@v****e@7****a 58
hager@linuxuser.at h****r@l****t@7****a 21
René Dudfield r****d@g****m 10
VeriTas-arch 1****h 7
Mikhail Simin m****n@g****m 2
(no author) (****)@7****a 1
Szymon Zmilczak s****k@g****m 1
Fabian Dill B****6 1
Jordan Doerksen j****n@s****a 1
Mohamed Saad Ibn Seddik m****k@g****m 1
Oleh Prypin o****h@p****n 1
Rohan Aras r****s 1
Simon Norberg s****n@p****e 1
Steve Ziuchkovski z****1@g****m 1
Voxlinou 7****e 1
anthemion a****n 1
cclauss c****s@m****m 1
conductiveIT 6****T 1
raaperrotta r****a@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 133
  • Total pull requests: 34
  • Average time to close issues: 6 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 85
  • Total pull request authors: 21
  • Average comments per issue: 4.47
  • Average comments per pull request: 2.53
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 27
  • Pull requests: 11
  • Average time to close issues: 22 days
  • Average time to close pull requests: 10 days
  • Issue authors: 15
  • Pull request authors: 7
  • Average comments per issue: 3.44
  • Average comments per pull request: 1.55
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aatle (12)
  • viblo (11)
  • illume (8)
  • GuillaumeBroggi (4)
  • jkterry1 (4)
  • Python-ZZY (3)
  • zipandrar (3)
  • einarf (3)
  • eschan145 (2)
  • nrichards (2)
  • LennyPhoenix (2)
  • MichaelQuaMan (2)
  • rdesc (2)
  • gaorkl (1)
  • Derpford (1)
Pull Request Authors
  • VeriTas-arch (6)
  • illume (6)
  • viblo (4)
  • aatle (2)
  • eschan145 (2)
  • rohanaras (2)
  • marcpabst (2)
  • bimoware (2)
  • Python-ZZY (2)
  • imMadsen (2)
  • sim1234 (1)
  • msis (1)
  • anthemion (1)
  • cclauss (1)
  • jtakalai (1)
Top Labels
Issue Labels
enhancement (2) imported (2) Priority-Medium (2)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 148,131 last-month
  • Total docker downloads: 24,427,249
  • Total dependent packages: 39
    (may contain duplicates)
  • Total dependent repositories: 474
    (may contain duplicates)
  • Total versions: 52
  • Total maintainers: 2
pypi.org: pymunk

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

  • Versions: 41
  • Dependent Packages: 39
  • Dependent Repositories: 471
  • Downloads: 148,131 Last month
  • Docker Downloads: 24,427,249
Rankings
Dependent packages count: 0.5%
Dependent repos count: 0.7%
Docker downloads count: 0.7%
Average: 0.8%
Downloads: 1.4%
Maintainers (1)
Last synced: 4 months ago
conda-forge.org: pymunk

Pymunk is an easy-to-use pythonic 2D physics library that can be used whenever you need 2D rigid body physics from Python. Perfect when you need 2D physics in your game, demo or simulation! It is built on top of Munk2D, a fork of the very capable 2D physics library Chipmunk2D <http://chipmunk-physics.net>.

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 3
Rankings
Forks count: 13.3%
Stargazers count: 14.4%
Dependent repos count: 18.1%
Average: 24.4%
Dependent packages count: 51.6%
Last synced: 4 months ago
pypi.org: piepunk

piepunk is fork of a easy-to-use pythonic 2D physics library

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.9%
Average: 32.7%
Dependent repos count: 55.5%
Maintainers (1)
Last synced: about 1 year ago

Dependencies

docs/requirements.txt pypi
  • aafigure *
  • reportlab *
  • sphinx >=3.0
setup.py pypi
  • cffi *
.github/workflows/wheels.yml actions
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v2 composite
  • joerick/cibuildwheel v2.11.2 composite
  • mymindstorm/setup-emsdk v11 composite
benchmarks/Dockerfile docker
  • thekevjames/nox latest build
pyproject.toml pypi