{"id":24866482,"url":"https://github.com/eieste/versionparser","last_synced_at":"2025-10-15T11:30:36.370Z","repository":{"id":62587285,"uuid":"92590509","full_name":"eieste/VersionParser","owner":"eieste","description":"Parse and Compare Versions","archived":false,"fork":false,"pushed_at":"2024-12-10T14:43:45.000Z","size":13,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-10T16:18:33.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/eieste.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["eieste"],"patreon":["eieste"]}},"created_at":"2017-05-27T10:05:13.000Z","updated_at":"2024-12-10T14:43:50.000Z","dependencies_parsed_at":"2022-11-03T22:41:54.924Z","dependency_job_id":null,"html_url":"https://github.com/eieste/VersionParser","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eieste","download_url":"https://codeload.github.com/eieste/VersionParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236604616,"owners_count":19175857,"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":"2025-02-01T01:12:04.371Z","updated_at":"2025-10-15T11:30:31.101Z","avatar_url":"https://github.com/eieste.png","language":"Python","funding_links":["https://github.com/sponsors/eieste","https://patreon.com/[\"eieste\"]"],"categories":[],"sub_categories":[],"readme":"# Version Parser\n\n\n## JavaScript Version\n\n[https://www.npmjs.com/package/version-parser](https://www.npmjs.com/package/version-parser)\n\n[![npm version](https://badge.fury.io/js/version-parser.svg)](https://badge.fury.io/js/version-parser)\n\n## Python Version\n\n[![Build Status](https://travis-ci.org/eieste/VersionParser.svg?branch=master)](https://travis-ci.org/eieste/VersionParser)\n[![PyPI version](https://badge.fury.io/py/version-parser.svg)](https://badge.fury.io/py/version-parser)\n\nThe version parser is able to parse versions and figure out which of them are build in\none of the following three formats: Major-Version, Minor-Version and Build-Version.\n\nPossible input types are:\n\n| Version  | Typ               |\n|----------|-------------------|\n| v1.2.3   | Version           |\n| V1.2.3   | Version           |\n| v_1_2_3  | FILENAME          |\n| v1_2_3   | FILENAME          |\n| V_1_2_3  | FILENAME          |\n| V1_2_3   | FILENAME          |\n| 1_2_3    | FILENAME          |\n| VM1m2b3  | CLASSNAME_BUILD   |\n| VM1m2p3  | CLASSNAME_PATCH   |\n| vM1m2b3  | CLASSNAME_BUILD   |\n| vM1m2p3  | CLASSNAME_PATCH   |\n| 1.2.3    | STRIPPED_VERSION  |\n| 2312     | NUMBER            |\n\n\n## Install\n```python\npip install version-parser\n```\n\n## Usage\n\nCreate object with the version as a String as initial parameter.\n\n```python\nfrom version_parser import Version\n\n\nv1 = Version(\"v2.3.4\")\n```\n\n\nTo compare two version objects/numbers, simply put the versions as Strings into \nseperate objects and compare them using the logical operators.\n```python\nfrom version_parser.version import Version\n\n\nv1 = Version(\"v2.3.4\")\nv2 = Version(\"v2.3.2\")\n\nprint(v1 \u003c v2)\n\u003e\u003e False\n\n\nprint(v1 \u003e v2)\n\u003e\u003e True\n\n\nprint(v1 == v2)\n\u003e\u003e False\n\n```\n\n\nThe last digets behind the last dot should be the Patch or Build Version Number.\nDifferences in this area should be compatible to each other.\n```python\nfrom version_parser.version import Version\n\n\nv1 = Version(\"v2.3.4\")\nv2 = Version(\"v2.3.5\")\n\n\nprint(v1 == v2)\n\u003e\u003e False\n\n\nprint(v1.compatible_version_with(v2))\n\u003e\u003e True\n\n```\n\nYou can also get only the Major, Minor or Build Version by using:\n\n````python\nfrom version_parser import Version\nv = Version(\"v2.3.4\")\n\nv.get_major_version()\n2\nv.get_minor_version()\n3\nv.get_build_version()\n4\n````\n\nIt's possible to convert the version format, too:\n\n````python\nfrom version_parser import Version, VersionType\nv = Version(\"v2.3.4\")       # VersionType = Version\nprint(v.get_type())\n\u003e\u003e VersionType.Version\n\nprint(v.get_typed_version(VersionType.FILENAME))\n\u003e\u003e v_2_3_4\n````\n\nAny version can be represented by an Integer.\n\u003e The sections of major, minor, build/patched version should have a maximum of three digets.\n\n````python\nfrom version_parser import Version\nv = Version(\"v2.3.4\")\nprint(v.get_number())\n\u003e\u003e 2003004\n````\n\n\n## VersionTypes\n\n### VersionType.FILENAME\n```python\n\"v_\u003cMAJOR\u003e_\u003cMINOR\u003e_\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.CLASSNAME\n```python\n\"VM\u003cMAJOR\u003em\u003cMINOR\u003eb\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.VERSION\n```python\n\"v\u003cMAJOR\u003e.\u003cMINOR\u003e.\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.STRIPPED_VERSION\n```python\n\"\u003cMAJOR\u003e.\u003cMINOR\u003e.\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.NUMBER\n\u003e each section is filled zeros up to three digets\n```python\n\"\u003cMAJOR\u003e\u003cMINOR\u003e\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.CLASSNAME_BUILD\n\u003e same like CLASSNAME_BUILD \n\n\n### VersionType.CLASSNAME_PATCH\n```python\n\"VM\u003cMAJOR\u003em\u003cMINOR\u003ep\u003cBUILD/PATCH\u003e\"\n                  ^\n                PATCH \n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Fversionparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feieste%2Fversionparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Fversionparser/lists"}