Port requirements to PEP735#29281
Conversation
|
Note, |
WeatherGod
left a comment
There was a problem hiding this comment.
I was curious about this new PEP, so I took a look through the changes. I think this would be a really neat feature when pip implements it. I know this is just a draft, but I figured I can point out a couple things I noticed, and I had a couple of questions, too.
azure-pipelines.yml
Outdated
| python -m pip install --upgrade pip | ||
| python -m pip install --upgrade -r requirements/dev/build-requirements.txt | ||
| python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt | ||
| python -m pip install --group build --group test --group test-extra |
There was a problem hiding this comment.
We'll have to see if it matters whether or not we were upgrading certain dependencies or not. I suspect not.
pyproject.toml
Outdated
|
|
||
| # Extra pip requirements for the Python 3.10+ builds | ||
| test-extra = [ | ||
| "--prefer-binary", |
There was a problem hiding this comment.
Will command-line arguments and sys.platform references work in this PEP? It isn't entirely clear to me.
There was a problem hiding this comment.
Ah, the command-line argument probably won't, but we'll have to see how the pip implementation ends up. The sys.platform should work as these are standard dependency specifiers.
There was a problem hiding this comment.
I learned something new! Neat!
There was a problem hiding this comment.
So unfortunately, we can't keep --prefer-binary here, so I've moved it to the CI invocation.
.github/workflows/reviewdog.yml
Outdated
|
|
||
| - name: Install mypy | ||
| run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt | ||
| run: pip3 install --group typing |
There was a problem hiding this comment.
does this also need group "test"?
There was a problem hiding this comment.
I'm hoping not, so we can reduce the install set.
pyproject.toml
Outdated
| # | ||
| # You will first need a matching Matplotlib installation | ||
| # e.g (from the Matplotlib root directory) | ||
| # pip install --no-build-isolation --editable .[dev] |
There was a problem hiding this comment.
Is the .[dev] correct? Or should it be just .?
There was a problem hiding this comment.
The [dev] is an extra, not a dependency group. It was intended to cover both build and runtime dependencies. It didn't really work though, as pip installed . before its dependencies, so you couldn't get the build ones early enough. Based on the other implementations, dependency groups should be strictly better, since they should install before ., but we'll have to see how it's finally implemented. I should probably rewrite this section a bit once that's finalized.
There was a problem hiding this comment.
Oh, I see. I'm not used to seeing an extra be specified against a directory, so I thought it was a typo. And, yeah, extras wouldn't work for installing dependencies.
0b93f55 to
8ef2f01
Compare
|
I rebased and fixed the comments. |
5803913 to
6770028
Compare
dstansby
left a comment
There was a problem hiding this comment.
This is also going to require pip >= 25.1 for anyone developing Matplotlib - that should at least go in some sort of release note/changelog entry, and be noted in the development setup docs.
pyproject.toml
Outdated
| {include-group = "doc"}, | ||
| {include-group = "test"}, | ||
| {include-group = "test-extra"}, | ||
| "ruff", |
There was a problem hiding this comment.
pre-commit should be added here, and perhaps ruff dropped since running pre-commit runs ruff.
pyproject.toml
Outdated
| "types-python-dateutil", | ||
| "types-psutil", | ||
| "sphinx", | ||
| {include-group = "build"}, |
There was a problem hiding this comment.
Given the doc and test groups dont' depend on build, I don't think typing should either, and the build group can be additionally specified during the CI install stage.
|
Added a few notes for the pip 25.1 requirement. |
a27e0ec to
c0e0bce
Compare
|
Coming over from #30877, this branch works for a modified uv workflow: uv venv .venv
# Activate the environment (NOT optional)
source .venv/bin/activate # Linux/macOS
# or: .venv\Scripts\activate # Windows
# Install dev dependencies
uv pip install --group dev
# Install matplotlib in editable mode
uv pip install --no-build-isolation --group dev --editable .
# Verify installation
python -c "import matplotlib; print(matplotlib.__file__)"However, solving dependencies using a strict solver that tries to make a lock file (this includes Could we split that group off into its own subproject? Eg something like: requirements/minver-test/pyproject.toml: [project]
name = "matplotlib-test-minver"
version = "0.0.0"
requires-python = ">=3.11,<3.12"
dependencies = [
"contourpy==1.0.1",
"cycler==0.10",
"fonttools==4.22.0",
"importlib-resources==3.2.0",
"kiwisolver==1.3.2",
"meson-python==0.13.1",
"meson==1.1.0",
"numpy==1.25.0",
"packaging==20.0",
"pillow==9.0.1",
"pyparsing==3.0.0",
"pytest==7.0.0",
"python-dateutil==2.7",
"ipython==7.29.0",
"ipykernel==5.5.6",
"matplotlib-inline<0.1.7",
] |
|
Consensus on call is to put the minver back in a requirments.txt as we only use it one CI test to keep things simple and unbreak |
|
OK, moved the minimum version requirements to the @scottshambaugh let me know if there are any other problems with uv. |
|
# Create the environment and install (includes dev group in the env)
uv sync
# Verify installation
uv run python -c "import matplotlib; print(matplotlib.__file__)"
# OR
source .venv/bin/activate
python -c "import matplotlib; print(matplotlib.__file__)" |
|
And # Add tool.pixi sections to pyproject.toml (can skip if preconfigured)
pixi init
# Create the environment and install (creates both default and dev environments)
pixi install
# Verify installation
pixi run -e dev python -c "import matplotlib; print(matplotlib.__file__)"
# OR
pixi shell -e dev
python -c "import matplotlib; print(matplotlib.__file__)"These are the non-empty sections added to [tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]
[tool.pixi.pypi-dependencies]
matplotlib = { path = ".", editable = true }
[tool.pixi.environments]
default = { solve-group = "default" }
dev = { features = ["dev"], solve-group = "default" } |
|
@QuLogic were there any outstanding discussions from the call on this? IMO it's good to merge |
|
I don't recall anything, and I'm not seeing anything in the meeting notes. |
PR summary
PEP735 introduces the concept of "Dependency Groups"; these essentially replace our use of various
requirements.txtfiles.NOTE: This is waiting forpipto actually implement Dependency Groups: pypa/pip#12963 We may or may not wish to wait for that to bake a bit even after it's been implemented as well.PR checklist