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

Replace pkg_resources with importlib.resources #37

Open
squeaky-pl opened this issue Oct 30, 2024 · 0 comments
Open

Replace pkg_resources with importlib.resources #37

squeaky-pl opened this issue Oct 30, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@squeaky-pl
Copy link

squeaky-pl commented Oct 30, 2024

limition lion uses pkg_resources here, we should use the new APIs from stdlib instead, as pkg_resources was deprecated.

From the pkg_resources docs:
setuptools.pypa.io/en/latest/pkg_resources.html

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

We should start using something like

importlib.resources.files(__name__).joinpath('throttle.lua').read_text()

instead of

pkg_resources.resource_string(__name__, 'throttle.lua').decode()

Current workarounds

As a workaround if you need to use limitlion on Python 3.12 you can add setuptools to your requirements. Otherwise limitlion already works on Python 3.12.

Follow ups

While at it we should also:

  • declare minimal version of supported Python to 3.9.
  • Add 3.11 and 3.12 to the test suite and remove 3.8
  • Update Trove classifiers in setup.py to reflect supported Python versions
  • Release new version
  • Update dependent projects
  • Remove setuptools depedency from requirements where appropriate, for example in sync-engine
@squeaky-pl squeaky-pl added the good first issue Good for newcomers label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant