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

Add Support for Python 3.12 #123

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions dune_client/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Utility methods for package."""

from datetime import datetime, timezone
import importlib
from typing import Optional

import pkg_resources

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


Expand All @@ -15,11 +14,12 @@ def postgres_date(date_str: str) -> datetime:

def get_package_version(package_name: str) -> Optional[str]:
"""
Returns the package version by `package_name`
Returns the package version by `package_name` using the importlib.metadata module
which is available in Python 3.8 and later.
"""
try:
return pkg_resources.get_distribution(package_name).version
except pkg_resources.DistributionNotFound:
return importlib.metadata.version(package_name)
except importlib.metadata.PackageNotFoundError:
return None


Expand Down
Loading