Skip to main content

Context package to use data between function calls, use timers and log it.

Project description

CTX

pipeline status coverage report

Context package to use data between function calls, use timers and log it.

For example you want have some decision point in your code::

from pyctx.context import Context
ctx = Context('APP')
x = 100
y = (x + 1) * (x - 1)
ctx.log.set_data('isEven', y % 2)
ctx.log.set_data('y', y)
ctx.log.start_timer('timer1')
import time
time.sleep(1)
ctx.log.stop_timer('timer1')
with ctx.log.timeit('timer2_context_manager'):
    time.sleep(5)

ctx.finalize()
# {'type': 'APP', 'ctxId': '0fdecfe0-067e-4bdd-9920-3b7ed46d8a98', 'startTime': '2019-08-06 09:42:31.222184', 'endTime': '2019-08-06 09:42:37.236861', 'data': {'isEven': 1, 'y': 9999}, 'timers': {'timer1': 1.00633, 'timer2_context_manager': 5.002412}}

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

pyctx-0.1.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

pyctx-0.1.5-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyctx-0.1.5.tar.gz.

File metadata

  • Download URL: pyctx-0.1.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pyctx-0.1.5.tar.gz
Algorithm Hash digest
SHA256 04e81145c9f88e0d69f6c5344152c82b7331c31bbef421258d0020fca862a74d
MD5 14856eded7844d6169bd5e6609f78bc2
BLAKE2b-256 3cfc16060f8196341b53932a4c647f537d936d1430608f7f35bc169ead1aa490

See more details on using hashes here.

File details

Details for the file pyctx-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: pyctx-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pyctx-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5ef3139afff0284759c4f2a43442f80ee15dda5d9fd651b7c52c47349b16f635
MD5 dfef9bda3839aa3a53108646cefa6a9a
BLAKE2b-256 0aa7dcdb7b017e5b458a19bef3df1d63294e6aeac56de8fbd0278d280ca3658e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page