permutation
Permutations of finitely many positive integers
What it is and what it does
permutation is a pure-Python library for working with permutations of finitely many positive integers. It provides a Permutation class that lets you construct, compose, and analyze permutations using standard group-theoretic operations. You can represent permutations in cycle notation, compute their inverses and order, check parity, convert to and from Lehmer codes, and use them as callables to map integers.
The package is designed for developers and mathematicians who need to work with permutation groups, symmetric groups, or permutation-based algorithms. It has no external runtime dependencies, making it lightweight to install, and is fully typed. The library supports both CPython and PyPy across modern Python versions.
Use it for:
- Implementing group-theoretic algorithms that require permutation composition and cycle analysis.
- Computing properties of permutations such as order, parity, and cycle structure for mathematical research.
- Building combinatorial or cryptographic tools that manipulate permutations as callable objects.
- Converting between permutation representations (cycle notation, word form, Lehmer codes) for educational or algorithmic purposes.
- Generating and iterating over symmetric groups for exhaustive search or enumeration tasks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Permutation class for representing and manipulating permutations of positive integers, supporting operations like composition, cycle decomposition, inverses, order, parity, and Lehmer codes.
Yes. The package is actively maintained, has zero known vulnerabilities, installs with no friction, and carries a permissive MIT license. It fills a clear niche for group-theoretic permutation work in Python with a well-documented, typed API. Install it if you need to work with permutations; skip it if your use case doesn't involve permutation algebra.
Install
permutation on PyPI
pip
pip install permutationuv
uv add permutationpoetry
poetry add permutationInstalling permutation
Before you install
Low friction installation with no runtime dependencies. Actively maintained as of 2026-07-20 with support across Python 3.8 through 3.13 and PyPy.
License in practice
MIT license (permissive) — you can use, modify, and distribute this package with minimal restrictions, including in proprietary software.
Quickstart
pip install permutation
from permutation import Permutation
p = Permutation(2, 1, 4, 5, 3)
print(p.to_cycles()) # [(1, 2), (3, 4, 5)]
print(p.order) # 6
Requires Python 3.8 or higher.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 621 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 142,933/month — #11,196 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: permutation-0.5.0-py3-none-any.whl
Keywords: group theory, math, mathematics, maths, permutation, symmetric group
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
passagemath-gapProvides Python interfaces to the GAP…
copyleft · top 15,000 on PyPI
poseidon-pyPoseidon hash implementation in Python with a…
unclear · top 15,000 on PyPI
primePyProvides functions to test primality, factor…
permissive · top 5,000 on PyPI
ldpcProvides decoders for low-density parity check…
permissive · top 15,000 on PyPI
passagemath-categoriesProvides Sage categories, basic rings,…
copyleft · top 15,000 on PyPI
multisetProvides a mutable and immutable multiset data…
permissive · top 15,000 on PyPI
cypari2cypari2 provides a Python interface to PARI/GP,…
copyleft · top 15,000 on PyPI
gram-newton-schulzImplements a hardware-aware Gram Newton-Schulz…
permissive · top 15,000 on PyPI
graycodeConverts between two's complement integers and…
permissive · top 15,000 on PyPI
pyroaringProvides an efficient, ordered set data…
permissive · top 1,000 on PyPI