Description
Hey,
Not sure if this is the right place and/or right package to ask, but you need to start somewhere 😄 .
I have the following case: A script in a distributable should behave differently if it's started by the distributable or by anther project just importing the distributable.
For instance, the distributable has the name foo
.
If I developing foo
currently and I execute foo.py
it should return 1. If another project depends on foo
and executes foo.py
after installing foo
over pip it should return 2.
Since there seems to be no reliable way, for now I use the assumption that current project means editable install. With that I can use
distribution = pkg_resources.get_distribution("foo")
is_foo= "dist-info" not in distribution.egg_info
So if foo
is installed editable, the egg_info has no dist-info. But that's very hacky.
Therefore, how can I improve this?
- do you have anything in mind which would solve the below issue in the first place
- if not, do you think you can expose the
direct_url.json
of PEP 660 somehow? It would help to detect if it's an editable install w/o finding/parsing the file on my own