conda-pack
conda-pack copied to clipboard
Wrapper without the need to activate environment
Sometimes I find myself wanting to package a binary or a Python script that works in a certain conda environment for users that I don't want to bother with opening a shell and activating the environment. Instead it's nice to just give them a zip file containing a click-here.bat/sh
that takes care of that.
I couldn't find anything in the documentation related to that use case. If you think it would be a good addition, I'd try to add a section about this.
For example, we just packaged a simple python script that converts files it's given on the command line. If I add the following convert.bat
to my conda pack zip file, users can just unzip the archive and create a lnk to convert.bat
in their SendTo
in Windows to be able to run that converter from the context menu in Explorer.
REM go to the root directory of the conda pack zip file
pushd "%~dp0"
call Scripts\activate
REM https://serverfault.com/questions/22443/do-windows-batch-files-have-a-construction
set args=%1
shift
:start
if [%1] == [] goto done
set args=%args% %1
shift
goto start
:done
python converter.py %args%
cc @DunklesArchipel
That's a really interesting concept. How would you propose to include it in conda-pack? Keep in mind it would really have to be a pretty generic offering. And even then, it might be better suited for some sort of wrapper around conda-pack.
@mcg1969 thanks for having a look at this. I agree that it will be difficult to produce anything that is very generic here. Instead I am proposing to just add a section to the documentation that exemplifies some tricks like this one.
That would be fantastic!
@saraedum I just wanted to ping you here. I'm welcome to accept a documentation PR for this.
Hi there, thank you for your contribution!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.
If you would like this issue to remain open please:
- Verify that you can still reproduce the issue at hand
- Comment that the issue is still reproducible and include: - What OS and version you reproduced the issue on - What steps you followed to reproduce the issue
NOTE: If this issue was closed prematurely, please leave a comment.
Thanks!
The Linux bit has been added to the documentation. Not sure if there's any interest in writing the Windows part.