Execution-context detection (script vs Jupyter vs IPython) + stdout/stderr suppression — standalone module from the SciTeX ecosystem
Project description
scitex-context
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scitex_context-0.1.0.tar.gz.
File metadata
- Download URL: scitex_context-0.1.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96563b49dfdeeaf0c0b104f183439a2882fec06e00363fc42732175b8194b99a
|
|
| MD5 |
6eec77b3a9dca31f791c2449b9b799d8
|
|
| BLAKE2b-256 |
f7bd1ce0981ff4aca8056c4201c86db24b63f0f75239330363b95af310b8bf23
|
File details
Details for the file scitex_context-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scitex_context-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35e532e12bb1bed347bd4baeb62b52153e55b3178a1ed8215ae52186053fd34f
|
|
| MD5 |
49314aaf69686e3cfc84c89b4667d78c
|
|
| BLAKE2b-256 |
dd197b3d1a79433ee0b71eec92ce84bde5ee6bb015b88297217a6c3317f4d25e
|