Get the FREE Ultimate OpenClaw Setup Guide →

python-env

npx machina-cli add skill aiskillstore/marketplace/python-env --openclaw
Files (1)
SKILL.md
2.5 KB

Python Environment

Fast Python environment management with uv.

Quick Commands

TaskCommand
Create venvuv venv
Install packageuv pip install requests
Install from requirementsuv pip install -r requirements.txt
Run scriptuv run python script.py
Show installeduv pip list

Virtual Environment

# Create venv (instant)
uv venv

# Create with specific Python
uv venv --python 3.11

# Activate (or use uv run)
source .venv/bin/activate  # Unix
.venv\Scripts\activate     # Windows

Package Installation

# Single package
uv pip install requests

# Multiple packages
uv pip install flask sqlalchemy pytest

# With extras
uv pip install "fastapi[all]"

# Version constraints
uv pip install "django>=4.0,<5.0"

# Uninstall
uv pip uninstall requests

Minimal pyproject.toml

[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
    "httpx>=0.25",
    "pydantic>=2.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0",
    "ruff>=0.1",
]

Project Setup Checklist

mkdir my-project && cd my-project
uv venv
# Create pyproject.toml
uv pip install -e ".[dev]"
uv pip list

Troubleshooting

IssueSolution
"No Python found"uv python install 3.11
Wrong Python versionuv venv --python 3.11
Conflicting depsuv pip compile --resolver=backtracking
Cache issuesuv cache clean

When to Use

  • Always use uv over pip for speed
  • Creating virtual environments
  • Installing packages
  • Managing dependencies
  • Running scripts in project context

Additional Resources

For detailed patterns, load:

  • ./references/pyproject-patterns.md - Full pyproject.toml examples, tool configs
  • ./references/dependency-management.md - Lock files, workspaces, private packages
  • ./references/publishing.md - PyPI publishing, versioning, CI/CD

See Also

This is a foundation skill with no prerequisites.

Build on this skill:

  • python-typing-patterns - Type hints for projects
  • python-pytest-patterns - Testing infrastructure
  • python-fastapi-patterns - Web API development

Source

git clone https://github.com/aiskillstore/marketplace/blob/main/skills/0xdarkmatter/python-env/SKILL.mdView on GitHub

Overview

Python-env is a fast environment manager powered by the uv CLI. It streamlines creating virtual environments, installing packages, and managing dependencies with blazing speed - 10-100x faster than pip. It responds to triggers like uv, venv, pip, pyproject, Python environment, install package, and dependencies.

How This Skill Works

The uv CLI handles venv creation (uv venv), package installation (uv pip install ...), and script execution (uv run ...). It can show installed packages with uv pip list. All actions route through standard Python tooling, but uv orchestrates the workflow for speed and consistency across projects.

When to Use It

  • Create a project-specific virtual environment quickly
  • Install dependencies from pyproject or requirements.txt
  • Install and manage packages with fast, consistent commands
  • Run scripts in the project context without manual env activation
  • Troubleshoot or adjust Python versions inside a controlled env

Quick Start

  1. Step 1: Install uv CLI: curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Step 2: Create a venv: uv venv
  3. Step 3: Install dependencies: uv pip install -r requirements.txt

Best Practices

  • Always use uv over pip for speed
  • Create a dedicated venv per project with uv venv
  • Install dev dependencies with uv pip install -e .[dev] when using a pyproject.toml
  • Keep pyproject.toml dependencies in sync for reproducible installs
  • If you hit conflicts, try uv pip compile --resolver=backtracking and uv cache clean

Example Use Cases

  • Create a venv for a new project: uv venv
  • Install a single package: uv pip install requests
  • Install from requirements: uv pip install -r requirements.txt
  • Run a script in project context: uv run python script.py
  • List installed packages: uv pip list

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers