Pymunk

Latest version: v6.11.1

Safety actively analyzes 706259 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 8

6.4.0

-------------------------

**Support Pyglet 2 debug drawing!**

This is a minor update, with the main change being support for the recently
released Pyglet 2. At the same time support for Pyglet 1.5.x has been
deprecated, and when using pyglet_util with pyglet 1.x a warning will be
logged about the deprecation. The other big change is that the examples
have been moved into pymunk.examples subpackage, so they can easily be run
even when Pymunk is installed from a wheel.

Changes:

- Support for debug drawing using Pyglet 2.0
- Using pyglet 1.5 is deprecated and will be removed in a future version.
- Moved examples into the distribution as the pyumnk.examples package.
- Improved type hints

6.3.0

-------------------------

**Build wheel for CPython 3.11!**

This is a minor update with changes to be build pipe to build wheels for
CPython 3.11. Some internal parts have been rewritten as well.

Changes:

- Update callbacks implemention to the cffi recommended way
- Improve Asserts to catch errors earlier
- Improve type hints
- Build wheels for more targets
- Remove experimental body._id

6.2.1

-------------------------

**Build wheel for CPython 3.10!**

This is a minor update with changes to the build pipe to build wheels for more
cases, notably the recently released CPython 3.10.

Changes:

- Use pyproject.toml
- Require CFFI 1.15 to make sure wheels are build ok on Apple ARM64/M1.
- Doc improvements
- Build wheels for more targets

6.2.0

-------------------------

**Improved transforms for debug drawing!**

This release contains enhancements to transform usage with debug drawing,
and an update to latest git version of Chipmunk. It also contains a new
example of how gravity in the center could be implemented.

Changes:

- Updated Chipmunk to latest git version
- Updated debug draw to support rotation, and fixed scaling of constraints
- New example of "planet" gravity (ported from Chipmunk)
- Fixed potential corner case bug in garbage collection logic

6.1.0

-------------------------

**Transforms for debug drawing!**

The main improvement in this release is that its now possible to set a
Transform on the SpaceDebugDrawOptions object, which is applied before
anything is drawn. This works in all the debug draw implementation, e.g. for
pygame. In this way its possible to easily implement features such as camera
panning easily for debug draw code. See the new camera.py example for an
example of this.

Changes:

- Added transform property to SpaceDebugDrawOptions.
- Extended Transform to allow allow matrix multiplication using , either
with another Transform or with a Vec2d.
- Improved error handling when adding objects to a space.
- Improved docs.

6.0.0

-------------------------

**Typehints, dropped Python 2, and Vec2d rework and wrapping upgrade!**

This release is a very big update to Pymunk, with a number of breaking
API changes. It is likely that most users of Pymunk that upgrade will need
to do some changes to work, but in the majority of cases the changes should
be minor.


Highlights - Major changes:

- Python 3.6 or newer required. Support for older Pythons including 2.7 has
been dropped.
- Type hints added. Type hints have been added for all public interfaces.
- Vec2d (the vector class) has been completely overhauled. It is now a
immutable subclass of ``NamedTuple``, with a streamlined API interface. See
below for details.


Vec2d changes:

- Vec2d no longer accept objects that have ``.x`` and ``.y`` properties,
but do not support ``__getitem__`` for ``[0]`` & ``[1]`` in the
constructor. If you have such an objects, rewrite ``Vec2d(myobj)`` to
``Vec2d(myobj.x, myobj.y)``.
- Vec2d is now Immutable.

- removed ``__setitem__`` (you can not do ``Vec2d(1,2)[1] = 3`` anymore).
- not possible to set the length property. ``Vec2d(1,2).length = 10``,
instead use ``Vec2d(1,2).scale_to_length(10)``.
- removed ``Vec2d.get_length`` method (use the length property instead).
- removed ``Vec2d.rotate()`` method. use ``Vec2d.rotated()`` instead.
- removed ``Vec2d.rotate_degrees()`` method. use ``Vec2d.rotated_degrees``
instead.
- not possible to set the angle property (``Vec2d(1,2).angle = 3.14``). Use
``Vec2d.rotated()`` instead.
- removed ``Vec2d.get_angle`` method (use the ``angle`` property instead).
- not possible to set the ``angle_degrees`` property
(``Vec2d(1,2).angle_degrees = 180``). Use ``Vec2d.rotated_degress``
instead.
- removed ``Vec2d.get_angle_degrees`` method (use the ``angle_degrees``
property instead)
- removed ``Vec2d.normalize_return_length`` method (use ``Vec2d.length`` and
``Vec2d.normalized()``, or the new ``Vec2d.normalized_and_length method``).
- removed ``__iadd__``, ``__isub__``, ``__imul__``, ``__ifloordiv__`` and
``__itruediv__``).

- Removed ``__nonzero__`` magic. This never worked in Python 3, and was not
included in any tests.
- Removed ``__pow__`` and ``__rpow__`` magic. Its no longer possible to do
``Vec2d(1,2)**2``, instead you need to do the calculation manually.
- Removed ``__invert__`` magic. Its no longer possible to do ``~Vec2d(1,2)``.
- Removed ``__mod__`` and ``__divmod__`` magic. Its no longer possible to do
``Vec2d(1,2) % 2`` or ``divmod(Vec2d(1,2), 2)``.
- Removed bit operations right shift, left shift, or, and, xor.
(``<<``, ``>>``, ``|``, ``&``, ``^``).
- Changed ``abs(Vec2d(1,2))`` to return the expected vector length instead of
``Vec2d(abs(x), abs(y))``.
- Vec2d now only support addition with other Vec2ds or tuples (sequences) of
length 2.
- Vec2d now only support subtraction with other Vec2ds or tuples (sequences)
of length 2.
- Vec2d now only support multiplicaton with ints and floats.
- Vec2d now only support division by ints and floats. Note that reverse
division is not supported, i.e. ``1 / Vec2d(1,2)``.
- Vec2d now only support floor division (``//``) by ints and floats. Note
that reverse floor division is not supported, i.e. ``1 // Vec2d(1,2)``.
- Improved error checking in Vec2d when an opertor (magics like ``__add__``)
is used with incompatible types.
- Removed option to create a zero Vec2d with empty constructor. ``Vec2d()``
should be replaced with ``Vec2d.zero()``.
- Made ``Vec2d`` a subclass of ``NamedTuple``.

- Vec2ds has to be constructed with separate ``x`` and a ``y`` values.
- ``Vec2d((1,2))`` can be changed to ``Vec2d(*(1,2))``.
- ``Vec2d(Vec2d(1,2))`` can be changed to ``Vec2d(*Vec2d(1,2))``.
- ``Vec2d()`` can be changed to ``Vec2d(0,0)`` or ``Vec2d.zero()``.
- ``Vec2d(1,2)`` is no longer equal to ``[1,2]`` since they are of
different types. (but ``Vec2d(1,2) == (1,2)`` is still true)

- Relaxed ``get_angle_between``, ``convert_to_basis``, ``cpvrotate`` and
``cpunvrotate`` to accept tuples of size 2 as arguments just like most
other methods on Vec2d.


General Changes:

- ``add_collision_handler(a,b)`` and ``add_collision_handler(b,a)`` will return the
same handler. Issue 132.
- Bodies used by shapes must be added to the space before (or at the same
time) the shape is added. This change will help users of Pymunk uncover
bugs, and it should be straight forward to fix old code.
- Python 3.6+ required. If you use a older Python, please continue to use the
5.x series of Pymunk until its possible to upgrade.
- ``Space.add()`` and ``Space.remove()`` no longer accept lists of objects
(shapes, bodies or constraints), only the objects directly. Existing code
can be updated to unpack the arguments: ``space.add(list_of_stuff)`` becomes
``space.add(*list_of_stuff)``.
- ``ShapeFilter.ALL_MASKS`` and ``CATEGORIES`` changed to static methods.
``ShapeFilter.ALL_MASKS`` becomes ``ShapeFilter.ALL_MASKS()`` and
``ShapeFilter.CATEGORIES`` becoems ``ShapeFilter.CATEGORIES()``.
- Note: a tuple of 4 numbers are required when specifying a color (or use the
``SpaceDebugColor`` class directly). During testing it was found that some
demos used a tuple of 3 instead which does not work in Pymunk 6.0 (or
earlier version).
- Return a ``PointQueryInfo`` object from ``Shape.point_query``, not the
previous ``(distance, PointQueryInfo)`` tuple. Code that need the distance
can access it from ``PointQueryInfo.distance``.
- Removed ``pymunk.inf``. Use standard Python ``float('inf')`` instead.
- Renamed package ``pymunk.constraint`` to ``pymunk.constraints``. Code that
imported the previous name should be updated to import from the new name
instead.
- Changed ``pygame_util.positive_y_is_up`` default value to ``False``.
Existing code dependent on the old default should set the desired value
(``True``). For new code it might be better to instead make the Pymunk
simulation behave like the native pygame coordinates. See examples in
examples folder for examples.
- It is now expected that places functions expecting a ``Vec2d`` or tuple of
length 2 already are a tuple (or ``Vec2d``). Previously a conversion happed
by calling ``tuple(argument)``. To fix old code simply wrap the argument in
``tuple( ... )``. (Note: Due to no type checks a list of length 2 might
also work, however, this is not supported and can change any time.
- ``BB`` base class changed to ``NamedTuple``. They now has to be
constructed with ``left``, ``bottom``, ``right``, ``top`` as separate
arguments.
- Repr of ``BB`` will return ``BB(left=1, bottom=5, right=20, top=10)``
instead of ``(1, 5, 20, 10)``.
- ``BB`` is now immutable.
- New callbacks on ``Constraint`` object, ``pre_solve`` and ``post_solve``,
which can be used to run a function just before or after the solver on the
constraint.
- Added helper methods on ``Transform`` to easily create transforms to
translate, scale and rotate.
- Removed now unused pymunkoptions module.
- Changed type of autogeometry ``march_*.sample_func`` to expect a tuple of
length 2 instead of a Vec2d (to improve performance). Issue 126.
- Removed ``march_*.segment_func`` argument, and instead return a
``PolylineSet`` with the result. This allows future optimizations, and is
easier to use. Issue 126.
- Added code to make Pymunk work without extra config in PyInstaller, py2exe
and probably other bundlers as well.
- Debug logging addded to easier understand c memory issues. Uses
logging.debug so should be easy to work around.

Minor changes unlikely to affect existing code:

- Removed ``pymunk.chipmunk_path``.
- Changed ``Shape.sensor`` type to bool (from int).
- Add check that pickled objects were pickled by the same Pymunk version as
the code loading it. The internal pickled format can change between major,
minor and point releases of Pymunk.
- Slight change of format of ``pymunk.chipmunk_version`` version string.
- Small change to make the collision handler functions (``begin``,
``pre_step``...) return the function assigned, not the wrapped function.
- Removed extra ``*args`` and ``**kwargs`` arguments to
``CollisionHandler.__init__`` method.
- Pymunk source code formatted with black & isort.
- ``moment_for_poly()`` and ``area_for_poly()`` now expects a Sequence
(tuple/list like object) of tuples of length 2.
- Added default value of argument ``point`` to ``apply_force_at_local_point``.
- Removed default value of argument point from
``apply_impulse_at_world_point``. Just specify ``point = (0,0)`` to mimic
the old default.
- Added many asserts to check that whenever a tuple of length 2 or ``Vec2d``
is expected the length of the tuple is 2. Working code is unlikely
affected, but bugs will be easier to find.


Behind the scenes:

- In order to allow adding some advanced features that are not available in
Chipmunk today the method used to call C-code has changed to CFFI API mode.
In addition to easier expansion it also provides increased performance.

Page 3 of 8

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.