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.43.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.43-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: versionedfunction-0.8.43.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.43.tar.gz
Algorithm Hash digest
SHA256 95620add10d0fffc220628c96433d43912ad208801acfc0936d8b0cbeaa3befc
MD5 93f92a12b190816d14bbabd63f3d0047
BLAKE2b-256 70beef20a7545f5645a733e7716fa760b4424ee08d07b66965f41996200ca2af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: versionedfunction-0.8.43-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.43-py3-none-any.whl
Algorithm Hash digest
SHA256 32041ec29f0766431fe80d381015f54c47c4bfc9be014e3ea3c7336a9440bfda
MD5 37d0146e8057106ba16a8abacb0e3261
BLAKE2b-256 63f51df011a6c90aef001820bf7e3f02c3661d6893d71e835b6ef13e6a33c371

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