Created
August 9, 2021 09:56
-
-
Save Paradoxis/1be5124ddfa01afb0b1b91754ef4b5b7 to your computer and use it in GitHub Desktop.
Checks if a package is installed using an installable flag '-e' without use of pip's internal API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_development_install(package: str) -> bool: | |
"""Check if we're running a development installation""" | |
import pkg_resources | |
file = Path(dirname(pkg_resources.__file__)).parent | |
file = file.joinpath(package.replace('_', '-') + '.egg-link') | |
return file.exists() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment