Skip to content

Commit 18501bd

Browse files
committed
Circumvent setuptools bug
1 parent ce052aa commit 18501bd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

scanpy/_metadata.py

+18
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,31 @@
33

44
here = Path(__file__).parent
55

6+
7+
def refresh_entry_points():
8+
"""\
9+
Under some circumstances, (e.g. when installing a PEP 517 package via pip),
10+
pkg_resources.working_set.entries is stale. This tries to fix that.
11+
"""
12+
try:
13+
import sys
14+
import pkg_resources
15+
16+
ws: pkg_resources.WorkingSet = pkg_resources.working_set
17+
for entry in sys.path:
18+
ws.add_entry(entry)
19+
except Exception:
20+
pass
21+
22+
623
try:
724
from setuptools_scm import get_version
825
import pytoml
926

1027
proj = pytoml.loads((here.parent / 'pyproject.toml').read_text())
1128
metadata = proj['tool']['flit']['metadata']
1229

30+
refresh_entry_points()
1331
__version__ = get_version(root='..', relative_to=__file__)
1432
__author__ = metadata['author']
1533
__email__ = metadata['author-email']

0 commit comments

Comments
 (0)