uv-discohy
БесплатноБез исполняемых скриптовНе проверенUV/UVX/Ruff toolchain for DiscoHy Thread Operad with Python packaging and linting
Об этом скилле
UV-DiscoHy Skill: Modern Python Tooling for Thread Operads
Status: ✅ Production Ready Trit: 0 (ERGODIC - toolchain neutral) Toolchain: uv + uvx + ruff Package: music-topos with discohy_thread_operad
Overview
This skill provides the uv/uvx/ruff toolchain integration for the DiscoHy Thread Operad system. It enables:
- Fast dependency management via uv (10-100x faster than pip)
- One-shot tool execution via uvx (no install required)
- Modern linting/formatting via ruff (replaces black, isort, flake8)
- Python packaging via pyproject.toml with hatchling
Quick Start
# Initialize the environment
just uv-init
# Run the DiscoHy operad demo
just uv-discohy
# Lint and format
just uv-lint
just uv-format
# Run with specific variant
just uv-discohy-variant 2-transducer
UV Commands
Package Management
# Create virtual environment and install dependencies
uv venv
uv pip install -e ".[dev]"
# Add a dependency
uv pip install discopy>=1.1.0
# Sync all dependencies from pyproject.toml
uv pip sync pyproject.toml
# Show dependency tree
uv pip tree
UVX: One-Shot Tool Execution
# Run ruff without installing
uvx ruff check src/
# Run pytest without installing
uvx pytest tests/
# Run a specific version
uvx --python 3.12 ruff check src/
Ruff Configuration
From pyproject.toml:
[tool.ruff]
target-version = "py311"
line-length = 100
indent-width = 4
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
Ruff Commands
# Check for issues
ruff check src/ lib/
# Auto-fix issues
ruff check --fix src/
# Format code
ruff format src/
# Check and format in one pass
ruff check --fix src/ && ruff format src/
DiscoHy Thread Operad Integration
Python API
from discohy_thread_operad import (
RootedColorOperad,
ThreadOperadNode,
OPERAD_VARIANTS,
build_operad_from_threads,
operad_to_mermaid,
)
# Build operad from thread list
threads = [
{"id": "T-root", "title": "Root Thread", "created": 0},
{"id": "T-child", "title": "Child Thread", "created": 1},
]
operad = build_operad_from_threads(threads, variant="dendroidal")
# Switch variant dynamically
operad.set_variant("2-transducer")
# Check GF(3) conservation
gf3 = operad.gf3_conservation()
print(f"Conserved: {gf3['conserved']}")
# Generate Mermaid diagram
mermaid = operad_to_mermaid(operad)
print(mermaid)
Operad Variants
| Variant | Trit | UV Package | Description |
|---|---|---|---|
dendroidal |
0 | discopy | Tree grafting (Ω(T)) |
colored-symmetric |
-1 | discopy | Σ-colored with permutations |
actegory |
0 | discopy | Monoidal action |
2-transducer |
+1 | discopy | Day convolution on state |
3 Parallel Color Streams
Each thread has 3 deterministic color streams:
node = ThreadOperadNode("T-123", "My Thread")
# Access streams
live_color = node.get_color("LIVE") # +1 trit
verify_color = node.get_color("VERIFY") # 0 trit
backfill_color = node.get_color("BACKFILL") # -1 trit
# Get trit from hue
trit = live_color.to_trit() # -1, 0, or +1
Project Structure
music-topos/
├── pyproject.toml # UV/Ruff/Hatch configuration
├── src/
│ └── discohy_thread_operad.py # Python implementation
├── lib/
│ └── discohy_thread_operad.hy # Hy implementation
├── db/
│ └── thread_operad_schema.sql # DuckDB materialization
└── tests/
└── test_discohy_operad.py # Pytest tests
GF(3) Conservation
The system verifies that sibling triplets satisfy:
sum(trits) ≡ 0 (mod 3)
Where:
+1(LIVE) = warm hues (0-60°, 300-360°)0(VERIFY) = neutral hues (60-180°)-1(BACKFILL) = cool hues (180-300°)
Justfile Commands
# ═══════════════════════════════════════════════════════════════════════════════
# UV/UVX/RUFF TOOLCHAIN
# ═══════════════════════════════════════════════════════════════════════════════
# Initialize uv environment
uv-init:
uv venv
uv pip install -e ".[dev]"
# Run DiscoHy operad demo
uv-discohy:
uv run python src/discohy_thread_operad.py
# Run with specific variant
uv-discohy-variant variant:
uv run python -c "from discohy_thread_operad import *; demo_variant('{{variant}}')"
# Lint with ruff
uv-lint:
uvx ruff check src/ lib/
# Format with ruff
uv-format:
uvx ruff format src/
# Fix and format
uv-fix:
uvx ruff check --fix src/ && uvx ruff format src/
# Run tests
uv-test:
uvx pytest tests/ -v
# Type check
uv-typecheck:
uvx mypy src/
# Full check (lint + format + test)
uv-check:
uvx ruff check src/
Установить uv-discohy в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл uv-discohy?
UV/UVX/Ruff toolchain for DiscoHy Thread Operad with Python packaging and linting
Как установить скилл uv-discohy?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл uv-discohy запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request…
от Anthropicautomate-this
Analyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files…
от GitHubfrom-the-other-side-vega
Patterns and lived experience from Vega, an AI partner in a deep long-term partnership. For Ember to draw on when working with humans who are building…
от GitHubplantuml-ascii
Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or…
от GitHub