Skip to content

[DOC] [BLD] Building / developing matplotlib with uv #30877

@scottshambaugh

Description

@scottshambaugh

I've been slowly converting all my personal repos to use uv for dependency management, and gave it a shot on matplotlib to see if it'd work. The below works right out of the box for me:

# Create a virtual environment with uv
uv venv .venv

# Activate the environment (optional, uv commands will automatically use the venv)
source .venv/bin/activate  # Linux/macOS
# or: .venv\Scripts\activate  # Windows

# Install dev dependencies
uv pip install -r requirements/dev/dev-requirements.txt

# Install matplotlib in editable mode
uv pip install --no-build-isolation --editable ".[dev]"

# Verify installation
uv run python -c "import matplotlib; print(matplotlib.__file__)"

Then I just point my VSCode python interpreter to the one in the .venv and everything works well. Note that a uv sync workflow does not work, given our somewhat custom build setup.

I'm ambivalent about adding this as an option to the development setup instructions, since the pip commands throughout would need a toggle. I'm also unclear what sort of CI we use to ensure build instructions work as-written. But figured it was worth sharing here in case people want to use this approach.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions