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

chore: remove use of pkg_resources for newer python versions #157

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

jackwotherspoon
Copy link
Contributor

pkg_resources is vastly seen as deprecated and in the latest Python version it has been removed entirely from being pre-installed as part of Python python/cpython#95299

This results in the following error with Python 3.12 when using pytds:

.nox\system-3-12\Lib\site-packages\pytds\__init__.py:69: in <module>
    import pkg_resources  # type: ignore # fix later
E   ModuleNotFoundError: No module named 'pkg_resources'

To fix this we can leverage importlib.metadata as a replacement for pkg_resources.get_distribution().version

@jackwotherspoon
Copy link
Contributor Author

@denisenkom let me know if you think this change is acceptable 😄

@jackwotherspoon
Copy link
Contributor Author

Could also use a version.py instead and read from it as an option

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ccd0fca) 89.21% compared to head (d5dbce0) 89.19%.

Files Patch % Lines
src/pytds/utils.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #157      +/-   ##
==========================================
- Coverage   89.21%   89.19%   -0.02%     
==========================================
  Files          44       44              
  Lines        8076     8083       +7     
==========================================
+ Hits         7205     7210       +5     
- Misses        871      873       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@denisenkom
Copy link
Owner

Yeah, I think this is good. I am thinking in future to simplify it more. The idea is to inject a version as part of a build process, so that during runtime it would be just a constant.

@denisenkom denisenkom merged commit e53cca8 into denisenkom:master Dec 18, 2023
@jackwotherspoon
Copy link
Contributor Author

Thanks @denisenkom! Just curious when the next release is scheduled be cut so that this change takes effect? 🚀

@denisenkom
Copy link
Owner

Some time in January 2024

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