Package: pypakr-pkg
# pypakrPython containers for virtualenvThis Python project implements simple containers in the sense similar toDocker: you can generate an image file that contains complete informationneeded to create a virtual environment on any system that has pypakrinstalled. NOTE: don't confuse this with the other meaning of the termcontainer, which is "a holder object that stores a collection of otherobjects (its elements)." [http://www.cplusplus.com/reference/stl/]## IntroductionJust like Docker can run isolated environments, called containers,Python has virtualenv. This tool creates isolated Pythonenvironments. But it misses what Docker has, which is a way to have a filethat somehow defines the environment and that can be used to create avirtual environment on any machine that has Docker installed.In Docker, containers are created from "images" that specify their precisecontents (source: Wikipedia). We need something like that for Python.pypakr fulfills that need. It can take a description of which Pythonpackages need to be installed and use it to generate an image file thatdescribes what is installed in a virtual environment. Then it can take thatimage and generate a directory that contains a complete virtual environment.This can be done with Docker too. The advantage of pypakr is that the imagesare much smaller - they contain only Python files that can be overlaidon top of a generic virtual environment to produce a "container" that canrun a Python application or microservice. Containers are also smaller thana typical Docker container, because they only contain a virtualenv-styleenvironment.## Dependenciespypakr currently runs on Linux, and other than Python, it depends on thefollowing software:- virtualenv- vex, for running code in a virtual environment from a script- unionfs-fuse, for mounting UnionFS volumesInstall these tools like this:pip install virtualenvpip install vexOn Ubuntu, install unionfs-fuse like this:sudo apt-get install unionfs-fuse## Testingpypakr can be tested before installing by runningtoxor after installing by runningpytest## InstallationRunpip install pypakr## InitializationAfter you installed pypakr, run commandpypakr initIt will create configuration file .pypakr in your home directory andalso create a base virtual environment in directory$HOME/pypakr/BASEBy default, if .pypakr does not exist before you run pypakr init, itwill be created to look like this:```[Global]base = /home/george/pypakr/BASE```where /home/george stands for your home directory.However, if you don't like this default, create .pypakr and set value ofkey base to point to some other path. Then run pypakr init, and it willtry to create the base directory if it doesn't exist and then createa virtual environment in it.# HelpRun pypakr by itself on the command line to get help, orpypakr helpIt will give you text like this:```pypakrPython containersUsage:pypakr <command> <parameters>- Commands:- init              - initialize- create-image      - create image- Arguments:-s, --src <source-file>-i, --image <image-file>- create-container  - create container- Arguments:-i, --image <image-file>-c, --container <container-directory>- run               - run container (execute script in thecontainer's virtual environment)- Arguments:-c, --container <container-directory>-r, --script <script-to-execute>Configuration is in file ~/.pypakr[Global]base = /home/george/pypakr/BASE```See documentation in directory doc. As a quick reminder, here are the stepsto create a container:1. Create source file CUSTOM.tar.2. Create image file IMAGE.tar:pypakr create-image -s CUSTOM.tar -i IMAGE.tar3. Create container CONT:pypakr create-container -i IMAGE.tar -c CONT4. Run script run in the container CONT:pypakr run -c CONT -r ./run# TODOThis project is still young and there is so much more that can be done.Here are some ideas:- Port to Windows. unionfs is a Linux thing; a Windows version of pypakris possible, by generating a custom virtual environment and then extractingthe difference from the base virtual environment and tarring that to createan image.- A hub site like Docker Hub.- Serverless web application that uses pypakr containers as units offunctionality.# ContributionsAll comments, questions, issue reports, and pull requests are welcome!