How to determine if a package has been installed using development or installation commands

I am developing a Python package. Sometimes I want to use the latest development version, sometimes I want to use the release version. I am very lazy so want me to call to tell me if this is a development version or a version.

So, once the python package is installed, is there a way to determine if it has been installed using

python setup.py develop

      

or

python setup.py install --user

      

As an argument, let's say the package only has a console entry point. I could verify that the package is under $HOME

like this:

if os.environ['HOME'] in os.path.dirname(os.path.realpath(__file__)):
        print("⚠  You might be using the development version")

      

This works fine if the install command was there python setup.py install

, but not when it was installed locally.

+3


source to share





All Articles