Skip to main content

Text processing utilities for scientific workflows — LaTeX formatting, colored output, string parsing, and plot text helpers

Project description

SciTeX Str (scitex-str)

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

SciTeX

Text processing utilities for scientific workflows.

Full Documentation · pip install scitex-str


Problem and Solution

# Problem Solution
1 LaTeX labels crash matplotlib when TeX isn't installed — CI runners, laptops without MacTeX, Colab without !apt install texlive all fail safe_latex_render(s) — auto-detects LaTeX; falls back to mathtext then unicode silently
2 ANSI color codes + grep/parse sprinkled as ad-hoc re patterns — each script reinvents the wheel Grab-bag of helpersprintc, color_text, grep, parse, replace, mask_api, readable_bytes — boring but consistent across 33 packages

Installation

Requires Python >= 3.10.

pip install scitex-str

SciTeX users: pip install scitex already includes this. Use import scitex then scitex.str.

Quick Start

import scitex_str as ss

ss.to_latex_style("theta")        # r"$\theta$"
ss.printc("Success!", color="green")
ss.parse("./data/Patient_23/Hour_12", "./data/Patient_{id}/Hour_{hour}")
ss.readable_bytes(1_500_000)      # "1.43 MB"

1 Interfaces

Python API
import scitex_str as ss

# LaTeX-style formatting (with safe fallback)
ss.to_latex_style("theta")              # r"$\theta$"
ss.safe_to_latex_style("unknown")       # "unknown" (no error)

# Colored terminal output
ss.printc("Success!", color="green")
ss.ct("Warning", color="yellow")        # returns colored string

# Parse structured paths
ss.parse("./data/Patient_23/Hour_12",
         "./data/Patient_{id}/Hour_{hour}")  # {'id': 23, 'hour': 12}

# Plot text formatting
ss.format_plot_text("amplitude_mv")     # "Amplitude [mV]"

# Numeric formatting
ss.readable_bytes(1_500_000)            # "1.43 MB"
ss.factor_out_digits([1000, 2000, 3000])

# Misc
ss.grep(pattern, lines)
ss.search(...)
ss.replace(...)
ss.mask_api_key("sk-...")
ss.remove_ansi(text)
ss.squeeze_space("a  b   c")            # "a b c"
ss.title_case("hello world")
ss.decapitalize("Hello")

Part of SciTeX

scitex-str is part of SciTeX.

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.


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_str-0.1.8.tar.gz (405.0 kB view details)

Uploaded Source

Built Distribution

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

scitex_str-0.1.8-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file scitex_str-0.1.8.tar.gz.

File metadata

  • Download URL: scitex_str-0.1.8.tar.gz
  • Upload date:
  • Size: 405.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_str-0.1.8.tar.gz
Algorithm Hash digest
SHA256 3d0278cacbd8ec9f4bb70edd261466f13557e6f09149baf4f3acfdcd5e309aad
MD5 a23fa92afbd32fdcaa308765af681f56
BLAKE2b-256 d194ce64f2d0124fa96f97b1a4bb83deb502844f6615812d6a01393548edda22

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_str-0.1.8.tar.gz:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-str

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_str-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: scitex_str-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 46.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_str-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 daeba9e58c06a038f1380364a85d078dd47dae35b5925ebedfb778274f08be22
MD5 39dc12c65121971990fd18bbf3b688e7
BLAKE2b-256 45867dda2095b6b716e2ae09eccc8ac88e27e856ff4226d1cb15a764fcf3e32b

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_str-0.1.8-py3-none-any.whl:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-str

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