Skip to content

Remove pkg_sources use from Neutron and still pin virtualenv#103

Merged
sebageek merged 3 commits intostable/2024.1-m3from
backport-pkg-resources-patch
Mar 30, 2026
Merged

Remove pkg_sources use from Neutron and still pin virtualenv#103
sebageek merged 3 commits intostable/2024.1-m3from
backport-pkg-resources-patch

Conversation

@sebageek
Copy link
Copy Markdown
Collaborator

@sebageek sebageek commented Mar 16, 2026

This packports two upstream patches to remove pkg_resources usage from Neutron. We still need it, as at the moment the pep8 check uses a flake8 version that still requires pkg_resources. As all of this will go away anyway with the next major version bump I'm just going to go ahead and pin virtualenv in tox as with our other repos.

In [0] when we changed code to consistently use
convert_version_to_tuple() instead of the packaging
library, one place was missed since it used the
pkg_resources library. Change to use the same code
throughout the tree for version checks.

Also fixes a pylint warning as the pkg_resources API
usage generates a DeprecationWarning.

[0] https://review.opendev.org/c/openstack/neutron/+/890162

TrivialFix

Change-Id: I54e4e310b660acf3dd4cf07a50636512904b578c
@sebageek sebageek requested review from a team as code owners March 16, 2026 16:03
toanju
toanju previously approved these changes Mar 16, 2026
felix-kaestner
felix-kaestner previously approved these changes Mar 20, 2026
... because it was removed in Python 3.12 [1].

[1] https://docs.python.org/3/whatsnew/3.12.html#ensurepip

Note:
Selectable entry points were introduced in importlib_metadata 3.6 and
Python 3.10 .

Change-Id: I1b478a63ad1d73f9f3528939362797ea1fc68534
@sebageek sebageek dismissed stale reviews from felix-kaestner and toanju via 8da721f March 30, 2026 08:57
`virtualenv` 2.38 bumped setuptools, which does not contain
`pkg_resources` anymore. Since we're on an older release, our
dependencies still require `pkg_resources` to be present. Hence,
installing and running unit-tests fails.

We're pinning the virtualenv even though we already removed all
pkg_resources imports from Neutron as some of the test requirements (at
the moment flake8 for the pep8 check) still require pkg_resources to be
present.

Adopted from sapcc/nova[0].

[0] sapcc/nova@d58abc9
@sebageek sebageek changed the title Use convert_version_to_tuple() instead of pkg_resources Remove pkg_sources use from Neutron and still pin virtualenv Mar 30, 2026
@sebageek sebageek merged commit d430424 into stable/2024.1-m3 Mar 30, 2026
2 checks passed
@sebageek sebageek deleted the backport-pkg-resources-patch branch March 30, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants