Skip to content

Commit

Permalink
Delay import of pkg_resources until needed (if ever). (#195)
Browse files Browse the repository at this point in the history
pkg_resources can be very slow to import.

Alternatively, one could use importlib.resources on Py3.7+, but
then one needs to add version-conditional code for Py3.6 (or a
version-conditional dependency on importlib_resources).
  • Loading branch information
anntzer authored and dhermes committed Jan 27, 2020
1 parent 656eead commit f9fb7be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/python/bezier/__config__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import os

import pkg_resources


# Error messages for ``handle_import_error``.
TEMPLATE = "No module named 'bezier.{}'" # 3.6, 3.7, 3.8, pypy3
Expand Down Expand Up @@ -58,6 +56,8 @@ def modify_path():
if os.name != "nt":
return

import pkg_resources # pylint: disable=import-outside-toplevel

try:
extra_dll_dir = pkg_resources.resource_filename("bezier", "extra-dll")
except ImportError:
Expand Down

0 comments on commit f9fb7be

Please sign in to comment.