From data-science
Sets up Python 3.13 environments with uv, project-root .venv, uv pip installs, script execution via uv run, and venv conflict resolution.
npx claudepluginhub policyengine/policyengine-claude --plugin data-scienceThis skill uses the workspace's default tool permissions.
All PolicyEngine Python work uses **uv** with **Python 3.13** and a local `.venv`.
Manages Python virtual environments and dependencies with uv (10-100x faster than pip): create venvs, install packages from pyproject.toml or requirements.txt, run scripts, troubleshoot issues.
Guides uv for Python: init projects, add/sync deps, manage venvs/interpreters, resolve conflicts, generate lockfiles. Use for fast setups, pip/poetry migrations, CI/Docker optimization.
Guides uv for Python projects: dependency management with pyproject.toml, virtual environments, Python versions, PEP 723 scripts, tool installs, pip/poetry migrations, CI/CD, Docker.
Share bugs, ideas, or general feedback.
All PolicyEngine Python work uses uv with Python 3.13 and a local .venv.
uv — fast Python package and project managerInstall uv if not present:
curl -LsSf https://astral.sh/uv/install.sh | sh
Always create a .venv at the project root using Python 3.13:
uv venv --python 3.13
source .venv/bin/activate
On Windows:
uv venv --python 3.13
.venv\Scripts\activate
Always use uv pip install, never bare pip install:
# Install a package
uv pip install policyengine
# Install from requirements file
uv pip install -r requirements.txt
# Install the current project in editable mode
uv pip install -e .
# Install with extras
uv pip install -e ".[dev]"
After activating the venv, run Python normally:
python script.py
python -m pytest
Or run without activating using uv:
uv run python script.py
uv run pytest
# Confirm Python version (should be 3.13.x)
python --version
# Confirm uv is being used
which pip # should point to .venv
uv pip list
uv venv --python 3.13
source .venv/bin/activate
uv pip install -e ".[dev]"
# Edit pyproject.toml to add the dependency, then:
uv pip install -e .
uv run pytest
# or after activating:
pytest
If you see a warning like:
warning: `VIRTUAL_ENV=/Users/.../.venv` does not match the project environment path `.venv` and will be ignored
This means a different venv is active (e.g. a global one at ~/.venv). Fix with:
# Option 1: Deactivate and use uv run
deactivate
uv run python script.py
# Option 2: Use --active flag to force uv to use the active env
uv run --active python script.py
# Option 3: Activate the correct project venv explicitly
source /path/to/project/.venv/bin/activate
python script.py
Do not mix venvs between projects. Each project should have its own .venv at the repo root.
python -m venv — always uv venvpip install — always uv pip install--python 3.13).venvuv run <cmd> as an alternative to activating the venv manuallydeactivate then uv run