aleph-im / aleph-sdk-python

Python SDK library for the Aleph.im network
MIT License
2 stars 4 forks source link

Fix: pkg_resources is obsolete to get package version #125

Closed hoh closed 1 month ago

hoh commented 1 month ago

Solution: Use importlib.metadata.version instead.

github-actions[bot] commented 1 month ago

The PR is labeled as 'BLUE' because it only includes small changes to the Python SDK library for the Aleph.im network. The changes are mainly related to importing modules and setting the version. These changes are unlikely to introduce bugs and do not require a deep understanding of the codebase. The diff shows a change in the import statement and the version setting, which are standard practices in Python projects.

diff  --git a/src/aleph/sdk/__init__.py b/src/aleph/sdk/__init__.py
index a3ecc693..2676ba05 100644
--- a/src/aleph/sdk/__init__.py
+++ b/src/aleph/sdk/__init__.py
@@ -1,17 +1,13 @@
-from pkg_resources import DistributionNotFound, get_distribution
+from importlib.metadata import version, PackageNotFoundError
 from aleph.sdk.client import AlephHttpClient, AuthenticatedAlephHttpClient

 try:
     __version__ = version("aleph-sdk-python")
@@ -8,6 +4,6 @@ from aleph.sdk.client import AlephHttpClient, AuthenticatedAlephHttpClient

 __all__ = ["__version__", "AlephHttpClient", "AuthenticatedAlephHttpClient"]

-__all__ = ["AlephHttpClient",  "AuthenticatedAlephHttpClient"]

 def __getattr__(name):

This PR is simple and unlikely to introduce bugs, but it's important to keep an eye on the codebase for potential issues.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.17%. Comparing base (02490d1) to head (f62d04b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #125 +/- ## ======================================= Coverage 84.17% 84.17% ======================================= Files 27 27 Lines 1131 1131 Branches 188 188 ======================================= Hits 952 952 Misses 176 176 Partials 3 3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.