scitex-context
Execution-context detection (script vs Jupyter vs IPython) and output suppression helpers.
Full Documentation · uv pip install scitex-context[all]
Quick Start
import scitex_context as ctx
if ctx.is_notebook():
print("Running inside Jupyter")
with ctx.suppress_output():
noisy_function()
Demo
flowchart LR
A["import scitex_context as ctx"] --> B{ctx.detect_environment()}
B -- "python foo.py" --> S["script"]
B -- "jupyter" --> N["notebook"]
B -- "ipython REPL" --> I["ipython"]
S & N & I --> O["ctx.get_output_directory()"]
N --> P["ctx.get_notebook_path()"]
A --> Q["with ctx.suppress_output():<br/> noisy_call()"]
Figure 1. Detect-then-adapt: one import reports the execution context, then output-directory and notebook helpers follow it.
Installation
uv pip install "scitex-context[all]"
Through the umbrella: uv pip install "scitex[context]". Requires Python ≥ 3.10.
Per-extra installs
| Extra | Pulls in |
|---|---|
dev |
pytest, pytest-cov, pytest-timeout, ruff, scitex-dev |
docs |
sphinx, sphinx-rtd-theme, myst-parser, sphinx-copybutton, sphinx-autodoc-typehints |
Architecture
flowchart LR
U["user code"] --> D["_detect_environment.py"]
D -- "script | notebook | ipython" --> S["_suppress_output.py"]
D --> G["_get_notebook_path.py"]
S --> P["public API: __init__.py"]
G --> P
Figure 2. Module layout: environment detection feeds output suppression and notebook-path helpers, all re-exported from the public API.
Pure-stdlib, zero-dep helpers. The umbrella scitex.context import path
is preserved via a sys.modules-alias bridge installed at import time.
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-contextis part of SciTeX. Install via the umbrella withpip install scitex[context]to use asscitex.context(Python) orscitex context ...(CLI).
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- 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).
Metadata
Release files for scitex-context 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scitex_context-0.1.5.tar.gz | 23.8 kB | Without provenance | Details for scitex_context-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scitex_context-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for scitex_context-0.1.5-py3-none-any.whl |
Total release size: 47.8 kB
Release files / scitex_context-0.1.5.tar.gz
| Download URL | scitex_context-0.1.5.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d8bb5b2e08e631f3b8b17e9180294fc2907e7ca302e616fadc46f761680ab77
|
|
BLAKE2b-256 checksum How to use checksums |
e3bb90a6b549865f6d43d86c565e5c23484793b117552dc1028e1bc9d53d7868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / scitex_context-0.1.5-py3-none-any.whl
| Download URL | scitex_context-0.1.5-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
213fff7bce980794e6c90e3a6f5a24e7fd886d02735e4d70bd37acace697f03d
|
|
BLAKE2b-256 checksum How to use checksums |
78b71d604b6b5d6a0a990de3d80b24b7ae0bafde242f50bae9b1d8464ac9cf27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for scitex-context 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.