Skip to main content

Varsnap

Project description

Varsnap Python

Codeship Status for albertyw/varsnap-python

Python Varsnap Client

Installation

Install from PyPI - pip install varsnap

Requirements

The client depends on three environment variables to be set:

  • VARSNAP - Should be either true or false. Varsnap will be disabled if the variable is anything other than true.
  • ENV - If set to development, the client will receive events from production. If set to production, the client will emit events.
  • VARSNAP_PRODUCER_TOKEN - Only clients with this token may emit production snapshots. Copied from https://www.varsnap.com/user/
  • VARSNAP_CONSUMER_TOKEN - Only clients with this token may emit development snapshots. Copied from https://www.varsnap.com/user/

Usage

Add the varsnap decorator in front of any function you'd like to make better:

from varsnap import varsnap


@varsnap
def example(args, **kwargs):
    return 'output'

Testing

With the proper environment variables set, in a test file, add

from varsnap import TestVarsnap

Troubleshooting

Decorators changing function names

Using decorators may change the name of functions. In order to not confuse varsnap, set the decorated function's __qualname__ to the original __qualname__:

def decorator(func):
    def decorated(*args, **kwargs):
        func(*args, **kwargs)
    decorated.__qualname__ = func.__qualname__
    return decorated

Publishing

pip install twine
python setup.py sdist bdist_wheel
twine upload dist/*

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

varsnap-1.1.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

varsnap-1.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file varsnap-1.1.1.tar.gz.

File metadata

  • Download URL: varsnap-1.1.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0

File hashes

Hashes for varsnap-1.1.1.tar.gz
Algorithm Hash digest
SHA256 6f148402f94e7fe39fd17e76ca1463c92dbb0999fe958da86386678851aa3546
MD5 114c2fbce8db6ca607b2166d27b0aa52
BLAKE2b-256 afcb080325012b719f35f9deafe40649bdc0abf74e6c3c54214a1d2e3dccbf13

See more details on using hashes here.

File details

Details for the file varsnap-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: varsnap-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0

File hashes

Hashes for varsnap-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b91c7a9f4519dc4227d92ab737b3cc1d50d4b98872869a45770f217b9011993c
MD5 42bd6b84c2f94fd1648a4c5bbcae7837
BLAKE2b-256 b6ecdc73a1540047b66f90ace7b3ec2890f412f8eabe7a36f6d98d7ef135b947

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