Skip to content

Commit f8f81db

Browse files
committed
Use importlib.metadata directly in python3.8+
1 parent b3582df commit f8f81db

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
displayName: install swift
3737
- template: job--python-tox.yml@asottile
3838
parameters:
39-
toxenvs: [pypy, pypy3, py27, py36, py37]
39+
toxenvs: [pypy, pypy3, py27, py36, py37, py38]
4040
os: linux
4141
pre_test:
4242
- task: UseRubyVersion@0

pre_commit/constants.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
from __future__ import absolute_import
22
from __future__ import unicode_literals
33

4-
import importlib_metadata # TODO: importlib.metadata py38?
4+
import sys
5+
6+
if sys.version_info < (3, 8): # pragma: no cover (<PY38)
7+
import importlib_metadata
8+
else: # pragma: no cover (PY38+)
9+
import importlib.metadata as importlib_metadata
510

611
CONFIG_FILE = '.pre-commit-config.yaml'
712
MANIFEST_FILE = '.pre-commit-hooks.yaml'

setup.cfg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ classifiers =
1414
Programming Language :: Python :: 2
1515
Programming Language :: Python :: 2.7
1616
Programming Language :: Python :: 3
17-
Programming Language :: Python :: 3.4
1817
Programming Language :: Python :: 3.5
1918
Programming Language :: Python :: 3.6
2019
Programming Language :: Python :: 3.7
20+
Programming Language :: Python :: 3.8
2121
Programming Language :: Python :: Implementation :: CPython
2222
Programming Language :: Python :: Implementation :: PyPy
2323

@@ -27,15 +27,15 @@ install_requires =
2727
aspy.yaml
2828
cfgv>=2.0.0
2929
identify>=1.0.0
30-
importlib-metadata
3130
nodeenv>=0.11.1
3231
pyyaml
3332
six
3433
toml
3534
virtualenv>=15.2
36-
futures; python_version<"3.2"
37-
importlib-resources; python_version<"3.7"
38-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
35+
futures;python_version<"3.2"
36+
importlib-metadata;python_version<"3.8"
37+
importlib-resources;python_version<"3.7"
38+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
3939

4040
[options.entry_points]
4141
console_scripts =

0 commit comments

Comments
 (0)