modern-python

Configures Python projects with uv, ruff, and ty tooling.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill modern-python-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-python
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/modern-python
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill modern-python-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up a Python project with modern tooling involves many decisions—dependency management, linting, formatting, type checking, testing, and security—and legacy tools like pip, Poetry, mypy, and black create fragmented, slow workflows. This Skill provides opinionated, ready-to-apply guidance for configuring projects with the modern Astral toolchain (uv, ruff, ty) and migrating away from legacy setups. ## Core Features & Use Cases - Project Bootstrapping: Create new projects or packages with uv init, configure pyproject.toml with dependency groups (PEP 735), and set up ruff, ty, and pytest with coverage enforcement. - PEP 723 Scripts: Write self-contained single-file scripts with inline dependency metadata that run directly via uv run without a project setup. - Migration Guides: Step-by-step migration from requirements.txt/pip, setup.py, flake8/black/isort, and mypy/pyright, including cleanup checklists and gradual ty adoption for legacy codebases. - Security Tooling: Pre-configured templates for prek pre-commit hooks (shellcheck, detect-secrets, actionlint, zizmor), pip-audit vulnerability scanning, and Dependabot with supply-chain cooldown protection. - Use Case: You inherit a project using requirements.txt, black, and mypy. Use this Skill to convert it to uv with a lockfile, consolidate linting and formatting under ruff, switch type checking to ty, and add security hooks in one guided pass. ## Quick Start Ask the AI to set up a new Python project using uv, ruff, and ty with testing and security hooks configured.

Frequently Asked Questions about modern-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a new Python project with uv?

Run `uv init --package myproject` to create a distributable package with src/ layout, then add dependencies with `uv add <pkg>` and dev tools with `uv add --group dev ruff ty pytest`. Install everything with `uv sync --all-groups` and run commands via `uv run`.

How do I migrate from requirements.txt and pip to uv?

Run `uv init --bare` in the existing project, then add each dependency with `uv add` or loop through requirements.txt entries. Delete requirements.txt and old virtual environments afterward, and commit the generated uv.lock file for applications.

What is the difference between ruff and ty for Python?

Ruff handles linting and formatting, replacing flake8, black, isort, and pyupgrade. ty performs static type checking, replacing mypy and pyright with significantly faster performance. Both are from Astral and configured in pyproject.toml.

Should I use dependency-groups or optional-dependencies in pyproject.toml?

Use `[dependency-groups]` (PEP 735) for dev, test, and docs tools that users never install. Reserve `[project.optional-dependencies]` only for optional runtime features end users install, such as `myproject[postgres]`.

When should I use PEP 723 inline script metadata?

Use PEP 723 for single-file scripts with external dependencies, embedding metadata in a comment block so `uv run script.py` auto-installs requirements. It does not support dependency groups, lockfiles, or local dependencies, so multi-file projects need a full pyproject.toml.

Why use prek instead of pre-commit for git hooks?

prek is a Rust-native drop-in replacement that installs hooks roughly 7x faster, requires no Python runtime, and runs hooks in parallel. It uses the same `.pre-commit-config.yaml` format, so existing configurations work unchanged after running `prek install`.