dev-python

Guides Python project development with uv, pytest, ruff, and packaging conventions.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/mnazaal/dotfiles --skill dev-python-mnazaal
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-python
Source: https://github.com/mnazaal/dotfiles/tree/main/.agents/skills/dev-python
Command: npx skills add https://github.com/mnazaal/dotfiles --skill dev-python-mnazaal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python projects accumulate inconsistent tooling, stale lockfiles, untyped public APIs, and tangled script/library boundaries. This Skill enforces disciplined conventions for environments, dependencies, testing, typing, and packaging so Python and ML research code stays importable, reproducible, and maintainable. ## Core Features & Use Cases - Environment and dependency management: Standardizes on uv for virtual environments, lockfile handling, and dependency resolution, including the rule that manual pyproject.toml edits require uv lock in the same change. - Testing, linting, and typing workflow: Runs pytest (with xdist override guidance), ruff, and ty, and enforces fully typed public surfaces with jaxtyping array annotations. - Library design rules: Keeps importable library code separate from scripts/notebooks, avoids dependency upper-bound caps in libraries, and keeps heavy imports function-local. - Use Case: When adding a feature to an ML research repository, follow this Skill to respect the existing package layout, add typed public interfaces, run focused pytest verification, and keep the lockfile in sync. ## Quick Start Ask the AI to add a new typed function to your Python package and verify it with pytest following the project's existing conventions.

Frequently Asked Questions about dev-python

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

FAQPage Schema
How do I manage Python dependencies with uv?▼

Use `uv add <package>` to add dependencies, which updates both pyproject.toml and the lockfile. If you hand-edit pyproject.toml, run `uv lock` and commit the refreshed lockfile in the same change, since `uv sync` on other machines re-resolves a stale lock differently.

How do I run pytest when addopts hardcodes parallel workers?▼

Override the hardcoded `-n <workers>` flag with `pytest -n0` to disable xdist for a single run. Do not use `-p no:xdist`, which conflicts with the addopts setting and causes errors.

Should a Python library pin upper bounds on dependencies?▼

No. Libraries should not cap dependencies because upper bounds propagate to every downstream user and collide with other libraries' constraints. Fix incompatibilities at your own boundary with lazy imports or a narrower surface; only applications should pin versions.

Why should heavy imports stay inside functions in Python packages?▼

A module-scope import puts that dependency and its transitive tree on the import path of the entire package, so an upstream break makes `import yourpackage` fail for all users. Function-local imports isolate optional dependencies; verify with `sys.modules` before and after the top-level import.

What tools should a greenfield Python project use by default?▼

Default to uv for environments and dependencies, pytest for tests, ruff for linting, and ty for type checking, falling back to pyright or mypy where ty has gaps. For ML research repos, add hydra-zen configs and MLflow behind a tracker seam.