{"id":13501234,"url":"https://github.com/zueve/zenv","last_synced_at":"2025-03-29T08:32:14.537Z","repository":{"id":44860986,"uuid":"163943278","full_name":"zueve/zenv","owner":"zueve","description":"Zenv: Zen Environment - docker based virtual environments ","archived":false,"fork":false,"pushed_at":"2022-12-09T07:44:23.000Z","size":90,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T21:45:52.213Z","etag":null,"topics":["cli","docker","virtual-environments"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zueve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-03T08:17:14.000Z","updated_at":"2023-10-25T11:42:29.000Z","dependencies_parsed_at":"2023-01-25T19:31:06.107Z","dependency_job_id":null,"html_url":"https://github.com/zueve/zenv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zueve%2Fzenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zueve%2Fzenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zueve%2Fzenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zueve%2Fzenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zueve","download_url":"https://codeload.github.com/zueve/zenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246162092,"owners_count":20733351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","docker","virtual-environments"],"created_at":"2024-07-31T22:01:30.046Z","updated_at":"2025-03-29T08:32:14.177Z","avatar_url":"https://github.com/zueve.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Zenv\n====\n\nZenv is container based virtual environments.\nThe main goal of Zenv is to simplify access to applications inside container, making it seamless in use like native (host-machine) applications\n\n## Usage\n```shell\n\u003e zenv init\nZenv created!\n\n\u003e # run `ls` command inside contaner\n\u003e ze ls\n```\n\n## Motivation\n\nAs a developer, when set up a project locally, I usually need to install additional applications on the system. Of course, modern package managers such as poetry, pipenv, npm, cargo, ext, perfectly solve for us most of the problems with dependencies within a single stack of technologies. But they do not allow to solve the problem with the installation of system libraries. If you have a lot of projects that require different versions of system libraries, then you have problems\n\nIn production, this problem has long been solved by container insulation, and as a rule, it is a `Docker`. Therefore, many of my colleagues use docker-images and docker-compose, not only to run  services in a production environment but also to develop and debug programs on a local machine\n\nUnfortunately, there are several problems along the way:\n\n- Some of your familiar utilities  may not be preinstalled in the container\n- If you try to install packages in the process, you will encounter the lack of necessary rights\n- Forget about debugging with `print`\n- The main thing is lost the usual experience, you can not use your favorite customized shell\n\nOf course, the problems described above are solved by creating a docker image specifically for developing a specific project, `zenv` just helps to create such containers very simply\n\n## Features\n\n- Simplify: all interaction with the container occurs with one short command: `ze`\n- Zenv automatically forwarded current directory to the container with the same PWD\n- Zenv automatically forwarded current UserID, GroupID to container\n\n  Therefore, files created in the container have the same rights as those created in the native console and you can also use `sudo` to get privileges\n  ```shell\n  \u003e sudo ze \u003ccommand\u003e\n  ```\n  or\n\n  ```shell\n  \u003e sudo !!\n  ```\n\n- Zenv can forwarded environment vars as is native\n    ```shell\n    \u003e MYVAR=LIVE!!!! ze env\n    ```\n- And of course your could combinate native and containerized commands in Unix pipes\n  ```shell\n  \u003e ze ls | head -7 | ze tail -5\n  ```\n- Minimal performance impact\n- Customization: you can additionally control container parameters using Zenvfile\n\n\n## Install\n  1. Make sure you have the latest version of `Docker` installed\n  2. For linux, make sure you have your user’s [rights are allowed](https://docs.docker.com/install/linux/linux-postinstall/) to interact with doker\n  3. Make sure that you have python version 3.6 or higher\n  4. Execute:\n      ```shell\n      \u003e sudo pip install zenv-cli\n      # or\n      \u003e sudo pip3 install zenv-cli\n      ```\n\n## How It works\nBy nature, zenv is a small automated layer over the official docker CLI\n\n### init\n\nCommand `zenv init` create `Zenvfile` in current directory. This file describes the relationship with the docker image and container that will be created to execute isolated commands.\n\nBy default, used image is `ubuntu: latest`.\nBut you can change it by setting `-i` flag. For example:\n```shell\n\u003e zenv init -i python:latest\n```\nOr edit `Zenvfile` manually\n\n\n### Execute\n\nCommand `zenv exec \u003cCOMMAND\u003e` or it shot alias `ze \u003cCOMMAND\u003e` run `\u003cCOMMAND\u003e` in a container environment. When running the command:\n- Zenv checks current container status (running, stopped, removed), and up container if need.\n- The container run with the command `sleep infinity`. Therefore it will be easily accessible\n- UID and GID that ran the command are pushed into the container. Therefor your could use `sudo ze \u003cCOMMAND\u003e`\n- When executing the command, the directory from the path where Zenvfile is located is forwarded to the container as is a current PWD. Therefor your could run `ze` from deep into directories relative to Zenvfile\n- Environment variables are also thrown into the container as a native.\n  ```\n  \u003e MYVAR=SUPER ze env\n  ```\n To avoid conflicts between host and container variables, all installed system variables are placed    in the blacklist when Zenvfile is created, from which editing can be removed\n\n### Other commands\n\n```shell\n\u003e zenv --help\nUsage: zenv [OPTIONS] COMMAND [ARGS]...\n\n  ZENV(Zen-env): Containers manager for developer environment\n\n  Usage:\n\n  \u003e zenv init -i centos:latest \u0026 ze cat /etc/redhat-release\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  exec      Call some command inside the container\n  info      Show current container info\n  init      Initialize Environment: create Zenvfile\n  rm        Remove container (will stop the container, if need)\n  stop      Stop container\n  stop-all  Stop all zenv containers\n```\n\n## Example install jupyter notebook\n```shell\n\u003e mkgir notebooks\n\u003e cd notebooks\n\u003e zenv init -i python:3.7.3\n```\nAfter edit Zenvfile to explode notebook ports. Update `ports = []` to `ports = [\"8888:8888\"]`\n\n```\n\u003e sudo ze pip install jupyter numpy scipy matplotlib\n```\nRun notebook\n```\n\u003e ze jupyter notebook --ip 0.0.0.0\n```\nlaunch your browser with url: http://localhost:8888\n\nAlso you could add this commands to Zenvfile:\n```toml\n[run]\ninit_commands = [\n  [ \"__create_user__\"],\n  [\"pip\", \"install\", \"jupyter\", \"numpy\", \"scipy\", \"matplotlib\"]\n]\n\n[commands]\nnotebook = [\"jupyter\", \"notebook\", \"--ip\", \"0.0.0.0\"]\n```\n\nAnd launch notebook with command\n\n```\n\u003e ze notebook\n```\n\n## Zenvfile\n```toml\n[main]\nimage = \"ubuntu:latest\"\nname = \"zenv-project\"    # container name\ndebug = false            # for show docker commands\n\n[run]\ncommand = [ \"__sleep__\",]\ninit_commands = [ [ \"__create_user__\",],]\n\n[exec]\nenv_file = \"\"\nenv_excludes = [ \"TMPDIR\",]\n\n[run.options]\nvolume = [ \"{zenvfilepath}:{zenvfilepath}:rw\",]\ndetach = \"true\"\npublish = []\n\n[commands]\n__sleep__ = [ \"sleep\", \"365d\",]\n__create_user__ = [ \"useradd\", \"-m\", \"-r\", \"-u\", \"{uid}\", \"-g\", \"{gid}\", \"zenv\",]\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzueve%2Fzenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzueve%2Fzenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzueve%2Fzenv/lists"}