Skip to main content

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

SciTeX

Interactive keyboard input utilities for the SciTeX ecosystem.

Full Documentation · uv pip install scitex-etc[all]

pypi python docs

tests install-check cov


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")  # "![fig.png](fig.png)"

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

  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


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_etc-0.2.0.tar.gz (8.8 MB view details)

Uploaded Source

Built Distribution

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

scitex_etc-0.2.0-py3-none-any.whl (8.5 MB view details)

Uploaded Python 3

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

Hashes for scitex_etc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 07ce53c85f210495939086e60a3f19e35217a175e528c458f710bccb49b659c1
MD5 2ee368e85c4770add9294bce42e17e52
BLAKE2b-256 70cffe2509cf00dcb212570195fc606ab6f353f4735422680206da5caf300a5a

See more details on using hashes here.

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

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_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

Hashes for scitex_etc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec78282256868606201b52ba5c2f476d765c88ffb840ae6a03d5b0d9489807cc
MD5 2c648d51ae75259c697a71a519a46d31
BLAKE2b-256 a24b44f9720a1eab09089e91b80a22038e6ffea6cf73b719ba45871dfb6cab3b

See more details on using hashes here.

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

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