-
Notifications
You must be signed in to change notification settings - Fork 46
Add support for activate/deactivate scripts #85
base: develop
Are you sure you want to change the base?
Conversation
Scripts listed under 'activate' and 'deactivate' contexts in environment.yml will be linked into $PREFIX/etc/conda/(de)?activate.d, where they will be executed by 'source (de)?activate'
👍 This is independent of the activate/deactivate scripts that are install per-package correct? |
Yes, unless you try to install a script with the same name as one obtained Note that this problem already exists if two packages have files with the
|
Oops, I actually rename files to 0.sh, 1.sh etc.. So there would only be an issue if a package contains a file with those names. |
#66 is vaguely relevant to this and stalled by my lack of windows knowledge. I am not sure renaming is a good idea (even prefixing with integers) as it can clobber user specified order (sans some special casing in the ordering). |
Makes sense. I used numbers to make sure that they will be executed in the order they are described in How are you sorting scripts in your pull request? Alphabetically? Modification date? |
alphabetically. I think they are currently coming back in random order, On Wed, Jun 3, 2015 at 11:15 AM Diogo Campos notifications@github.com
|
Alphabetically would work perfectly with my changes, there shouldn't be any conflict. I commented in #66 , it looks like Windows is already sorting alphabetically (but it only lists files at the current dir, no recursion as we have in unix!). Also, your PR is still valid, |
This one gives me pause. I like the idea, but something we have to consider here is the complexity that it adds. To this point, an environment spec is nothing more than one file. If we add this, it's 1+n file(s). To add this in its current state, we would need add error handling to Another option that keeps this as a single file is to allow inlining of these activation scripts. Something like this: - activate:
- posix: |
#!/bin/bash
echo "I'm in a *nix system"
- win: |
echo "This is a bat file in Windows" Thoughts? |
IMO, a few points to consider:
I like the idea of having everything in a single file, but writing bash/bat scripts as text in a |
I'm not sold on the need of one file, I just realize that it is a change we need to think about. For example, @malev just added the ability to upload and download an environment to Anaconda Server. With this change, now we have to adjust that to make sure that correct files are being sent to the correct places. To address a couple of points:
This is true to the user, but not us as maintainers of the package. We have to be able to manage the complexity on our end as well and while it seems rather straight forward, there are moving parts (like dealing with "remote" packages that have been uploaded) that makes moving from a single file to a single file plus N other files unappealing.
These are not quite the same. An That's not to say that there's a place for this. I think there is, I think we just need to figure out the best way to tackle the problem. To bring the conversation back to the main goal: the script you used as an example I assume is setting environment variables. Is that correct? If so, what about adding a section that specifies the variables. Something like: - env:
- ORACLE_HOME: "{CONDA_ENV_PATH}/opt/oracle" Then instead of copying files over this would create a |
Yes, I'm implementing another pull request right now that does just that (side note, I also had to add name: app
dependencies:
- cogapp==2.4
- colorama==0.3.3
environment:
ORACLE_HOME: "$CONDA_ENV_PATH/opt/oracle"
PYTHONPATH:
- {{ root }}/source/python For me, it will make the That being said, having full control of a bash/bat script is more flexible than just setting environment variables, so I thought that the scripts could still be useful. I had not considered recent changes in Would you like to wait until I finish and open the other pull request? We can continue this discussion/abort this pull request if the other one is better. |
That sounds like a solid plan. Thanks for tackling this @campos-ddc. |
Just opened #88 , take a look there. |
I think there is a case for allowing full scripts. I have a compelling use-case where I would like to have an environment starts several server processes to build a test stand environment (but just setting the ENVs is also great!). |
I had a look at I thought that @malev , what use case did you have when implementing this? |
@campos-ddc not every conda user has a repository. Many conda users are focused on jupyter notebooks. The idea behind |
@malev These changes would be very useful, is there something else you need in order to merge, besides resolving the conflicts? |
Is this going to be merged? |
Scripts listed under 'activate' and 'deactivate' contexts in environment.yml will be linked into $PREFIX/etc/conda/(de)?activate.d, where they will be executed by 'source (de)?activate'
Relates to #83
Example: