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

Fix: pkg_resources is obsolete to get package version #125

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

hoh
Copy link
Member

@hoh hoh commented Jun 13, 2024

Solution: Use importlib.metadata.version instead.

Copy link

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.

@github-actions github-actions bot added the BLUE This PR is simple and straightforward. label Jun 13, 2024
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@           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           

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

Solution: Use `importlib.metadata.version` instead.
@hoh hoh force-pushed the hoh-upgrade-version-fetch branch from fb83626 to f62d04b Compare June 13, 2024 14:15
@hoh hoh merged commit f6d0b7b into main Jun 13, 2024
12 checks passed
@Psycojoker Psycojoker deleted the hoh-upgrade-version-fetch branch July 24, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLUE This PR is simple and straightforward.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant