Add a __version__ key to vp and n3fit#748
Conversation
|
You can set the current working directory in subprocess, from I think this is more or less the right approach. A few minor nitpicks:
|
|
Also repurposing double dunder names is frowned upon by the thought police. We should call the thing |
Only if you did something like |
|
I touched a bit the logic to deal with corner cases I could think of (some of the ones you mentioned). Still missing a satisfactory way to deal with the problem I mentioned before. One thing can be "if you install in development mode you don't have access to the tag, though luck" but the conda installation could be in a different hard drive from the repository which you don't have access to at run time. Ideally setuptools would change the version.py file on the fly only on install... |
|
I am confused as to what the issue is: either you install in develop mode
in which case you have access to git (because it just symlinks the files)
or you build and install with cmake, which you should use instead of
setup.py install to set various other paths correctly anyway. What is the
remaining case?
…On Wed, 29 Apr 2020, 10:18 Juacrumar, ***@***.***> wrote:
I touched a bit the logic to deal with corner cases I could think off
(some of the ones you mentioned).
Still missing a satisfactory way to deal with the problem I mentioned
before. One thing can be "if you install in development mode you don't have
access to the tag, though luck" but the conda installation could be in a
different hard drive from the repository which you don't have access to at
run time.
Ideally setuptools would change the version.py file on the fly only on
install...
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#748 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLJWUTJBSJO7UBNULUKPD3RO7PENANCNFSM4MTEVHGA>
.
|
|
I am in a cluster where the conda installation is in some remote disk which all nodes have access to (an amazon s3 bucket for instance). I develop, however, in the local disk of the login machine because otherwise files take a minute to save. Since this is my workflow I install the package with Note: one of the clusters I have access to in Milan work like this. I never use it anyway, but it is a case Note 2: Saying "ok, in that case you still can use cmake and you should" wouldn't count as "satisfactory" but I am ok with that. I prefer the setuptools on the fly modification better but meh. |
|
I guess this thing can do that, but the README is way too long for me: |
|
The trick is to instead of spend 10 minutes reading the readme to spend 4 hours trying and failing! |
the conda build it is working for me locally though
|
Apparently setuptools_scm does not work well with pip because of pip moving everything to some /tmp folder before installing. The easy solution is using |
This is my answer now to all corner I was thinking about before. |
|
Honestly I much must prefer a simple minded approach that I understand which we had at the beginning than the overenginerred dependincy that triggers problems now and who knows what in the future |
|
Well, the thing is that the problem is not weird, given that pip is moving things to a /tmp folder and then you lose access to git. But there is no "easy solution" I can think of for this. Anyway, I went back to the simple approach. Didn't want to reset and push in case someone wants to go back to |
|
Ideally we would have a valid identifier as per Instead of It is a bit more work though. There is also the corner case of being in a tagged commit, where A bunch of lower level commands include (which may or may not make things easier): |
|
In theory The only different between the good and the bad is the "+"? |
Cool! that is much better.
And the dot for the revision number :) |
Don't seem worth it... it's a pity |
|
I would say it is:Tools like to know the revision number, for example to decide which package to install. For example the conda packages used to be problematic when the revision number was a "build number" rather than part of the version, and I still have nightmares. |
|
Sigh This seems to work fine... |
|
Is there no way of having CMAKE doing this when the VP_DEV option is off? |
|
|
Right, I thought that was when you were not using cmake at all, but just pip install from the vp directory. I'd say this is a bit more of an issue, but not sure how easy a solution is. |
|
The problem is Something like
|
|
I like that. I have been trying to get the installation directory from setuptools and now I want to shout. |
|
This last commit does the trick. I am not sure whether it is necessary to write anything from the build scripts anymore, i.e., I am not sure whether to create the package you need it to have the modification in the source file. |
|
I think this is failing here nnpdf/conda-recipe/run_test.sh Line 15 in 76a8d36 because this is happening outside a git repository. One solution is to have the fallback thing you have in python. |
|
I'm happy with the last one, let's see whether travis is also happy |
|
If this is now done in cmake, we don't need it in the package scripts right? |
I thought so but then travis failed to find git. |
|
Argh. I see. I guess conda is not copying the .git folder. I am not sure how much I like having 4 separate mechanisms (conda package, python dev, cmake, conda build), but I also don't have better ideas or feel particularly motivated to think about them. |
|
Mm, the linux travis is understanding the repository as "dirty", not 100% sure why... maybe the cmake and the deployment tag need to be set differently... |
|
I wouldn't add git to the dependencies. That can do all sorts of bad things, and wouldn't solve much unless you also copy the .git folder. Now I prefer the previous idea of writing the tag both in cmake if possible and in the conda build script. |
Yeah, and it didn't solve the problem anyway (but only in mac for some reason!). Well it was a wild try. Reverting. |
|
I'm going to merge this and cross my fingers. If anything breaks I'll revert. If everything works I'll add next the gitstamp to the |
There are so many corner cases... but I guess we can consider burning down a string only upon deploy and call the git code otherwise.
I am missing a very important use case* I don't know how to go around:
I have my repository in one folder and run the code from a different folder. So I cannot just "git it". Rely on installing the files in development mode doesn't work either.
I can burn, from setuptools, the path to git...
Anyway, I'd love any ideas for the previous situation.
For the burning the version on the conda package I think what I did is ok (with a bit more logic to go around cases in which there is something written in the
__init__) as well as for when the code is ran inside the repo. Any comments?*it is very important because it is probably the standard case in clusters
Closes #275