Small cross-cutting utilities: interactive keyboard input (wait_key, count), parameter-grid iteration (count_grids, yield_grids), regex string search (search), and media handling (detect/classify/show)
Project description
scitex-etc
Interactive keyboard input utilities for the SciTeX ecosystem.
Full Documentation · uv pip install scitex-etc[all]
Problem and Solution
| # | Problem | Solution |
|---|---|---|
| 1 | Scripts that pause for a keypress need raw-stdin + termios gymnastics — 15 lines of OS-dependent boilerplate | wait_key() / count() — one import; handles Linux/macOS/Windows; falls back cleanly when stdin isn't a TTY |
Installation
pip install scitex-etc
Architecture
scitex-etc/
├── src/scitex_etc/
│ ├── _wait_key.py # cross-platform raw-stdin keypress
│ └── _count.py # countdown helper
└── tests/
1 Interfaces
Python API
import multiprocessing
from scitex_etc import wait_key, count
# Run the counter in a subprocess, wait for 'q' to stop it.
p = multiprocessing.Process(target=count)
p.start()
wait_key(p) # Blocks until 'q' is pressed, then terminates the process
Media handling (scitex_etc.media.render)
from scitex_etc.media import render
# Classify a file by its extension
render.classify("fig.png") # {"type": "image", "path": "fig.png", "ext": ".png"}
# Detect media refs in tool output
render.detect("Saved /proj/fig.png", root_path="/proj")
# [{"type": "image", "path": "fig.png", "ext": ".png"}]
# Render to a target: terminal (OSC overlay), chat, or markdown
render.show("fig.png", target="markdown") # ""
Also available as a CLI (python -m scitex_etc.media.render show|classify|detect)
and as MCP tools (scitex_etc.media.render.mcp_server).
Demo
flowchart LR
User[User keypress] --> TTY{stdin is TTY?}
TTY -- yes --> Termios[termios raw mode]
TTY -- no --> Fallback[readline fallback]
Termios --> Key[key string]
Fallback --> Key
Quick Start
import multiprocessing
from scitex_etc import wait_key, count
# count() prints an incrementing counter forever (1 per second).
# Run it in a subprocess and use wait_key() to stop on 'q'.
p = multiprocessing.Process(target=count)
p.start()
wait_key(p)
Part of SciTeX
scitex-etc is part of SciTeX. Install via
the umbrella with pip install scitex[etc] to use as
scitex.etc (Python) or scitex etc ... (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
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_etc-0.2.0.tar.gz.
File metadata
- Download URL: scitex_etc-0.2.0.tar.gz
- Upload date:
- Size: 8.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07ce53c85f210495939086e60a3f19e35217a175e528c458f710bccb49b659c1
|
|
| MD5 |
2ee368e85c4770add9294bce42e17e52
|
|
| BLAKE2b-256 |
70cffe2509cf00dcb212570195fc606ab6f353f4735422680206da5caf300a5a
|
Provenance
The following attestation bundles were made for scitex_etc-0.2.0.tar.gz:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-etc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_etc-0.2.0.tar.gz -
Subject digest:
07ce53c85f210495939086e60a3f19e35217a175e528c458f710bccb49b659c1 - Sigstore transparency entry: 1676790051
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-etc@d276e7f30fbf01ec60a9e68e380585a036d6a077 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@d276e7f30fbf01ec60a9e68e380585a036d6a077 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_etc-0.2.0-py3-none-any.whl.
File metadata
- Download URL: scitex_etc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec78282256868606201b52ba5c2f476d765c88ffb840ae6a03d5b0d9489807cc
|
|
| MD5 |
2c648d51ae75259c697a71a519a46d31
|
|
| BLAKE2b-256 |
a24b44f9720a1eab09089e91b80a22038e6ffea6cf73b719ba45871dfb6cab3b
|
Provenance
The following attestation bundles were made for scitex_etc-0.2.0-py3-none-any.whl:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-etc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_etc-0.2.0-py3-none-any.whl -
Subject digest:
ec78282256868606201b52ba5c2f476d765c88ffb840ae6a03d5b0d9489807cc - Sigstore transparency entry: 1676790054
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-etc@d276e7f30fbf01ec60a9e68e380585a036d6a077 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@d276e7f30fbf01ec60a9e68e380585a036d6a077 -
Trigger Event:
push
-
Statement type: