Skip to content

Replace pkg_resources usage#2706

Draft
Mirochill wants to merge 2 commits into
certtools:developfrom
Mirochill:fix-2569-drop-pkg-resources
Draft

Replace pkg_resources usage#2706
Mirochill wants to merge 2 commits into
certtools:developfrom
Mirochill:fix-2569-drop-pkg-resources

Conversation

@Mirochill

@Mirochill Mirochill commented May 22, 2026

Copy link
Copy Markdown

Summary

  • replace pkg_resources resource and distribution lookups with importlib.resources and importlib.metadata helpers
  • use packaging.version.parse for the existing shodan and url-normalize version checks
  • remove the temporary setuptools pinning step from the unit-test workflow

Fixes #2569

Validation

  • git diff --check HEAD~1..HEAD
  • rg -n 'pkg_resources|resource_filename|get_distribution|setuptools<82|setuptools<81' intelmq .github setup.py setup.cfg (no matches)
  • Initial remote GitHub Actions run after maintainer approval: documentation, ansible, codespell, regular expression check, ReUse, Debian packages, and CodeQL passed; pycodestyle and full unit tests failed
  • Follow-up commit 02cb7cb55 addresses the reported pycodestyle continuation indent and the intelmqctl tests affected by mocked importlib.import_module; the new workflow runs are waiting for maintainer approval

Use importlib.resources for bundled configuration and test data paths and importlib.metadata for installed package versions. This removes the runtime dependency on pkg_resources while keeping the existing package data lookup flow centralized in intelmq.lib.utils.

The Shodan and url-normalize version checks now use packaging.version.parse instead of tuple splitting, which preserves the existing comparisons and handles normal Python package versions more safely. The temporary CI step that installs old setuptools for certtools#2569 is no longer needed.
@sebix

sebix commented May 23, 2026

Copy link
Copy Markdown
Member

Thanks for working on this!

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.

Module pkg_resources is deprecated

2 participants