-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conda-wrappers recipe #1205
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
Could you please explain a bit about this post-link scripts? For instance, why did you chose post-link scripts as opposed to having something in the build? Also do we need some sort of pre-unlink scripts? Also it would probably be helpful to give issue ( conda-forge/conda-forge.github.io#173 ) a read-through. |
- python | ||
run: | ||
- python | ||
- exec-wrappers 1* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be 1.*
. Also why this particular pinning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be 1.*
Are you sure? On previous conda-build versions the dot had to be omitted, otherwise it never was able to match any version
Also why this particular pinning?
I intend to respect semantic version with exec-wrappers
so that new versions will be backward compatible. As this package depends on the first version, it does not really matter which one is exactly. It could be anything between >= 1.0.0 and < 2.0.0
. Maybe it is better to use this expression instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be 1.*
Are you sure, on previous conda-build version the dot had to be omitted, otherwise it never was able to match any version
Yep, works great. We do it with lots of things.
Also why this particular pinning?
I intend to respect semantic version with
exec-wrappers
so that new versions will be backward compatible. As this package depends on the first version, it does not really matter which one is exactly. It could be anything between>= 1.0.0 and < 2.0.0
❤️ That sounds amazing. I wish everyone did that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, works great. We do it with lots of things.
Good to know it is working, I prefer using the dot. But the semantic of 1*
and 1.*
is the same, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite 1*
could mean 10
or similar. This could cause for some strange surprises later. Hence we have preferred the .
.
If the .
is not always there, we do something like 1|1.*
.
Because the actual content depends on what is installed on the current environment. For example, when you do
Thanks for the reference. So according to what was discussed there and the new documentation I am misusing the post/pre link/unlink scripts. Any suggestion? By now I can only think of having a command that the user need to explicitly call. |
Ok, makes sense. How do you plan to keep track of which ones to remove and ensure they get removed?
Yeah, that is a pretty restrictive look at the link/unlink scripts. Don't think that discussion is really over. For instance, look at what is required to get the So I don't have any problems with using the link scripts the way you are. In fact, what you are doing seems pretty cool and very useful. You may be interested in It is true an explicit command(s) may work too (and may have some value for re-runs for example). However, if you still want that command called in the link scripts, that makes sense to me. Many people are hiding the complexity of their linking scripts by doing exactly that. Just would suggest using the |
Unfortunately I could not figure out a practical way to do that. What I could do is to remove all files when
Yeah, I checked
Ok then, I will keep using the link scripts, but encapsulate on separate command |
The https://github.com/Cadair/jupyter_environment_kernels/ has solved a similar problem but from the other side: the kernels are always executed in a activated environment (at least the env vars are there). So it is possible to fix this on the side of IDEs. Another idea would be to add such capabilities to conda itself: if a executable script/command is installed into an env, move that script to a different place and replace it with a wrapper which activates the env and calls the moved script/command. |
Sorry, I don't have any opinion or suggestion here. I recommend raising this as a conda issue on the conda issue tracker, so that it has higher visibility to @kalefranz |
Yes, it is possible, but I don't expect that every IDEs will properly integrate with conda some day. Even the only one I know that supports conda does not do it properly: https://youtrack.jetbrains.com/issue/PY-18865 Also just making IDEs activate the environment is too slow. You can see some numbers in https://github.com/gqmelo/exec-wrappers . So basically every IDE would come up with its own implementation.
Yes, that is what I really wanted. I created an issue for that, but it is on hold for now. That is why I decided to publish this on |
Just had a look at exec-wrapper. IMO the main benefit is that the needed codepath in I like that but it's only useable as long as you explicitly use it as a So IMO adding wrapper to the envs (which the user has to explicitly call) or using something like Unfortunately, in most cases (on windows), it wouldn't make a difference because e.g. in the environment kernel manager mentioned above, the jupyter notebook uses Popen with an implicit For that to work (and having it in PATH), the wrapper would have to be a natively compiled wrapper (+ moving the real command to a subdir and then calling from there?) but that is really bad because it would need to pull out the changes to the environment from the activate.d stuff which would then again be slow :-( |
Yeah, unfortunately that is true on Windows.
It can if you pass the .bat extension (or the full path as returned by the
I thought about generating compiled wrappers if necessary, but
I agree that at least this should be present on any env manager and apparently more people agree too. Imagine if
I don't think it would be too slow. Actually the wrappers created by |
I should have been more explicit: I imagine it is slow because it would have to generate a batch file which is then executed by a started cmd process (or do the activate.d logic in the wrapper and call a cmd for all activate.d files). |
Yes, it will be slower because of that, but I don't think it will matter that much. Anyway I will try to benchmark this |
So the performance discussion is interesting and am happy that this discussion is going on. However, IMHO this is not a blocker for packaging this. The reason I say this is performance is not a packaging concern, but a code optimization concern that would be best addressed at the repo for the code. The only thing I'd really like to see is a proper cleanup mechanism and then we can get this out there. Given we are in the business of package management here, this seems in scope IMHO. Generally, this tool is quite powerful and has a lot of advantages (especially if it is reasonably fast). The sooner we get it out there the better. To return to the clean up question, I'd like to note this comment.
This sounds totally sensible to me @gqmelo. Just brainstorming a bit here, what if there is a directory like |
@jakirkham, thanks for reviving this issue. I promised to play with native wrappers on But actually this would be a feature for
Yeah, at least for me it is being really useful. It is the less intrusive way I found to work with many environments on IDE's and debuggers.
I don't think this would help. Because this will be executed when the Anyway, I'll will try to properly cleanup the wrappers on |
eeaada0
to
be04f03
Compare
Done |
be04f03
to
63eb626
Compare
Good point. Had forgotten about this. At least now one can effect that change by uninstalling and reinstalling It likely requires some changes in Alternatively, instead of [un]installing the wrapper scripts, you could offer a subcommand format. Though I don't how practical/efficient that is. In any event, I'm hopeful that giving this more exposure by packaging it on conda-forge that the userbase will grow and draw more attention to this issue. |
Thanks again for putting this together, @gqmelo. |
Yeah, that is the main reason I wanted to package it on Thank you! |
conda-wrappers mainly aims to make it easy to use conda environments with IDE's, so that you don't need to start the IDE on an activated environment