Migrate pkg_resources usages to importlib.resources (#9748)

* Migrate pkg_resources API related to resources to importlib_resources

* Fix lint and mypy + pin lexicon

* Update filterwarnings

* Update oldest tests requirements

* Update pinned dependencies

* Fix for modern versions of python

* Fix assets load in nginx integration tests

* Fix a warning

* Isolate static generation from importlib.resource into a private function

---------

Co-authored-by: Adrien Ferrand <adrien.ferrand@amadeus.com>
This commit is contained in:
Adrien Ferrand
2023-09-07 11:38:44 -07:00
committed by GitHub
co-authored by Adrien Ferrand
parent b1978ff188
commit cc359dab46
29 changed files with 398 additions and 297 deletions
+2 -10
View File
@@ -1,19 +1,10 @@
import codecs
import os
import re
import sys
from pkg_resources import parse_version
from setuptools import __version__ as setuptools_version
from setuptools import find_packages
from setuptools import setup
min_setuptools_version='41.6.0'
# This conditional isn't necessary, but it provides better error messages to
# people who try to install this package with older versions of setuptools.
if parse_version(setuptools_version) < parse_version(min_setuptools_version):
raise RuntimeError(f'setuptools {min_setuptools_version}+ is required')
def read_file(filename, encoding='utf8'):
"""Read unicode from given file."""
with codecs.open(filename, encoding=encoding) as fd:
@@ -44,6 +35,7 @@ install_requires = [
'configobj>=5.0.6',
'cryptography>=3.2.1',
'distro>=1.0.1',
'importlib_resources>=1.3.1; python_version < "3.9"',
'josepy>=1.13.0',
'parsedatetime>=2.4',
'pyrfc3339',
@@ -51,7 +43,7 @@ install_requires = [
# This dependency needs to be added using environment markers to avoid its
# installation on Linux.
'pywin32>=300 ; sys_platform == "win32"',
f'setuptools>={min_setuptools_version}',
'setuptools>=41.6.0',
]
dev_extras = [