{"id":40670078,"url":"https://github.com/ram6ler/python-trotter","last_synced_at":"2026-01-21T09:31:28.875Z","repository":{"id":42769463,"uuid":"237767068","full_name":"ram6ler/python-trotter","owner":"ram6ler","description":"A Python library for working with structures that commonly come up in combinatorics, such as permutations, combinations and subsets.","archived":false,"fork":false,"pushed_at":"2024-08-19T04:44:40.000Z","size":63,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T10:08:35.072Z","etag":null,"topics":["combinations","combinatorics","johnson-trotter","permutations","subsets"],"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/ram6ler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-02-02T12:21:53.000Z","updated_at":"2025-01-14T05:24:29.000Z","dependencies_parsed_at":"2024-08-18T02:23:06.849Z","dependency_job_id":null,"html_url":"https://github.com/ram6ler/python-trotter","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"d152ec90537188d02341e684755445d3e488ebe6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ram6ler/python-trotter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ram6ler%2Fpython-trotter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ram6ler%2Fpython-trotter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ram6ler%2Fpython-trotter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ram6ler%2Fpython-trotter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ram6ler","download_url":"https://codeload.github.com/ram6ler/python-trotter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ram6ler%2Fpython-trotter/sbom","scorecard":{"id":760563,"data":{"date":"2025-08-11","repo":{"name":"github.com/ram6ler/python-trotter","commit":"7bdc224cf09fece7d883e70fa8cf9a25379a3684"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Info: FSF or OSI recognized license: MIT License: LICENCE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T23:20:31.845Z","repository_id":42769463,"created_at":"2025-08-22T23:20:31.845Z","updated_at":"2025-08-22T23:20:31.845Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["combinations","combinatorics","johnson-trotter","permutations","subsets"],"created_at":"2026-01-21T09:31:28.779Z","updated_at":"2026-01-21T09:31:28.857Z","avatar_url":"https://github.com/ram6ler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trotter\n\nWelcome to trotter, a set of Python classes for representing sequences\nof structures of item selections commonly encountered in combinatorics.\n\nClasses have been defined according to whether order is important, items may be repeated, and length is specified:\n\n| Class          | Order Important | Repetition Allowed | Specified Length |\n| :------------- | :-------------: | :----------------: | :--------------: |\n| `Amalgams`     |       Yes       |        Yes         |       Yes        |\n| `Permutations` |       Yes       |         No         |       Yes        |\n| `Compounds`    |       Yes       |         No         |        No        |\n| `Compositions` |       No        |        Yes         |       Yes        |\n| `Combinations` |       No        |         No         |       Yes        |\n| `Subsets`      |       No        |         No         |        No        |\n\nInstances of these classes are indexable pseudo-lists containing all possible selections of items. Since the number of possible arrangements can grow very quickly with the number of items available (and the number of items taken at a time, where applicable), instances do not actually *store* all arrangements but are rather containers of *mappings between integers and arrangements*. This makes it possible to create instances that \"contain\" very large numbers of arrangements.\n\n## Installation\n\n```\npip install git+https://github.com/ram6ler/python-trotter\n```\n\n## Example: combinations of words\n\n```py\nfrom trotter import Combinations\n\nitems = [\"the\", \"parrot\", \"is\", \"not\", \"pining\"]\ncombos = Combinations(3, items)\n\nprint(repr(combos))\n```\n```\nCombinations(3, ['the', 'parrot', 'is', 'not', 'pining'])\n```\n```py\nprint(str(combos))\n```\n```\nA pseudo-list containing 10 3-combinations of ['the', 'parrot', 'is', 'not', 'pining'].\n```\n```py\nprint(len(combos))\n```\n```\n10\n```\n```py\nfor combo in combos:\n    print(\" \".join(combo))\n```\n```\nthe parrot is\nthe parrot not\nthe parrot pining\nthe is not\nthe is pining\nthe not pining\nparrot is not\nparrot is pining\nparrot not pining\nis not pining\n```\n```py\nprint(combos.index(\"the parrot pining\".split()))\n```\n```\n2\n```\n```py\nprint(combos[2])\n```\n```\n['the', 'parrot', 'pining']\n```\n\n## Example: subsets of characters in a string\n\nThe items can be presented as a list of objects or a string, which is interpreted as a list of characters. Here's an example where we use a string.\n\n```py\nfor i, subset in enumerate(Subsets(\"spam\")):\n     print(f\"[{i}] '{subset}'\")\n```\n```\n[0] ''\n[1] 's'\n[2] 'p'\n[3] 'sp'\n[4] 'a'\n[5] 'sa'\n[6] 'pa'\n[7] 'spa'\n[8] 'm'\n[9] 'sm'\n[10] 'pm'\n[11] 'spm'\n[12] 'am'\n[13] 'sam'\n[14] 'pam'\n[15] 'spam'\n```\n\n## Example: *many* permutations!\n\n```py\nfrom trotter import Permutations\nletters = \"abcdefghijklmnopqrstuvwxyz\"\npermutations = Permutations(10, letters)\nprint(permutations)\n```\n```\nA pseudo-list containing 19275223968000 10-permutations of 'abcdefghijklmnopqrstuvwxyz'.\n```\n\nThat's almost twenty *trillion*! Luckily, we're only dealing with a pseudo-list, and those permutations are not actually stored!\n\nNotice that the word *algorithms* is a ten-letter permutation of the letters of the alphabet. At what position in the pseudo-list is this word?\n\n```py\nprint(permutations.index(\"algorithms\"))\n```\n```\n6831894769563\n```\n\nLuckily, we were able to find it without a brute-force search! Let's check that result...\n\n```py\nprint(permutations[6831894769563])\n```\n```\nalgorithms\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fram6ler%2Fpython-trotter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fram6ler%2Fpython-trotter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fram6ler%2Fpython-trotter/lists"}