conda-pack icon indicating copy to clipboard operation
conda-pack copied to clipboard

Wrapper without the need to activate environment

Open saraedum opened this issue 4 years ago • 7 comments

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%

saraedum avatar May 12 '20 19:05 saraedum

cc @DunklesArchipel

saraedum avatar May 12 '20 19:05 saraedum

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 avatar Jul 03 '20 17:07 mcg1969

@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.

saraedum avatar Jul 05 '20 07:07 saraedum

That would be fantastic!

mcg1969 avatar Jul 05 '20 14:07 mcg1969

@saraedum I just wanted to ping you here. I'm welcome to accept a documentation PR for this.

mcg1969 avatar Sep 20 '20 21:09 mcg1969

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:

  1. Verify that you can still reproduce the issue at hand
  2. 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!

github-actions[bot] avatar Mar 15 '22 04:03 github-actions[bot]

The Linux bit has been added to the documentation. Not sure if there's any interest in writing the Windows part.

saraedum avatar Mar 15 '22 04:03 saraedum