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.7.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pyctx-0.1.7-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pyctx-0.1.7.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for pyctx-0.1.7.tar.gz
Algorithm Hash digest
SHA256 06d3e8404ff93f7a728a4367cab8ea57c11c6aa27f97ba61e0f3b2532a850bbb
MD5 b6276b3a671996c0238148b5901f44dd
BLAKE2b-256 3bfb23fabfab13b897b1ef77d159fbbc81317503de08667958b4fb699906bb31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyctx-0.1.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for pyctx-0.1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 24a2c765e3151b1bc49f5d185bb1e408af5e444478ae289e1c2286f45ec699f8
MD5 3d3427567ef861ff9a7c4ed8263b5905
BLAKE2b-256 ccfd47359f3c89fdd675af2d7ad7c0b162efc7dddd1dfd27b4a8e02ffe9af2a5

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