Skip to content

Commit

Permalink
Merge pull request #1200 from kit494way/csvsql-dialects
Browse files Browse the repository at this point in the history
Use importlib.metadata instead of pkg_resources in python 3.10 and above
  • Loading branch information
jpmckinney authored Jul 20, 2023
2 parents 05e9d1b + 53a4abc commit fa7d831
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.7
- os: windows-latest
python-version: pypy-3.7
python-version: [3.8, 3.9, '3.10', '3.11', pypy-3.9]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Unreleased
----------

* Drop Python 3.7 support (end-of-life was June 5, 2023).

1.1.1 - February 22, 2023
-------------------------

Expand Down
8 changes: 6 additions & 2 deletions csvkit/utilities/csvsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

import agate
import agatesql # noqa: F401
from pkg_resources import iter_entry_points
from sqlalchemy import create_engine, dialects

from csvkit.cli import CSVKitUtility, isatty

DIALECTS = dialects.__all__ + tuple(e.name for e in iter_entry_points('sqlalchemy.dialects'))
try:
import importlib_metadata
except ImportError:
import importlib.metadata as importlib_metadata

DIALECTS = dialects.__all__ + tuple(e.name for e in importlib_metadata.entry_points(group='sqlalchemy.dialects'))


class CSVSQL(CSVKitUtility):
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand Down Expand Up @@ -61,6 +60,9 @@
'agate-excel>=0.2.2',
'agate-dbf>=0.2.2',
'agate-sql>=0.5.3',
# “selectable” entry points were introduced in Python 3.10.
# https://docs.python.org/3/library/importlib.metadata.html
'importlib_metadata; python_version < "3.10"',
],
extras_require={
'test': [
Expand Down

0 comments on commit fa7d831

Please sign in to comment.