skillfed

permutation

Permutations of finitely many positive integers

permutation v0.5.0 142.9K downloads/30d#11,196 on PyPI17
Permissive license MIT Active released

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 permutation

uv

uv add permutation

poetry

poetry add permutation

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: MathematicsTyping :: Typed

Tags

permutation group theorycycle notation permutationssymmetric group operationspermutation compositioncycle decompositionpermutation inverse order paritylehmer code permutation
group-theorycombinatoricstyped

More Mathematics packages