Open ifiddes opened 3 years ago
Hi Ian,
Sorry for the late reply.
I tried applying this patch to _version.py
.
After doing so in a fresh repo with no tags, pip install .
and also pip install -e .
both error out (which is what we want).
When I add a tag both commands work fine again.
In the case where you are doing pip install ., the first thing pip does is copy the repo to a temporary folder
I took a closer look at the output of pip install .
and it seems that it first builds a wheel:
The wheel will already have the version info embedded in it.
Let me know if that patch works for you; if so we could have this be an option when installing miniver.
I just realized that applying that patch will mean that import mypackage
will also fail, which is probably not what you want when developing :smile:.
An alternative could be to just have the _build_py
and/or _sdist
functions error out when the version contains unknown
. This would not make pip install -e .
error out, unfortunately, but it might be possible to hook into setuptools' develop
(which is what pip install -e .
runs) to fix this.
I am trying to modify miniver to not allow installations that do not properly resolve to a known version by raising an exception. I therefore modified all the places where
unknown
was returned with a new exception. This works fine forpip install -e .
, but not forpip install .
This made me dig deeper, and I am not sure I understand how this is ever possible -- in the case where you are doing
pip install .
, the first thing pip does is copy the repo to a temporary folder, without the hidden folders, which means the.git
folder is no longer present.I am obviously missing something important here, but how can it be possible for miniver to successfully get the git version during such an install? Do I always have to install with
pip install -e .
if I am trying to do a local install from a repo?