{"id":21453433,"url":"https://github.com/lapets/permutations","last_synced_at":"2025-08-25T19:07:35.094Z","repository":{"id":191316327,"uuid":"646321119","full_name":"lapets/permutations","owner":"lapets","description":"Python library for instantiating and working with permutation collections that provide efficient implementations of all sequence methods (including random-access retrieval by index).","archived":false,"fork":false,"pushed_at":"2024-01-10T08:46:41.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T05:50:31.965Z","etag":null,"topics":["combinatorics","iterable","iterables","permutations","python-containers","python-data-structures","python-iterables","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lapets.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-28T02:22:50.000Z","updated_at":"2023-08-29T22:48:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"27006732-2573-453f-a09b-ccc76decda7d","html_url":"https://github.com/lapets/permutations","commit_stats":null,"previous_names":["lapets/permutations"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lapets/permutations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fpermutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fpermutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fpermutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fpermutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lapets","download_url":"https://codeload.github.com/lapets/permutations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fpermutations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272117023,"owners_count":24876305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combinatorics","iterable","iterables","permutations","python-containers","python-data-structures","python-iterables","python-library"],"created_at":"2024-11-23T04:39:37.260Z","updated_at":"2025-08-25T19:07:35.056Z","avatar_url":"https://github.com/lapets.png","language":"Python","readme":"============\npermutations\n============\n\nPython library for instantiating and working with permutation collections that provide efficient implementations of all sequence methods (including random-access retrieval by index).\n\n|pypi| |readthedocs| |actions| |coveralls|\n\n.. |pypi| image:: https://badge.fury.io/py/permutations.svg\n   :target: https://badge.fury.io/py/permutations\n   :alt: PyPI version and link.\n\n.. |readthedocs| image:: https://readthedocs.org/projects/permutations/badge/?version=latest\n   :target: https://permutations.readthedocs.io/en/latest/?badge=latest\n   :alt: Read the Docs documentation status.\n\n.. |actions| image:: https://github.com/lapets/permutations/workflows/lint-test-cover-docs/badge.svg\n   :target: https://github.com/lapets/permutations/actions/workflows/lint-test-cover-docs.yml\n   :alt: GitHub Actions status.\n\n.. |coveralls| image:: https://coveralls.io/repos/github/lapets/permutations/badge.svg?branch=main\n   :target: https://coveralls.io/github/lapets/permutations?branch=main\n   :alt: Coveralls test coverage summary.\n\nPurpose\n-------\n\n.. |itertools_permutations| replace:: ``itertools.permutations``\n.. _itertools_permutations: https://docs.python.org/3/library/itertools.html#itertools.permutations\n\n.. |Sequence| replace:: ``Sequence``\n.. _Sequence: https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence\n\nThis library provides a drop-in alternative to the built-in |itertools_permutations|_ function. This alternative implements the features of a |Sequence|_, including the ability to access individual entries using their index (without iterating over all permutations up to that point).\n\nInstallation and Usage\n----------------------\nThis library is available as a `package on PyPI \u003chttps://pypi.org/project/permutations\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install permutations\n\nThe library can be imported in the usual ways:\n                              \n.. code-block:: python\n\n    import permutations\n    from permutations import permutations\n\nExamples\n^^^^^^^^\n\n.. |permutations| replace:: ``permutations``\n.. _permutations: https://permutations.readthedocs.io/en/0.2.0/_source/permutations.html#permutations.permutations.permutations\n\n.. |Iterable| replace:: ``Iterable``\n.. _Iterable: https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable\n\nThe |permutations|_ class can be used in the same way as the built-in |itertools_permutations|_ function:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e list(permutations(range(3)))\n    [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]\n    \u003e\u003e\u003e list(permutations(range(3), 2))\n    [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]\n\nHowever, in addition to acting as an |Iterable|_ containing a collection of permutations, an instance of |permutations|_ also acts as a |Sequence|_. In particular, it supports retrieval of specific permutations by their index and its length can be determined without iterating over its elements:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e ps = permutations(range(5))\n    \u003e\u003e\u003e ps[37]\n    (1, 3, 0, 4, 2)\n    \u003e\u003e\u003e permutations(range(20))[7**20]\n    (0, 13, 9, 6, 14, 8, 17, 1, 5, 12, 15, 18, 11, 16, 10, 2, 3, 4, 19, 7)\n    \u003e\u003e\u003e len(permutations(range(8))) == 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1\n    True\n\nDevelopment\n-----------\nAll installation and development dependencies are fully specified in ``pyproject.toml``. The ``project.optional-dependencies`` object is used to `specify optional requirements \u003chttps://peps.python.org/pep-0621\u003e`__ for various development tasks. This makes it possible to specify additional options (such as ``docs``, ``lint``, and so on) when performing installation using `pip \u003chttps://pypi.org/project/pip\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[docs,lint]\n\nDocumentation\n^^^^^^^^^^^^^\nThe documentation can be generated automatically from the source files using `Sphinx \u003chttps://www.sphinx-doc.org\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[docs]\n    cd docs\n    sphinx-apidoc -f -E --templatedir=_templates -o _source .. \u0026\u0026 make html\n\nTesting and Conventions\n^^^^^^^^^^^^^^^^^^^^^^^\nAll unit tests are executed and their coverage is measured when using `pytest \u003chttps://docs.pytest.org\u003e`__ (see the ``pyproject.toml`` file for configuration details):\n\n.. code-block:: bash\n\n    python -m pip install .[test]\n    python -m pytest\n\nAlternatively, all unit tests are included in the module itself and can be executed using `doctest \u003chttps://docs.python.org/3/library/doctest.html\u003e`__:\n\n.. code-block:: bash\n\n    python src/permutations/permutations.py -v\n\nStyle conventions are enforced using `Pylint \u003chttps://pylint.readthedocs.io\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[lint]\n    python -m pylint src/permutations\n\nContributions\n^^^^^^^^^^^^^\nIn order to contribute to the source code, open an issue or submit a pull request on the `GitHub page \u003chttps://github.com/lapets/permutations\u003e`__ for this library.\n\nVersioning\n^^^^^^^^^^\nThe version number format for this library and the changes to the library associated with version number increments conform with `Semantic Versioning 2.0.0 \u003chttps://semver.org/#semantic-versioning-200\u003e`__.\n\nPublishing\n^^^^^^^^^^\nThis library can be published as a `package on PyPI \u003chttps://pypi.org/project/permutations\u003e`__ by a package maintainer. First, install the dependencies required for packaging and publishing:\n\n.. code-block:: bash\n\n    python -m pip install .[publish]\n\nEnsure that the correct version number appears in ``pyproject.toml``, and that any links in this README document to the Read the Docs documentation of this package (or its dependencies) have appropriate version numbers. Also ensure that the Read the Docs project for this library has an `automation rule \u003chttps://docs.readthedocs.io/en/stable/automation-rules.html\u003e`__ that activates and sets as the default all tagged versions. Create and push a tag for this version (replacing ``?.?.?`` with the version number):\n\n.. code-block:: bash\n\n    git tag ?.?.?\n    git push origin ?.?.?\n\nRemove any old build/distribution files. Then, package the source into a distribution archive:\n\n.. code-block:: bash\n\n    rm -rf build dist src/*.egg-info\n    python -m build --sdist --wheel .\n\nFinally, upload the package distribution archive to `PyPI \u003chttps://pypi.org\u003e`__:\n\n.. code-block:: bash\n\n    python -m twine upload dist/*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Fpermutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flapets%2Fpermutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Fpermutations/lists"}