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.0.tar.gz (10.6 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.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: varsnap-1.1.0.tar.gz
  • Upload date:
  • Size: 10.6 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.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0

File hashes

Hashes for varsnap-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f337bac347017dac00e20c43ed971a701fa89da01dacf8787c7f96d1f3b926c0
MD5 9cd2adb444dd33bcce99dae5aee7475e
BLAKE2b-256 effd905154c8d739b3baee3f5d1820b6dd0b637af130ff22c702b32f74408add

See more details on using hashes here.

File details

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

File metadata

  • Download URL: varsnap-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.0

File hashes

Hashes for varsnap-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3759835d868014b36f4bdd64d5bbc25ff5ab8a7a9d1a7a67ee8c6b5e544f057e
MD5 020d49bda4cff1302e6bee06e34667ca
BLAKE2b-256 f6e9e40df42a3405933af089c62aae552ae22ae2adf080bc43e81ba1eff31516

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