Skip to content

Commit 5b8c55e

Browse files
Merge pull request #92 from paxtonfitzpatrick/rev-1
account for just-installed packages using pkg_resources internally
2 parents 07f5e95 + e91516f commit 5b8c55e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

davos/core/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,13 @@ def smuggle(
10771077
# invalidate sys.meta_path module finder caches. Forces import
10781078
# machinery to notice newly installed module
10791079
importlib.invalidate_caches()
1080+
# if pkg_resources module has already been loaded, reload it in
1081+
# case the just-installed package uses it internally to populate
1082+
# its __version__ attribute from its metadata, Otherwise,
1083+
# pkg_resources's cached working set won't include the new
1084+
# package
1085+
if 'pkg_resources' in sys.modules:
1086+
importlib.reload(sys.modules['pkg_resources'])
10801087
# check whether the smuggled package and/or any
10811088
# installed/updated dependencies were already imported during
10821089
# the current runtime

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = davos
3-
version = 0.2.1
3+
version = 0.2.2
44
description = Install and manage Python packages at runtime using the "smuggle" statement.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)