How to deploy a simple python application on Linux for a collaborative, enterprise environment?

I wrote (obviously) a great tool in python (for Linux) that I would like to share with my colleagues. We work on different machines, but with the same overall environment. In addition, we are users, so there is no way to easily install dependencies.

Now here's the catch: I like python, my users don't care. They have access to the python installation for the whole company (simple), but they don’t want to care (well, this is understandable, not all programmers).

Question: In such a general environment where the python interpreter is available, but the modules for my application are not, what could be the easiest way to share my tool with other users?

As you can imagine, my users do not want to install anything (especially in the user space), setting the path is likely to be on the verge of adoption. The solution should not pack EVERYTHING, like freezing, possibly busting ...

For the user, this should be: copying a specific tar.gz or going to the application folder (shared), launching the application, done.

So maybe the modules should somehow be embedded in the application? Or should I place (in my common home) modules in the library and configure some paths? Or maybe virtualenv can help if users can copy the whole env using the path?

I hope you see my problem: D

Thanks!

+4
source share
4 answers

For the "same general environment" you can:

  • Install your-script in /your/shared/home/virtualenv

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

     $ ln -s /your/shared/home/virtualenv/bin/your-script /shared/app/folder/ 
  • Your employees can call 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 what the symbolic link points to. Older versions can be run as /your/shared/home/virtualenv-old-version/bin/your-script
  • you can use python extensions written in C
  • if you install in virtualenv via pip install -e . ; it provides a version from your working directory

In general, this is not the preferred option for installing Python applications.

+2
source

Assuming your standard installation is Python 2.6 or later, and you are not using any C extension modules, you can simply throw all this into a zipfile, include the __main__.py file, and then add the shell header to the zip file. That is why this script was added.

See http://bugs.python.org/issue1739468 for more information on setting this option.

+3
source

you can use pyinstaller to create standalone executables
see: http://www.pyinstaller.org/

+1
source

What is the nature of your application? Is it a simple “connect some values, get an answer”? Or is it more interactive / graphical? If first, your application may be packaged as a utility on UtilityMill . Then your users can simply access your application through a standard browser.

0
source

Source: https://habr.com/ru/post/1343419/


All Articles