Skip to main content

A simple library for managing versioning of classes

Project description

Code style: black

Versioned Classes

A tool for managing versions of classes in a service.

Installation

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

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(...)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

versioned_classes-0.0.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

versioned_classes-0.0.1-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page