uv-python-projects

A set of rules for managing Python projects with UV, a tool for installing dependencies, creating environments, and packaging Python code.

In plain words
What is it for?
Use it to initialize projects, select Python versions, organize source and test folders, maintain pyproject.toml and uv.lock, and manage dependencies with modern packaging practices.
Why use it?
It helps keep Python environments reproducible by pinning versions and recording dependencies in lockfiles.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/jakerains/citrusrules/uv-python-projects
Clone the repo
git clone --depth 1 https://github.com/jakerains/CitrusRules
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,827 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02827
Opus 5 $0.00000 $0.01413
Sonnet 5 $0.00000 $0.00565
Haiku 4.5 $0.00000 $0.00283

Measured yesterday against content hash a4cb3ccaa39a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

uv-python-projects scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.get("https://api.github.com/repos/astral-sh/uv")
templates/uv-python-projects.mdc · 545 lines

How it starts

The opening of the file, as written. The whole thing — 545 lines — stays where its author put it; the contents beside it link to each section on GitHub.

UV Python Projects

Implement modern Python project management using UV for 10-100x faster dependency resolution, comprehensive tooling, and streamlined development workflows.

Core Principles

  • Use UV as the single tool for Python project lifecycle management
  • Maintain reproducible environments with lockfiles and version pinning
  • Leverage UV's global cache for optimal performance and disk efficiency
  • Follow modern Python packaging standards with pyproject.toml
  • Implement security-first dependency management practices

Project Initialization

New Project Setup

# Initialize new project with UV
uv init my-project
cd my-project

# Or initialize in existing directory
uv init .

# Initialize with specific Python version
uv init --python 3.12 my-project

Modern Project Structure

my-project/
├── src/
│   └── my_project/
│       ├── __init__.py
│       └── main.py
├── tests/
│   └── test_main.py
├── pyproject.toml      # Project configuration
├── uv.lock            # Lockfile (commit to version control)
├── .python-version     # Python version pinning
├── README.md
└── .gitignore

Essential pyproject.toml Template

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "0.1.0"
description = "A modern Python project using UV"
readme = "README.md"
requires-python = ">=3.10"
authors = [
    { name = "Your Name", email = "[email protected]" }
]
classifiers = [
    "Development Status :: 4 - Beta",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
]
dependencies = [
    # Production dependencies go here
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0",
    "black>=23.0",
    "ruff>=0.1",
    "mypy>=1.0",
]
test = [
    "pytest>=7.0",
    "pytest-cov>=4.0",
]
docs = [
    "mkdocs>=1.5",
    "mkdocs-material>=9.0",
]

[project.scripts]
my-project = "my_project.main:main"

[tool.ruff]
target-version = "py310"
line-length = 88
select = ["E", "F", "I", "N", "W", "UP"]

[tool.black]
target-version = ["py310"]
line-length = 88

[tool.mypy]
python_version = "3.10"
strict = true

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra -q --strict-markers"
markers = [
    "slow: marks tests as slow",
    "integration: marks tests as integration tests",
]

Read the full file on GitHub · 545 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 545 lines · 0 tokens per session scan A a4cb3ccaa39a

Subscribe to this mod's changes

uv-python-projects is a cursor rule published in the GitHub repository jakerains/CitrusRules (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,827 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.