Skip to content

Commit

Permalink
adjust for python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Apr 21, 2024
1 parent 604d505 commit fe4cc78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
8 changes: 6 additions & 2 deletions dune_client/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from datetime import datetime, timezone
from typing import Optional

import pkg_resources

DUNE_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"


Expand All @@ -18,7 +16,13 @@ def get_package_version(package_name: str) -> Optional[str]:
Returns the package version by `package_name`
"""
try:
# pylint: disable=import-outside-toplevel
import pkg_resources

return pkg_resources.get_distribution(package_name).version
except ModuleNotFoundError:
# Python 3.12 does not have pkg_resources!
return None
except pkg_resources.DistributionNotFound:
return None

Expand Down

0 comments on commit fe4cc78

Please sign in to comment.