Skip to main content

Sometimes you want to be able to dynamically call different versions of a function

Project description

versionedfunction

Sometimes you want to be able to dynamically call different versions of a function.

  • testing alternatives against each other
  • runtime "always on" support for versions code changes

Example

from versionedfunction import versionedfunction, versionContext

class Foo():
    @versionedfunction
    def algo(self):
        return 0

    @algo.version
    def algo1(self):
        return 1

    @algo.default
    @algo.version
    def algo2(self):
        return 2
foo = Foo()

assert foo.algo() == 2

versionContext['Foo.algo'] = "1"
assert foo.algo() == 1

Installing

$ pip install versionedfunction

The source code is currently hosted on GitHub at https://github.com/GistLabs/versionedfunction and published in PyPI at https://pypi.org/project/versionedfunction/

The versioning scheme currently used is {major}.{minor}.{auto build number} from git rev-list --count HEAD.

We recommend picking a version like:

versionedfunction = "^0.8"

Community guidelines

We welcome contributions and questions. Please head over to github and send us pull requests or create issues!

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

versionedfunction-0.8.45.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

versionedfunction-0.8.45-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file versionedfunction-0.8.45.tar.gz.

File metadata

  • Download URL: versionedfunction-0.8.45.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure

File hashes

Hashes for versionedfunction-0.8.45.tar.gz
Algorithm Hash digest
SHA256 da9da33b3fa2823ca8eb11b4d16b428d037ab99ee3df237608c342be47f63edb
MD5 929c95e4fede1c4193505f31f7cd2d2c
BLAKE2b-256 f01d7fabbe2f27180a4af3a92431598c7e9bd456585ed527afd7998c01f4dc76

See more details on using hashes here.

File details

Details for the file versionedfunction-0.8.45-py3-none-any.whl.

File metadata

  • Download URL: versionedfunction-0.8.45-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure

File hashes

Hashes for versionedfunction-0.8.45-py3-none-any.whl
Algorithm Hash digest
SHA256 6a2ad0d7e8f2d60a01d0900087c561fc909de0550fa3de1739d25364bc5e61e6
MD5 c629aa6e9f1b50e5c568d186f118f947
BLAKE2b-256 4c6ffc179d3db3a74acd3063ac9cfef50fbbeede43f7cc369ffdbd127d74b740

See more details on using hashes here.

Supported by

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