{"id":16508524,"url":"https://github.com/osteele/minimal-keys","last_synced_at":"2025-10-09T16:22:13.933Z","repository":{"id":57441799,"uuid":"116698576","full_name":"osteele/minimal-keys","owner":"osteele","description":"Compute the unique minimal keys from a collection of strings or sequences.","archived":false,"fork":false,"pushed_at":"2018-01-08T19:01:59.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-25T09:18:39.838Z","etag":null,"topics":["python-package"],"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/osteele.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}},"created_at":"2018-01-08T16:09:28.000Z","updated_at":"2020-05-30T19:50:09.000Z","dependencies_parsed_at":"2022-09-06T02:42:00.926Z","dependency_job_id":null,"html_url":"https://github.com/osteele/minimal-keys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteele%2Fminimal-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteele%2Fminimal-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteele%2Fminimal-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteele%2Fminimal-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osteele","download_url":"https://codeload.github.com/osteele/minimal-keys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241460013,"owners_count":19966511,"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","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":["python-package"],"created_at":"2024-10-11T15:46:00.598Z","updated_at":"2025-10-09T16:22:13.873Z","avatar_url":"https://github.com/osteele.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Minimal Keys\n============\n\n|PyPI version| |Doc Status| |License| |Supported Python|\n\nCompute the minimal unique keys for a collection of strings or sequences.\n\nThis is intended for use in presenting data in a user interface. For example,\nthe ``nbcollate`` command-line interface from the nbcollate_ package uses it to\nguess student names from notebook filenames, for use in the creation of the\ncollated Jupyter notebook.\n\nThe minimal keys from ``[\"assignments/alice/hw1.txt\",\n\"assignments/bob/hw1.txt\"]`` are ``[\"alice\", \"bob\"]``, because the input strings\nshare the common prefix ``\"assignments/\"`` and the common suffix ``\".txt\"``.\n\nThe minimal keys from ``[\"alice/assignments/hw1.txt\", \"bob/assignments/hw1.txt\"]``\nare also ``[\"alice\", \"bob\"]``, because the input strings\nshare the common suffix ``\"/assignments/hw1.txt\"``.\n\nFinally, the minimal keys from ``[\"assignments/alice.txt\",\n\"assignments/bob.txt\"]`` are—wait for it—``[\"alice\", \"bob\"]``.\n\nThere are options to ignore case, and to split the strings at different\nboundaries. (The default is split to on words, so that ``[\"alice\", \"adam\"]`` is\nnot abbreviated to ``[\"lice\", \"dam\"]``.)\n\nThis is the same basic idea as a database superkey_, except that the actual\nminimal unique keys are returned, instead of the attributes that select these\nkeys.\n\nThe current implementation trims only the beginnings and ends of sequences,\nbecause this is all that I've needed so far. I have in my head a more\nsophisticated implementation that uses `difflib`, but it is too long to fit in\nthe header of this README.\n\nInstall\n-------\n\n.. code:: bash\n\n    $ pip install minimalkeys\n\nUsage\n-----\n\n.. code:: python\n\n    \u003e\u003e\u003e from minimalkeys import minimal_keys\n    \u003e\u003e\u003e minimal_keys([\"assignments/alice/hw1.txt\", \"assignments/bob/hw1.txt\"])\n    ['alice', 'bob']\n\nFor more examples, see the `API documentation`_.\n\nLicense\n-------\n\nMIT\n\n.. |PyPI version| image:: https://img.shields.io/pypi/v/minimalkeys.svg\n    :target: https://pypi.python.org/pypi/minimalkeys\n    :alt: Latest PyPI Version\n.. |Doc Status| image:: https://readthedocs.org/projects/minimal-keys/badge/?version=latest\n    :target: http://minimal-keys.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. |License| image:: https://img.shields.io/pypi/l/minimal-keys.svg\n    :target: https://pypi.python.org/pypi/minimal-keys\n    :alt: License\n.. |Supported Python| image:: https://img.shields.io/pypi/pyversions/minimal-keys.svg\n    :target: https://pypi.python.org/pypi/minimal-keys\n    :alt: Supported Python Versions\n\n.. _superkey: https://en.wikipedia.org/wiki/Superkey\n.. _nbcollate: https://github.com/osteele/nbcollate\n.. _API documentation: http://minimal-keys.readthedocs.io/en/latest/?badge=latest#module-minimalkeys\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosteele%2Fminimal-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosteele%2Fminimal-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosteele%2Fminimal-keys/lists"}