Skip to main content

Core infrastructure and fundamental utilities for the SciTeX ecosystem

Project description

scitex-core

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

Python Version License Tests Version Code Style

Core infrastructure for the SciTeX ecosystem.

Interfaces: Python ⭐⭐⭐ (primary) · CLI — · MCP — · Skills ⭐⭐ · Hook — · HTTP —

Problem and Solution

# Problem Solution
1 10 separate scitex- utility packages for dev tooling* -- pip install scitex-str, scitex-dict, scitex-path, ... gets tedious Bundled foundation -- import scitex_core exposes logging, errors, sh, path, str, dict, types, dt, parallel, repro in one install

Overview

scitex-core provides shared utilities used across all SciTeX packages:

  • logging: Enhanced logging with colored output and file support
  • errors: Common error classes with rich context
  • sh: Safe shell command execution
  • str: String utilities including ANSI color formatting
  • path: File path and directory utilities
  • repro: Reproducibility utilities (ID generation, random state management)
  • types: Shared type definitions and validators

Installation

pip install scitex-core

Usage

Logging

from scitex_core import logging

logger = logging.getLogger(__name__)
logger.info("Hello from scitex-core!")
logger.success("Operation completed")

Path Utilities

from scitex_core import path

# Find files
py_files = path.find_file("/home/user/project", "*.py")

# Get current script path
script_path = path.this_path()

# Find git repository root
git_root = path.find_git_root()

# Clean and normalize paths
cleaned = path.clean("path/with/../spaces ")

Reproducibility

from scitex_core.repro import RandomStateManager, gen_id

# Random state management
rng_manager = RandomStateManager(seed=42)
data_gen = rng_manager("data")
data = data_gen.random(100)

# Verify reproducibility
rng_manager.verify(data, "my_data")

# Generate unique IDs
exp_id = gen_id()  # "2025Y-11M-10D-12h30m45s_aB3xY9z2"

Type Definitions

from scitex_core.types import ArrayLike, is_array_like, is_list_of_type

def process_data(data: ArrayLike) -> None:
    if is_array_like(data):
        print("Valid array-like data")

numbers = [1, 2, 3, 4]
if is_list_of_type(numbers, int):
    print("All elements are integers")

Packages Using scitex-core

  • scitex-writer - Academic writing and LaTeX compilation
  • scitex-scholar - Research paper management
  • scitex-io - Scientific data I/O
  • scitex - Main package

Development

# Clone repository
git clone https://github.com/ywatanabe1989/scitex-core

# Install in editable mode
cd scitex-core
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run tests with coverage
pytest --cov=src/scitex_core --cov-report=html tests/

# Quick test (no dependencies)
python3 tests/simple_runner.py

Testing

The project has comprehensive test coverage:

  • 161+ test methods across 30+ test classes
  • 3 test modules: errors, sh, logging
  • Multiple test runners: pytest, simple_runner.py, run_tests.sh

See tests/README.md for detailed testing documentation.

Quick Test

# No installation required
python3 tests/simple_runner.py

Full Test Suite

# Install dependencies
pip install -e ".[dev]"

# Run all tests
pytest tests/ -v

# Generate coverage report
./tests/run_tests.sh -c -h
open htmlcov/index.html

License

MIT License - see LICENSE file for details.

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_core-0.2.6.tar.gz (9.2 MB view details)

Uploaded Source

Built Distribution

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

scitex_core-0.2.6-py3-none-any.whl (112.8 kB view details)

Uploaded Python 3

File details

Details for the file scitex_core-0.2.6.tar.gz.

File metadata

  • Download URL: scitex_core-0.2.6.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_core-0.2.6.tar.gz
Algorithm Hash digest
SHA256 8521857c9098122955d2d8e07f8f648cb43b24f0a7e16d8a1f0883a70d5c482f
MD5 e1173a878bb005f7abf2827bc4a39016
BLAKE2b-256 105536d2fd124bd0d314340ef44229bc1504950c74b3091fe36370a126d5d498

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_core-0.2.6.tar.gz:

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

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_core-0.2.6-py3-none-any.whl.

File metadata

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

File hashes

Hashes for scitex_core-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 62d92dc3bb41a16b09c3c34b04b32f277cbc07deca0c55818e93053fdb786847
MD5 eb4de2a41c3844405ea49706e6948ca3
BLAKE2b-256 f2e1276db9eba76db9c25f38dcea5957cad96b8a03f5c6daa75e7357a0a5ccd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_core-0.2.6-py3-none-any.whl:

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

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