[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# Versioned Classes
A tool for managing versions of classes in a service.
## Installation
```bash
pip install versioned-classes
```
## Usage
If you have ever worked on an API which has a complex interdependency hierarchy, you might have faced the problem of managing versions of classes. When services grow large and multiple APIs are added, it becomes difficult to manage which versions of classes are being used by which API. Moreover, it can become cumbersome to ensure that all calls to a class are being kept up to date. The aim of this project is to provide a simple way to use the best version of a class in a service.
### Example
```python
from versioned_classes import VersionedClass
from versioned_classes import initial_version
@initial_version("v1")
class MyAPI(VersionedClass):
pass
@MyAPI.register_version("v2")
class MyAPIV2(MyAPI):
pass
MyAPI.get_latest_version() # MyAPIV2
MyAPI.get_latest_version_instance(...) # MyAPIV2(...)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "versioned-classes",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "versioning, version, versioner, versioning classes, versioning objects",
"author": null,
"author_email": "Declan Atkins <declanatkins@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/fc/71/5f0275a87d279ad72c00bce77ad76b2086e5b1d0625d3e26d5f3c2e2138c/versioned_classes-0.0.1.tar.gz",
"platform": null,
"description": "[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n# Versioned Classes\nA tool for managing versions of classes in a service.\n\n## Installation\n```bash\npip install versioned-classes\n```\n\n\n## Usage\n\nIf you have ever worked on an API which has a complex interdependency hierarchy, you might have faced the problem of managing versions of classes. When services grow large and multiple APIs are added, it becomes difficult to manage which versions of classes are being used by which API. Moreover, it can become cumbersome to ensure that all calls to a class are being kept up to date. The aim of this project is to provide a simple way to use the best version of a class in a service.\n\n### Example\n```python\nfrom versioned_classes import VersionedClass\nfrom versioned_classes import initial_version\n\n\n@initial_version(\"v1\")\nclass MyAPI(VersionedClass):\n pass\n\n\n@MyAPI.register_version(\"v2\")\nclass MyAPIV2(MyAPI):\n pass\n\n\nMyAPI.get_latest_version() # MyAPIV2\n\nMyAPI.get_latest_version_instance(...) # MyAPIV2(...)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple library for managing versioning of classes",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"versioning",
" version",
" versioner",
" versioning classes",
" versioning objects"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f1a8d54bc2462387b8c9405d123415d04e3ee8ee90eb8220215801329f2f4862",
"md5": "689cfa5fc08cfc382b28a69be264fc91",
"sha256": "0a12ad08422257330e699729619ab96fedfb2ede4f875778677623666b0bb28a"
},
"downloads": -1,
"filename": "versioned_classes-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "689cfa5fc08cfc382b28a69be264fc91",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3736,
"upload_time": "2024-07-10T11:13:24",
"upload_time_iso_8601": "2024-07-10T11:13:24.402474Z",
"url": "https://files.pythonhosted.org/packages/f1/a8/d54bc2462387b8c9405d123415d04e3ee8ee90eb8220215801329f2f4862/versioned_classes-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fc715f0275a87d279ad72c00bce77ad76b2086e5b1d0625d3e26d5f3c2e2138c",
"md5": "d53a4dedec73a401195b3fc336c47921",
"sha256": "0e92268ae1d33bd1d6aa1fed6fd5c33564c7b7c0fabd73815aa10388ba61e586"
},
"downloads": -1,
"filename": "versioned_classes-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d53a4dedec73a401195b3fc336c47921",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5470,
"upload_time": "2024-07-10T11:13:29",
"upload_time_iso_8601": "2024-07-10T11:13:29.513669Z",
"url": "https://files.pythonhosted.org/packages/fc/71/5f0275a87d279ad72c00bce77ad76b2086e5b1d0625d3e26d5f3c2e2138c/versioned_classes-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-10 11:13:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "versioned-classes"
}