5

I have written an (obviously) excellent tool in python (under linux) that I would like to share with my co-workers. We work on different machines, but with the same, shared environment. Also, we are users, so there is no way of easily installing dependencies.

Now here's the catch: I like python, my users don't care. They do have access to company-wide installation of python (a simple one), but they don't want to care (well, that's understandable, not everyone is a programmer).

The question is: In such shared environment, where python interpreter is available, but the modules to my application are not, what could be the simplest way of sharing my tool with other users?

As you may imagine, my users don't want to install anything (especially in the user-space), configuring path would be probably on the edge of acceptance. The solution should not package EVERYTHING like a freeze, that's probably an overkill...

For the user it should be: copying a certain tar.gz or going to the app folder (shared), running the app, done.

So maybe the modules should somehow be embedded in the app? Or should I host (in my shared home) the modules in a library and setup some paths? Or maybe a virtualenv could help, if the users could copy the whole env with the path?

I hope you see my problem :D

Thanks!

8
  • 1
    What does shared environment mean in this context? Commented Mar 12, 2011 at 7:49
  • Is setuptools or Distribute installed? Commented Mar 12, 2011 at 9:54
  • No, neither setuptools nor distribute is installed... Commented Mar 12, 2011 at 10:39
  • Shared environment means that users work on the same infrastructure, have (network-based) project directories with unix perimissions, etc. However, every user has a separate 'user' environment as in standard unix, therefore has to setup it to by oneself. What it means here is that users can use system-wide python, but would need to do extra work to configure it to their needs. Commented Mar 12, 2011 at 10:41
  • @ronszon: "users work on the same infrastructure". Why can't you update this common infrastructure? That's why it's common. What's stopping you from simply updating the common stuff? Commented Mar 12, 2011 at 13:07

4 Answers 4

3

For "the same, shared environment" you could do:

  1. Install your-script to /your/shared/home/virtualenv

    $ pip install your-app.tar.gz -E /your/shared/home/virtualenv
    
  2. Make a link:

    $ ln -s /your/shared/home/virtualenv/bin/your-script /shared/app/folder/
    
  3. Your co-workers can invoke the script as /shared/app/folder/your-script or add /shared/app/folder/ to PATH.

Features:

  • you choose which version of your script is available by controlling where the symlink points to. Old versions could be run as /your/shared/home/virtualenv-old-version/bin/your-script
  • you could use Python extensions written in C
  • if you install into the virtualenv via pip install -e .; it makes available the version from your working directory

In general it is not a preferable option to install Python apps.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, this could be it! I was thinking there should be a virtualenv way, but could not really put it down into code (still to fresh in python). I'll give it a try after the weekend. Indeed, this way I can keep the code alive, compared to the frozen alternatives...
Did what you proposed, works like magic. Indeed, I did not imagine the strength of virtualenv. Thanks
3

Assuming your standard installs are Python 2.6 or later and you don't use any C extension modules, you can just throw it all in a zipfile, include a __main__.py file and then prepend a shell header to the zipfile. Your scenario is precisely why this feature was added.

See http://bugs.python.org/issue1739468 for more details on how to set that up.

Comments

1

you can use pyinstaller to create a stand-alone executables
see:http://www.pyinstaller.org/

1 Comment

Well, this will of course work, but it is the type of overkill deployment I would like to avoid. Because the environment is 'shared' (python interpreter is available for everybody) I don't see the need of embedding it again in the package...
0

What is the nature of your application? Is it a simple "plug in some values, get an answer" kind of thing? Or is it more interactive/graphical? If the former, your app could be packaged up as a utility on UtilityMill. Then your users could just access your app thru a standard browser.

1 Comment

This would be very very cool (I was already thinking of making a web interface to my app, that's definitely easiest to use), but am I correct this works on their server? Then this is a no-go, it must work on the intranet... Also the app is simple, basically takes excel file as an input, parses and creates other language scripts based on that. But this means a possibility of uploading an excel file...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.