Skip to main content

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, versionedcontext


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

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

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


foo = Foo()

# the default is algo2
assert foo.algo() == 2

with versionedcontext(Foo.algo):
    # choose Foo.algo
    assert foo.algo() == 0

@versionedcontext(Foo.algo1)
def some_method():
    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.9"

Community guidelines

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

Metadata

Release files for versionedfunction 0.9.57

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for versionedfunction 0.9.57
File Size Uploaded Provenance Actions
versionedfunction-0.9.57.tar.gz 7.6 kB Without provenance Details for versionedfunction-0.9.57.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for versionedfunction 0.9.57
File Interpreter ABI Platform Actions
versionedfunction-0.9.57-py3-none-any.whl Python 3 none any Details for versionedfunction-0.9.57-py3-none-any.whl

Total release size: 16.6 kB

Release files / versionedfunction-0.9.57.tar.gz

Download URL versionedfunction-0.9.57.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c6f895961a55b84d9e4b5b9ccce4323f21791a6801e6ff41fbb5e9e1c2cea909
BLAKE2b-256 checksum
How to use checksums
7dfa09fc600e6fa6564d81dcd8a5d49ba581277df93c258e8afd9b23a6e85511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / versionedfunction-0.9.57-py3-none-any.whl

Download URL versionedfunction-0.9.57-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3ae88e6e5edd70b57cfa3f591cfd06641c1ee527b834723e8d45e6e561b8954
BLAKE2b-256 checksum
How to use checksums
8fe16c34ae108e1b8121e6ff99945e92d669b9e557cfbfa4ccc2f96bad2810e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Security for versionedfunction 0.9.57

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page