Skip to content

Workflow updates and fix for removed pkg_resources#123

Merged
rebkwok merged 4 commits intomainfrom
workflow-permissions
Mar 5, 2026
Merged

Workflow updates and fix for removed pkg_resources#123
rebkwok merged 4 commits intomainfrom
workflow-permissions

Conversation

@rebkwok
Copy link
Contributor

@rebkwok rebkwok commented Mar 4, 2026

This started as a simple thing to add workflow permissions, but tests failed because the latest setuptools has removed pkg_resources, so that's actually the bigger fix here.

setuptools v82.0.0 removed the deprecated pkg_resources. Our Dockerfile installs the most recent version of build tools, including setuptools, which broke the import tests, which used pkg_resources.

We can fix the tests to use importlib instead of pkg_resources. However, we still can't just install the latest setuptools, because various packages also depend on a version that still includes pkg_resources, so we pin it to <82.0.0.
(This is breaking things for lots of people)

The more boring part:

  • add permissions for workflows
  • remove the dependabot automerge - we've generally come to the conclusion that this is a bad idea and have removed it in other repos. There's at least one recent example of it merging a PR with a failing check

rebkwok added 2 commits March 4, 2026 16:05
Ensure workflows have the minimum required permissions and silence the security alerts
We've removed this in most other repos and generally concluded it's
a bad idea. It allows merging of PRs with broken builds, e.g.
#119
@rebkwok rebkwok force-pushed the workflow-permissions branch from 565d8f0 to 0e25477 Compare March 5, 2026 09:10
setuptools v82.0.0 removed the deprecated pkg_resources. Our
Dockerfile installs the most recent version of build tools, including
setuptools, which breaks tests.

We can fix the tests to use importlib instead of pkg_resources.
However, we still can't just install the latest setuptools, because
various packages also depend on a version that still includes
pkg_resources, so we pin it to <82.0.0.
@rebkwok rebkwok force-pushed the workflow-permissions branch from 0e25477 to efde8e5 Compare March 5, 2026 09:17
@rebkwok rebkwok changed the title Restrict workflow permissions and remove automerge Workflow updates and fix for removed pkg_resources Mar 5, 2026
@rebkwok
Copy link
Contributor Author

rebkwok commented Mar 5, 2026

The better fix may be to manage those dependencies outside of the Dockerfile, and possibly replace pip with uv, but I didn't want to tackle that as part of this PR

Copy link
Member

@bloodearnest bloodearnest left a comment

Choose a reason for hiding this comment

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

Thanks for chasing the setuptools issue down.

Dockerfile Outdated
# Pin setuptools to <82.0.0 (which removed pkg_resources, which some dependencies require)
# hadolint ignore=DL3013,DL3042
RUN --mount=type=cache,target=/root/.cache python -m pip install -U pip setuptools wheel pip-tools
RUN --mount=type=cache,target=/root/.cache python -m pip install -U pip wheel pip-tools "setuptools<82.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, yeah this was an oversight on my part, and bound to break at some point, since we freeze packages, and some of them will depend on old setuptools apis (as well as our tests also depending on them).

Do you think its worth pinning the rest too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe? We've had issues with pip versions elsewhere. I could pin everything to the current major version?

@rebkwok rebkwok merged commit e156430 into main Mar 5, 2026
6 checks passed
@rebkwok rebkwok deleted the workflow-permissions branch March 5, 2026 12:26
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.

2 participants