Package: permutations
Python library for instantiating and working with permutation collections that provide efficient implementations of all sequence methods (including random-access retrieval by index).PurposeThis library provides a drop-in alternative to the built-initertools.permutationsfunction. This alternative implements the features of aSequence, including the ability to access individual entries using their index (without iterating over all permutations up to that point).Installation and UsageThis library is available as apackage on PyPI:python-mpipinstallpermutationsThe library can be imported in the usual ways:importpermutationsfrompermutationsimportpermutationsExamplesThepermutationsclass can be used in the same way as the built-initertools.permutationsfunction:>>>list(permutations(range(3)))[(0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,0,1),(2,1,0)]>>>list(permutations(range(3),2))[(0,1),(0,2),(1,0),(1,2),(2,0),(2,1)]However, in addition to acting as anIterablecontaining a collection of permutations, an instance ofpermutationsalso acts as aSequence. In particular, it supports retrieval of specific permutations by their index and its length can be determined without iterating over its elements:>>>ps=permutations(range(5))>>>ps[37](1,3,0,4,2)>>>permutations(range(20))[7**20](0,13,9,6,14,8,17,1,5,12,15,18,11,16,10,2,3,4,19,7)>>>len(permutations(range(8)))==8*7*6*5*4*3*2*1TrueDevelopmentAll installation and development dependencies are fully specified inpyproject.toml. Theproject.optional-dependenciesobject is used tospecify optional requirementsfor various development tasks. This makes it possible to specify additional options (such asdocs,lint, and so on) when performing installation usingpip:python-mpipinstall.[docs,lint]DocumentationThe documentation can be generated automatically from the source files usingSphinx:python-mpipinstall.[docs]cddocssphinx-apidoc-f-E--templatedir=_templates-o_source..&&makehtmlTesting and ConventionsAll unit tests are executed and their coverage is measured when usingpytest(see thepyproject.tomlfile for configuration details):python-mpipinstall.[test]python-mpytestAlternatively, all unit tests are included in the module itself and can be executed usingdoctest:pythonsrc/permutations/permutations.py-vStyle conventions are enforced usingPylint:python-mpipinstall.[lint]python-mpylintsrc/permutationsContributionsIn order to contribute to the source code, open an issue or submit a pull request on theGitHub pagefor this library.VersioningThe version number format for this library and the changes to the library associated with version number increments conform withSemantic Versioning 2.0.0.PublishingThis library can be published as apackage on PyPIby a package maintainer. First, install the dependencies required for packaging and publishing:python-mpipinstall.[publish]Ensure that the correct version number appears inpyproject.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 anautomation rulethat activates and sets as the default all tagged versions. Create and push a tag for this version (replacing?.?.?with the version number):gittag?.?.?gitpushorigin?.?.?Remove any old build/distribution files. Then, package the source into a distribution archive:rm-rfbuilddistsrc/*.egg-infopython-mbuild--sdist--wheel.Finally, upload the package distribution archive toPyPI:python-mtwineuploaddist/*