Skip to main content

scitex-repl

SciTeX

Interactive-REPL helpers (`embed`, `less`, `paste`) — clipboard-aware IPython workflows.

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

pypi python docs License: AGPL v3

tests install-check cov


Problem and Solution

# Problem Solution
1 Clipboard code dies in transit — pasting indented multi-line code from an editor into a REPL raises IndentationError paste() — dedents the clipboard through textwrap.dedent before exec, and reports exec failures as diagnostics instead of propagating
2 No clipboard-aware shell — dropping into IPython loses whatever you just copied embed() — starts IPython.embed with the clipboard preloaded and an optional execute-confirm prompt
3 Paging needs a subshell — viewing a long string from inside IPython means leaving the session less() — pipes the string through the system less via the shell's system hook, cleaning up the temp file

Quick Start

import scitex_repl

# Exec the current clipboard contents (dedented first).
scitex_repl.paste()

# Pipe a string through the system `less` pager.
scitex_repl.less("a very long string ...")

# Drop into an IPython shell, optionally pre-executing the clipboard.
scitex_repl.embed()

Demo

sequenceDiagram
    participant U as user code
    participant C as clipboard
    participant P as paste()
    participant W as diagnostics
    U->>C: copy indented snippet
    C->>P: pyperclip.paste()
    P->>P: textwrap.dedent()
    P->>U: exec in current scope
    Note over P,W: on failure: log an error diagnostic, do not propagate

Figure 1. Copy-paste-run loop: the clipboard is dedented, executed in scope, and failures surface as diagnostics.

Installation

uv pip install "scitex-repl[all]"

Through the umbrella: uv pip install "scitex[repl]". Requires Python ≥ 3.9.

Per-extra installs
Extra Pulls in
dev pytest, pytest-cov, ruff, scitex-dev
docs sphinx, sphinx-rtd-theme, myst-parser, sphinx-copybutton, sphinx-autodoc-typehints

Architecture

flowchart LR
    U["user code"] --> E["_embed.py: embed()"]
    U --> L["_less.py: less(output)"]
    U --> P["_paste.py: paste()"]
    E --> IP["IPython.embed + pyperclip"]
    L --> PG["less via get_ipython().system"]
    P --> EX["textwrap.dedent + exec"]
    EX --> LG["scitex-logging diagnostics"]

Figure 2. Three thin helpers over IPython and pyperclip: embed, page, and exec-with-diagnostics.

3 Interfaces

Python API
import scitex_repl

# Drop into an IPython shell, optionally pre-executing the clipboard.
scitex_repl.embed()

# Pipe a string through the system `less` pager.
scitex_repl.less("a very long string ...")

# Exec the current clipboard contents.
scitex_repl.paste()

Status

  • less and paste are functional thin wrappers over IPython / pyperclip.
  • embed is preserved from the upstream — the upstream file was mostly commented-out scaffolding around a single small helper. A richer REPL bootstrapper can be layered on later if there's demand.

Ported out of scitex_gen._ipython as part of the scitex-gen full retirement wave.

Part of SciTeX

scitex-repl is part of SciTeX. Install via the umbrella with pip install scitex[repl] to use as scitex.repl (Python) or scitex repl ... (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-only (see LICENSE).


SciTeX

Metadata

Release files for scitex-repl 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-repl 0.1.2
File Size Uploaded Provenance
scitex_repl-0.1.2.tar.gz 36.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-repl 0.1.2
File Interpreter ABI Platform
scitex_repl-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 55.8 kB

Release files / scitex_repl-0.1.2.tar.gz

Download URL scitex_repl-0.1.2.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dda66307060c0aca72fb60adc57dbd8c761c491d19195d4122896b8a3a5eedb9
BLAKE2b-256 checksum
How to use checksums
3f690f7a02a566d685777e4a589cf1abaf6ba19c98022cae5616689fbe1c38f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / scitex_repl-0.1.2-py3-none-any.whl

Download URL scitex_repl-0.1.2-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fbfb95d95ce950eec15105b0be5b08aaed9ea80ee886c6db91b62c8d0f4874d
BLAKE2b-256 checksum
How to use checksums
ff65bc8d5fe7ebecab873c14b9a27e9815f4af9dd743b4f0f2ffbad7de08e783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Security for scitex-repl 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page