python-build-tools
@martinffx · 收录于 1 周前
Python project tooling with uv, mise, ruff, basedpyright, and pytest. Use when setting up pyproject.toml, running builds, typechecking, configuring tests, linting, formatting, or managing Python environments.
适合你,如果经常用 Python 开发并需要统一工具链
/ 下载安装
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code
~/.claude/skills/(项目级 .claude/skills/)Codex CLI
~/.codex/skills/Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add martinffx/atelier/python-build-tools/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- martinffx/atelier/python-build-tools/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify martinffx/atelier/python-build-tools安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
34GitHub stars
~647最小装载
~3.7K含声明引用
~3.7K文本包总量
镜像托管
怎么用
技能原文 SKILL.md
Python Build Tools
Modern Python development tooling using uv, mise, ruff, basedpyright, and pytest.
Quick Start
Minimal pyproject.toml
[project] name = "my-project" version = "0.1.0" requires-python = ">=3.12" dependencies = ["fastapi", "pydantic"] [project.optional-dependencies] dev = ["pytest>=8.0.0", "ruff>=0.8.0", "basedpyright>=1.0.0"] [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [tool.ruff] target-version = "py312" [tool.ruff.lint] select = ["E", "F", "I", "N", "UP", "RUF"] [tool.basedpyright] typeCheckingMode = "strict" [tool.pytest.ini_options] testpaths = ["tests"]
Setup Project
uv init my-project && cd my-project uv sync uv add fastapi pydantic uv add --dev pytest ruff basedpyright
Tool Overview
| Tool | Purpose | Replaces | |------|---------|----------| | uv | Package management | pip, virtualenv | | mise | Version & tasks | pyenv, asdf | | ruff | Lint & format | black, isort, flake8 | | basedpyright | Type checking | mypy | | pytest | Testing | unittest |
Common Commands
Lint and Format
uv run ruff check --fix . uv run ruff format .
Type Check
uv run basedpyright uv run basedpyright src/main.py
Test
uv run pytest uv run pytest --cov=src --cov-report=html
Manage Dependencies
uv add fastapi uv add --dev pytest uv lock --upgrade uv tree
Mise Configuration
Create .mise.toml for consistent development:
[tools] python = "3.12" [tasks.lint] run = "uv run ruff check --fix ." [tasks.format] run = "uv run ruff format ." [tasks.typecheck] run = "uv run basedpyright" [tasks.test] run = "uv run pytest" [tasks.check] depends = ["lint", "format", "typecheck", "test"]
Usage:
mise install mise run check
Type Hints Example
from decimal import Decimal
from typing import Optional
def calculate_discount(
total: Decimal,
rate: Optional[Decimal] = None
) -> Decimal:
if rate is None:
rate = Decimal("0.1")
return total * rate
Best Practices
- Use uv for all package management (faster, reliable)
- Pin Python version with mise
- Configure tools in pyproject.toml
- Enable strict type checking
- Run checks before commit
References
For detailed configuration and advanced patterns:
- [references/uv.md](references/uv.md) - Workspaces, scripts, dependency management
- [references/ruff.md](references/ruff.md) - Rules, per-file ignores, pre-commit integration
- [references/basedpyright.md](references/basedpyright.md) - Type patterns, generics, protocols
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →
评论
登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。
…