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.1.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.1-py3-none-any.whl (8.5 MB view details)

Uploaded Python 3

File details

Details for the file scitex_etc-0.2.1.tar.gz.

File metadata

  • Download URL: scitex_etc-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 97b78266bcd5171155d968a0ca173b4c6de6aaa7b3fea029e38c0bffe947b423
MD5 48a4f0058c835c839218ef7cdfc9d5a2
BLAKE2b-256 b043f8ba9e9fc2870412e883c080a1b87eef36fbafecde457b49e74c11b7d142

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_etc-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: scitex_etc-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b12e48c657d93d09d8fb53e47914c12d4100b6ab84542c875e817d62c075b554
MD5 d1c6cfa80808af34e6351b9123cb36d0
BLAKE2b-256 db250fd127f9bf508feb53dadfe308abbb97c86e25a0d41cada682f37ef12389

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_etc-0.2.1-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