{"id":20603534,"url":"https://github.com/galacticdynamics/zeroth","last_synced_at":"2026-02-03T03:11:09.570Z","repository":{"id":251060328,"uuid":"836312912","full_name":"GalacticDynamics/zeroth","owner":"GalacticDynamics","description":"Efficiently get the index-0 element of an iterable.","archived":false,"fork":false,"pushed_at":"2025-05-01T21:55:29.000Z","size":34,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-01T22:33:10.593Z","etag":null,"topics":[],"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/GalacticDynamics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2024-07-31T15:23:37.000Z","updated_at":"2025-05-01T21:55:30.000Z","dependencies_parsed_at":"2024-11-25T22:20:45.954Z","dependency_job_id":"40df86e2-1a89-4312-aa20-8752c582b45a","html_url":"https://github.com/GalacticDynamics/zeroth","commit_stats":null,"previous_names":["galacticdynamics/zeroth"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GalacticDynamics/zeroth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GalacticDynamics%2Fzeroth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GalacticDynamics%2Fzeroth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GalacticDynamics%2Fzeroth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GalacticDynamics%2Fzeroth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GalacticDynamics","download_url":"https://codeload.github.com/GalacticDynamics/zeroth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GalacticDynamics%2Fzeroth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259896112,"owners_count":22928325,"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":[],"created_at":"2024-11-16T09:17:42.423Z","updated_at":"2026-02-03T03:11:09.510Z","avatar_url":"https://github.com/GalacticDynamics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align='center'\u003e zeroth \u003c/h1\u003e\n\u003ch2 align=\"center\"\u003eEfficiently get the index-0 element of an iterable.\u003c/h2\u003e\n\nThis is a micro-package, containing the single function `zeroth`. \u003c/br\u003e `zeroth`\nis syntactic sugar for `next(iter(obj))`, with a nice docstring.\n\n## Installation\n\n[![PyPI platforms][pypi-platforms]][pypi-link]\n[![PyPI version][pypi-version]][pypi-link]\n\n\u003c!-- [![Conda-Forge][conda-badge]][conda-link] --\u003e\n\n```bash\npip install zeroth\n```\n\n## Documentation\n\n[![Actions Status][actions-badge]][actions-link]\n\n```python\nfrom zeroth import zeroth\n\nprint(zeroth([0, 1, 2]))\n# 0\n\nprint(zeroth((3, 2, 1)))\n# 3\n\nprint(zeroth({\"a\": 1, \"b\": 2, \"c\": 3}))\n# 'a'\n\nprint(zeroth(range(3)))\n# 0\n\nprint(zeroth(range(1, 3)))\n# 1\n\nprint(zeroth(map(str, range(3))))\n# '0'\n\nimport numpy as np\n\nprint(zeroth(np.array([1, 2, 3])))\n# 1\n\n\nclass ReverseIterable:\n    def __init__(self, data):\n        self.data = data\n\n    def __iter__(self):\n        return iter(reversed(self.data))\n\n\nprint(zeroth(ReverseIterable([1, 2, 3])))\n# 3\n```\n\n## Q\u0026A\n\n_Why isn't this called `first` since it gets the element with ordinality of 1?_\n\nBecause that package name is already taken on PyPI. Here zeroth refers to the\nindex.\n\n\u003c!-- SPHINX-START --\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[actions-badge]:            https://github.com/GalacticDynamics/zeroth/workflows/CI/badge.svg\n[actions-link]:             https://github.com/GalacticDynamics/zeroth/actions\n[conda-badge]:              https://img.shields.io/conda/vn/conda-forge/zeroth\n[conda-link]:               https://github.com/conda-forge/zeroth-feedstock\n[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions\u0026message=Ask\u0026color=blue\u0026logo=github\n[github-discussions-link]:  https://github.com/GalacticDynamics/zeroth/discussions\n[pypi-link]:                https://pypi.org/project/zeroth/\n[pypi-platforms]:           https://img.shields.io/pypi/pyversions/zeroth\n[pypi-version]:             https://img.shields.io/pypi/v/zeroth\n\n\u003c!-- prettier-ignore-end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalacticdynamics%2Fzeroth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgalacticdynamics%2Fzeroth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalacticdynamics%2Fzeroth/lists"}