Skip to main content

Execution-context detection (script vs Jupyter vs IPython) + stdout/stderr suppression — standalone module from the SciTeX ecosystem

Project description

scitex-context

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

Execution-context detection (script vs Jupyter vs IPython) and stdout/stderr suppression helpers, extracted from the SciTeX ecosystem as a standalone, zero-dep package.

Install

pip install scitex-context

API

import scitex_context as ctx

# Environment detection
ctx.detect_environment()       # "script" | "notebook" | "ipython"
ctx.is_script()                # True if running under `python foo.py`
ctx.is_notebook()              # True under Jupyter
ctx.is_ipython()               # True under bare IPython
ctx.get_output_directory()     # Conventional output dir for current context

# Notebook helpers (no-op outside a notebook)
ctx.get_notebook_path()
ctx.get_notebook_directory()
ctx.get_notebook_name()
ctx.get_notebook_info_simple()

# Output suppression
with ctx.suppress_output():
    noisy_function()

with ctx.quiet():               # alias
    chatty_lib_call()

Status

Standalone fork of scitex.context. Pure stdlib — zero deps. The umbrella package's scitex.context import path is preserved via a sys.modules-alias bridge.

License

AGPL-3.0-only (see LICENSE).

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

scitex_context-0.1.1.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

scitex_context-0.1.1-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file scitex_context-0.1.1.tar.gz.

File metadata

  • Download URL: scitex_context-0.1.1.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_context-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9880e6a580d58c6c856187f358c36d079c8d482eb73ee64bad186639a7521a54
MD5 c724c2e924af1f4c7cd9b40fe319d377
BLAKE2b-256 b0b9a6ee2ac26f574808a5d733b5d75156136bb77d80e8d65d96875f2c9f155c

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_context-0.1.1.tar.gz:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_context-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scitex_context-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_context-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0606686b53494183a0c3f039280dc17fdfd7202a58055681e5880ba7a2100b51
MD5 a1e6e9c0aabd40bd9193eaae7919e8ee
BLAKE2b-256 cc883de087bb6ba0dd0e524c88ceeaefa4e4087d7c2e0baf38d08d3073f64621

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_context-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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