Skip to content

ywatanabe1989/scitex-python

Repository files navigation

SciTeX (scitex)

SciTeX

Modular Python Toolkit for Researchers and AI Agents

PyPI version Python Versions License uv recommended

Full Documentation · pip install scitex


Problem

Researchers face a fragmented toolchain — literature search, statistical analysis, figure creation, and manuscript writing each require separate tools with incompatible formats. AI agents can automate these steps, but lack a unified interface that connects them into a coherent pipeline.

Solution

SciTeX provides a modular Python toolkit that unifies the research workflow from data to manuscript. Each module (scholar, stats, plt, writer, io) works standalone or together, accessible through Python API, CLI, and MCP (Model Context Protocol) for AI agents. A single @scitex.session decorator tracks every parameter, output, and log for full reproducibility.

SciTeX Ecosystem

Figure 1. SciTeX research pipeline — AI agents orchestrate the full workflow from literature search to manuscript compilation.

Demo

40 min, zero human intervention — AI agent conducts full research pipeline:

Literature search → Data analysis → Statistics → Figures → 21-page manuscript → Peer review simulation

SciTeX Demo

Installation

pip install scitex               # Core (minimal)
pip install scitex[plt,stats,scholar]  # Typical research setup
pip install scitex[all]          # Recommended: Full installation

Quick Start

import scitex

# Speak to the user
scitex.audio.speak("Analysis starting")

# Load data and run statistics
result = scitex.stats.test_ttest_ind(group1, group2, return_as="dataframe")

# Create a publication-ready figure
fig, ax = scitex.plt.subplots()
ax.plot_line(x, y)
ax.set_xyt("Time (s)", "Amplitude", "Signal")
scitex.io.save(fig, "figure.png")  # Saves figure.png + figure.csv

Three Interfaces

Python API

@scitex.session — Reproducible Experiment Tracking

import scitex

@scitex.session
def main(filename="demo.jpg"):
    fig, ax = scitex.plt.subplots()
    ax.plot_line(t, signal)
    ax.set_xyt("Time (s)", "Amplitude", "Title")
    scitex.io.save(fig, filename)
    return 0

Output:

script_out/FINISHED_SUCCESS/2025-01-08_12-30-00_AbC1/
├── demo.jpg                    # Figure with embedded metadata
├── demo.csv                    # Auto-exported plot data
├── CONFIGS/CONFIG.yaml         # Reproducible parameters
└── logs/{stdout,stderr}.log    # Execution logs

scitex.io — Universal File I/O (30+ formats)

scitex.io.save(df, "output.csv")
scitex.io.save(fig, "output.jpg")
df = scitex.io.load("output.csv")

scitex.stats — Publication-Ready Statistics (23 tests)

result = scitex.stats.test_ttest_ind(group1, group2, return_as="dataframe")
# Includes: p-value, effect size, CI, normality check, power

Full module status

CLI Commands
scitex --help-recursive              # Show all commands
scitex scholar fetch "10.1038/..."   # Download paper by DOI
scitex scholar bibtex refs.bib       # Enrich BibTeX
scitex stats recommend               # Suggest statistical tests
scitex audio speak "Done"            # Text-to-speech
scitex capture snap                  # Screenshot

# List available APIs and tools
scitex list-python-apis              # List all Python APIs (210 items)
scitex mcp list-tools                # List all MCP tools (120+ tools)
scitex introspect api scitex.stats   # List APIs for specific module

Full CLI reference

MCP Server — for AI Agents

Turn AI agents into autonomous scientific researchers via the Model Context Protocol.

Typical workflow: Scholar (find papers) → Stats (analyze) → Plt (visualize) → Writer (manuscript) → Capture (verify)

Category Tools Description
writer 28 LaTeX manuscript compilation
scholar 23 PDF download, metadata enrichment
capture 12 Screen monitoring and capture
introspect 12 Python code introspection
audio 10 Text-to-speech, audio playback
stats 10 Automated statistical testing
plt 9 Matplotlib figure creation
diagram 9 Mermaid and Graphviz diagrams
dataset 8 Scientific dataset access
social 7 Social media posting
canvas 7 Scientific figure canvas
template 6 Project scaffolding
verify 6 Reproducibility verification
dev 6 Ecosystem version management
ui 5 Notifications
linter 3 Code pattern checking

Table 1. 120+ MCP tools organized by category. All tools accept JSON parameters and return structured results.

Claude Code Setup

Add .mcp.json to your project root. Use SCITEX_ENV_SRC to load all configuration from a .src file — this keeps .mcp.json static across environments:

{
  "mcpServers": {
    "scitex": {
      "command": "scitex",
      "args": ["mcp", "start"],
      "env": {
        "SCITEX_ENV_SRC": "${SCITEX_ENV_SRC}"
      }
    }
  }
}

Then switch environments via your shell profile:

# Local machine
export SCITEX_ENV_SRC=~/.scitex/scitex/local.src

# Remote server
export SCITEX_ENV_SRC=~/.scitex/scitex/remote.src

Generate a template .src file:

scitex env-template -o ~/.scitex/scitex/local.src

Or install globally:

scitex mcp installation

Full MCP tool reference

Configuration

Modular environment configuration via .env.d/:

# 1. Copy examples
cp -r .env.d.examples .env.d

# 2. Edit with your credentials
$EDITOR .env.d/

# 3. Source in shell (~/.bashrc or ~/.zshrc)
source /path/to/.env.d/entry.src

Structure:

.env.d/
├── entry.src              # Single entry point
├── 00_scitex.env          # Base settings (SCITEX_DIR)
├── 00_crossref-local.env  # CrossRef database
├── 00_figrecipe.env       # Plotting config
├── 01_scholar.env         # OpenAthens, API keys
├── 01_audio.env           # TTS backends
└── ...                    # Per-module configs

Full configuration reference

Standalone Packages

SciTeX integrates several standalone packages that can be used independently:

Details
Package scitex Module Description
figrecipe scitex.plt Publication-ready matplotlib figures
crossref-local scitex.scholar.crossref_scitex Local CrossRef database (167M+ papers)
openalex-local scitex.scholar.openalex_scitex Local OpenAlex database (250M+ papers)
socialia scitex.social Social media posting (Twitter, LinkedIn)
scitex-writer scitex.writer LaTeX manuscript compilation
scitex-dataset scitex.dataset Scientific dataset access

Each package works standalone or as part of scitex:

pip install figrecipe        # Use independently
pip install scitex[plt]      # Or via scitex

Part of SciTeX

SciTeX is an open-source research automation platform at scitex.ai.

The SciTeX system follows the Four Freedoms for Research below, inspired by the Free Software Definition:

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.


SciTeX