{"id":43242232,"url":"https://github.com/nekitdev/versions","last_synced_at":"2026-02-01T11:38:56.142Z","repository":{"id":43779136,"uuid":"507243579","full_name":"nekitdev/versions","owner":"nekitdev","description":"Parsing, inspecting and specifying versions.","archived":false,"fork":false,"pushed_at":"2024-06-14T11:53:10.000Z","size":2146,"stargazers_count":8,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-28T12:57:26.866Z","etag":null,"topics":["python","semver","version"],"latest_commit_sha":null,"homepage":"https://nekitdev.github.io/versions","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/nekitdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["nekitdev"],"custom":"https://nekit.dev/funding"}},"created_at":"2022-06-25T07:24:21.000Z","updated_at":"2025-01-29T01:46:38.000Z","dependencies_parsed_at":"2024-05-06T17:50:59.550Z","dependency_job_id":null,"html_url":"https://github.com/nekitdev/versions","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"4d50d52eb8585b32ed67e875cf4092434d6071ed"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/nekitdev/versions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fversions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fversions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fversions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fversions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nekitdev","download_url":"https://codeload.github.com/nekitdev/versions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekitdev%2Fversions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28977334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T11:31:13.034Z","status":"ssl_error","status_checked_at":"2026-02-01T11:30:25.558Z","response_time":56,"last_error":"SSL_read: 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":["python","semver","version"],"created_at":"2026-02-01T11:38:56.075Z","updated_at":"2026-02-01T11:38:56.133Z","avatar_url":"https://github.com/nekitdev.png","language":"Python","funding_links":["https://github.com/sponsors/nekitdev","https://nekit.dev/funding"],"categories":[],"sub_categories":[],"readme":"# `versions`\n\n[![License][License Badge]][License]\n[![Version][Version Badge]][Package]\n[![Downloads][Downloads Badge]][Package]\n[![Discord][Discord Badge]][Discord]\n\n[![Documentation][Documentation Badge]][Documentation]\n[![Check][Check Badge]][Actions]\n[![Test][Test Badge]][Actions]\n[![Coverage][Coverage Badge]][Coverage]\n\n\u003e *Parsing, inspecting and specifying versions.*\n\n## Installing\n\n**Python 3.8 or above is required.**\n\n### pip\n\nInstalling the library with `pip` is quite simple:\n\n```console\n$ pip install versions\n```\n\nAlternatively, the library can be installed from source:\n\n```console\n$ git clone https://github.com/nekitdev/versions.git\n$ cd versions\n$ python -m pip install .\n```\n\n### poetry\n\nYou can add `versions` as a dependency with the following command:\n\n```console\n$ poetry add versions\n```\n\nOr by directly specifying it in the configuration like so:\n\n```toml\n[tool.poetry.dependencies]\nversions = \"^2.1.2\"\n```\n\nAlternatively, you can add it directly from the source:\n\n```toml\n[tool.poetry.dependencies.versions]\ngit = \"https://github.com/nekitdev/versions.git\"\n```\n\n## Examples\n\n### Versions\n\n[`parse_version`][versions.functions.parse_version] is used to parse versions:\n\n```python\nfrom versions import parse_version\n\nversion = parse_version(\"1.0.0-dev.1+build.1\")\n\nprint(version)  # 1.0.0-dev.1+build.1\n```\n\n### Segments\n\nAll version segments can be fetched with their respective names:\n\n```python\n\u003e\u003e\u003e print(version.release)\n1.0.0\n\u003e\u003e\u003e version.release.parts\n(1, 0, 0)\n\u003e\u003e\u003e print(version.dev)\ndev.1\n\u003e\u003e\u003e (version.dev.phase, version.dev.value)\n(\"dev\", 1)\n\u003e\u003e\u003e print(version.local)\nbuild.1\n\u003e\u003e\u003e version.local.parts\n(\"build\", 1)\n```\n\n### Comparison\n\nVersions support total ordering:\n\n```python\n\u003e\u003e\u003e v1 = parse_version(\"1.0.0\")\n\u003e\u003e\u003e v2 = parse_version(\"2.0.0\")\n\u003e\u003e\u003e v1 == v2\nFalse\n\u003e\u003e\u003e v1 != v2\nTrue\n\u003e\u003e\u003e v1 \u003e= v2\nFalse\n\u003e\u003e\u003e v1 \u003c= v2\nTrue\n\u003e\u003e\u003e v1 \u003e v2\nFalse\n\u003e\u003e\u003e v1 \u003c v2\nTrue\n```\n\n### Specification\n\n`versions` also supports specifying version requirements and matching version against them.\n\nSince versions support total ordering, they can be checked using *version sets*\n(via [`parse_version_set`][versions.functions.parse_version_set]):\n\n```python\n\u003e\u003e\u003e from versions import parse_version, parse_version_set\n\u003e\u003e\u003e version_set = parse_version_set(\"^1.0.0\")\n\u003e\u003e\u003e version_set\n\u003cVersionRange (\u003e= 1.0.0, \u003c 2.0.0)\u003e\n\u003e\u003e\u003e version = parse_version(\"1.3.0\")\n\u003e\u003e\u003e version.matches(version_set)\nTrue\n\u003e\u003e\u003e another = parse_version(\"2.2.0\")\n\u003e\u003e\u003e another.matches(version_set)\nFalse\n```\n\nAlternatively, one can use *specifiers*, which are similar to version sets, except they retain\nthe structure of specifications given (via [`parse_specifier`][versions.functions.parse_specifier]):\n\n```python\n\u003e\u003e\u003e from versions import parse_specifier, parse_version\n\u003e\u003e\u003e specifier = parse_specifier(\"^1.0.0\")\n\u003e\u003e\u003e specifier\n\u003cSpecifierOne (^1.0.0)\u003e\n\u003e\u003e\u003e version = parse_version(\"1.3.0\")\n\u003e\u003e\u003e version.matches(specifier)\nTrue\n\u003e\u003e\u003e another = parse_version(\"2.2.0\")\n\u003e\u003e\u003e another.matches(specifier)\nFalse\n```\n\n## Versioned\n\n`versions` allows users to access versions of items that have the `__version__` attribute:\n\n```python\n\u003e\u003e\u003e from versions import get_version\n\u003e\u003e\u003e import versions\n\u003e\u003e\u003e get_version(versions)\n\u003cVersion (2.1.2)\u003e\n```\n\n## Documentation\n\nYou can find the documentation [here][Documentation].\n\n## Support\n\nIf you need support with the library, you can send an [email][Email]\nor refer to the official [Discord server][Discord].\n\n## Changelog\n\nYou can find the changelog [here][Changelog].\n\n## Security Policy\n\nYou can find the Security Policy of `versions` [here][Security].\n\n## Contributing\n\nIf you are interested in contributing to `versions`, make sure to take a look at the\n[Contributing Guide][Contributing Guide], as well as the [Code of Conduct][Code of Conduct].\n\n## License\n\n`versions` is licensed under the MIT License terms. See [License][License] for details.\n\n[Email]: mailto:support@nekit.dev\n\n[Discord]: https://nekit.dev/discord\n\n[Actions]: https://github.com/nekitdev/versions/actions\n\n[Changelog]: https://github.com/nekitdev/versions/blob/main/CHANGELOG.md\n[Code of Conduct]: https://github.com/nekitdev/versions/blob/main/CODE_OF_CONDUCT.md\n[Contributing Guide]: https://github.com/nekitdev/versions/blob/main/CONTRIBUTING.md\n[Security]: https://github.com/nekitdev/versions/blob/main/SECURITY.md\n\n[License]: https://github.com/nekitdev/versions/blob/main/LICENSE\n\n[Package]: https://pypi.org/project/versions\n[Coverage]: https://codecov.io/gh/nekitdev/versions\n[Documentation]: https://nekitdev.github.io/versions\n\n[Discord Badge]: https://img.shields.io/badge/chat-discord-5865f2\n[License Badge]: https://img.shields.io/pypi/l/versions\n[Version Badge]: https://img.shields.io/pypi/v/versions\n[Downloads Badge]: https://img.shields.io/pypi/dm/versions\n\n[Documentation Badge]: https://github.com/nekitdev/versions/workflows/docs/badge.svg\n[Check Badge]: https://github.com/nekitdev/versions/workflows/check/badge.svg\n[Test Badge]: https://github.com/nekitdev/versions/workflows/test/badge.svg\n[Coverage Badge]: https://codecov.io/gh/nekitdev/versions/branch/main/graph/badge.svg\n\n[versions.functions.parse_specifier]: https://nekitdev.github.io/versions/reference/functions#versions.functions.parse_specifier\n[versions.functions.parse_version]: https://nekitdev.github.io/versions/reference/functions#versions.functions.parse_version\n[versions.functions.parse_version_set]: https://nekitdev.github.io/versions/reference/functions#versions.functions.parse_version_set\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekitdev%2Fversions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnekitdev%2Fversions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekitdev%2Fversions/lists"}