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

SciTeX

Execution-context detection (script vs Jupyter vs IPython) and output suppression helpers.

Full Documentation · pip install scitex-context


Installation

pip install scitex-context

Quick Start

import scitex_context as ctx

if ctx.is_notebook():
    print("Running inside Jupyter")

with ctx.suppress_output():
    noisy_function()

1 Interfaces

Python 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.

Part of SciTeX

scitex-context is part of SciTeX.

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only (see LICENSE).


SciTeX

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.2.tar.gz (21.6 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.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_context-0.1.2.tar.gz
  • Upload date:
  • Size: 21.6 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.2.tar.gz
Algorithm Hash digest
SHA256 fdb499954fa3547647a6fabcb0f116f94c3d6f1e93833ea6d62d356da49710ff
MD5 d19c861f3f6afa2828b900c419e020dc
BLAKE2b-256 89b50122ffe7a4234ed0b7ec83becb83a895ac1d584d46304fb4ab7b3887d1a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_context-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: scitex_context-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55dc5d1adeca0c2283261270e540315ed91a50ed3e795f304b0d35cd9414fff8
MD5 07d30a96a0bd61b9792805bb1934cff9
BLAKE2b-256 5233665ab022d824ed4fab9ad7ba494ed2a7ceda84557551960890c512c7abfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_context-0.1.2-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