Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port requirements to PEP735 #29281

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Port requirements to PEP735 #29281

wants to merge 1 commit into from

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Dec 11, 2024

PR summary

PEP735 introduces the concept of "Dependency Groups"; these essentially replace our use of various requirements.txt files.

NOTE: This is waiting for pip to 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

@QuLogic QuLogic added this to the future releases milestone Dec 11, 2024
@github-actions github-actions bot added CI: Run cygwin Run cygwin tests on a PR Documentation: devdocs files in doc/devel labels Dec 11, 2024
@QuLogic
Copy link
Member Author

QuLogic commented Dec 11, 2024

Note, tox does support this already, so the stubtest job is the only one (using dependencies) that does work right now.

Copy link
Member

@WeatherGod WeatherGod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -174,10 +174,9 @@ jobs:
- name: Install Python dependencies
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --group build
python -m pip install kiwisolver 'numpy>=1.22,<1.26' pillow importlib_resources
grep -v -F -e psutil requirements/testing/all.txt >requirements_test.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements/testing/all.txt is removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cygwin doesn't run right now, so I kind of gave up on finishing it; there are probably more missed entries there.

@@ -71,8 +71,7 @@ stages:

- bash: |
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to see if it matters whether or not we were upgrading certain dependencies or not. I suspect not.

# pip install --no-build-isolation --editable .[dev]
#
# Install the documentation requirements with:
# pip install -r requirements/doc/doc-requirements.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed pip command to update


# Extra pip requirements for the Python 3.10+ builds
test-extra = [
"--prefer-binary",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will command-line arguments and sys.platform references work in this PEP? It isn't entirely clear to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned something new! Neat!

@@ -51,7 +51,7 @@ jobs:
python-version: '3.10'

- name: Install mypy
run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
run: pip3 install --group typing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this also need group "test"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping not, so we can reduce the install set.

#
# You will first need a matching Matplotlib installation
# e.g (from the Matplotlib root directory)
# pip install --no-build-isolation --editable .[dev]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the .[dev] correct? Or should it be just .?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants