Skip to main content

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

import unittest
from varsnap import test

class TestIntegration(unittest.TestCase):
    def test_varsnap(self):
        matches, logs = test()
        if matches is None:
            raise unittest.case.SkipTest('No Snaps found')
        self.assertTrue(matches, logs)

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/*

Metadata

Release files for varsnap 1.3.4

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

Source distribution (sdist)

Source distribution for varsnap 1.3.4
File Size Uploaded Provenance Actions
varsnap-1.3.4.tar.gz 9.6 kB Without provenance Details for varsnap-1.3.4.tar.gz

Built distribution (wheel)

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

Total release size: 24.8 kB

Release files / varsnap-1.3.4.tar.gz

Download URL varsnap-1.3.4.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bdaa24fbc4bbfc5fca3b4cca7fc7fde5055e01f629d2bed6ba386d36fd420a98
BLAKE2b-256 checksum
How to use checksums
d819906bad92bef963ed4f58caefdfd9a23cf19d1901d6b91a673d108da9f013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.5

Release files / varsnap-1.3.4-py3-none-any.whl

Download URL varsnap-1.3.4-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54b2e9148f6fdead798f525adf71393ab09bf1118088d64bee8439c0472d3337
BLAKE2b-256 checksum
How to use checksums
af2a5e5f5ca10825c71d4b2e16bbcd75e310309b0194d606e631b416add2c186
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.5

Security for varsnap 1.3.4

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.

Release history Release notifications | RSS feed

This release

1.3.4 This release

2 release files No provenance

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