{"id":27019087,"url":"https://github.com/jabbalaci/virtualenv-tools","last_synced_at":"2026-04-18T00:02:17.332Z","repository":{"id":140437901,"uuid":"49125829","full_name":"jabbalaci/virtualenv-tools","owner":"jabbalaci","description":"Some simple wrapper functions for working with Python virtual environments.","archived":false,"fork":false,"pushed_at":"2018-06-29T07:28:09.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-12T01:37:00.899Z","etag":null,"topics":["bash","python","virtualenv"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/jabbalaci.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-01-06T09:25:49.000Z","updated_at":"2024-02-14T04:46:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfad41b6-51c0-4d09-b7ec-1663f301c27c","html_url":"https://github.com/jabbalaci/virtualenv-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jabbalaci/virtualenv-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fvirtualenv-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fvirtualenv-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fvirtualenv-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fvirtualenv-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabbalaci","download_url":"https://codeload.github.com/jabbalaci/virtualenv-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fvirtualenv-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31950891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bash","python","virtualenv"],"created_at":"2025-04-04T17:19:02.547Z","updated_at":"2026-04-18T00:02:17.327Z","avatar_url":"https://github.com/jabbalaci.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Virtualenv Tools for Bash\n=========================\n\nIntroduction\n------------\nThis shell script contains some useful functions to work with\nPython virtual environments. It can be considered as a minimalistic\n[virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/)\nalternative. I've used virtualenvwrapper for years but I\nonly needed just a fraction of its features. So I decided\nto write my own wrapper functions for the plain old\n[virtualenv](https://virtualenv.readthedocs.org/en/latest/) command.\n\nThis project was inspired by\n\u003chttps://github.com/jaapz/virtualenv-tools\u003e. jaapz's work gave me the\nidea to write my own wrapper functions.\n\nUsage\n-----\nThis shell script is specific for Bash. First, add the following line\nto the end of your `~/.bashrc` file:\n\n    source /path/to/this/virtualenv.sh\n\nI like to separate a project (with my source code) and its virtual\nenvironment (which contains the Python interpreter and the installed\npackages). By default, virtualenvs are created in the folder\n`~/.virtualenvs`. To change it, just edit the variable `WORKON_HOME`\nat the top of `virtualenv.sh`.\n\nInitialize a project folder:\n\n    venv_init\n\nProvide the Python version (2 or 3) interactively and you get a\nfile called `python_version.txt` whose content is either\n\"python2\" or \"python3\". I think it's a good idea to store this\ninformation in a file because if you work with Python 2 and\nPython 3 projects too, this file will tell you immediately\nwhat Python version the project was written in. This command also\ncreates a script called `update_requirements.sh` that prints the\ninstalled packages with their versions to the standard output.\nThis command calls `venv_make` automatically,\nso the virtual environment is also created for you. An empty\n`requirements.txt` file is also created.\n\nThis command adds 2 extra files to your project. One of\nthem is called `alap.py`, which is a basic skeleton file. The other\nfile is called `caller.sh`, which launches `alap.py` by default.\nYou can call `caller.sh` from any directory, and you don't even\nneed to activate the virt. env. of the project. `caller.sh` will take\ncare all of that for you.\n\nIf you have an initialized folder (that has `python_version.txt`)\nin it but the virt. env. is missing, then run this command:\n\n    venv_make\n\nUsing the files `python_version.txt` and `cd_venv_dir.sh` (both created\nduring the initialization) it creates the virtual environment for the\nproject. It updates `pip` to the latest version and the virtualenv is\nactivated automatically.\n\nIf you have a non-empty `requirements.txt` file, then the\nscript asks if you want to install the packages in this file.\n\nFor convenience, two jump scripts are also created. One of them is in\nthe project folder and the other one is in the virtualenv folder. If\nyou type `. cd_venv_dir.sh`, then you find yourself in the virtualenv\nfolder. Typing `. cd_project_dir.sh` you are redirected back to the\nproject folder. (The `.` is the short form of `source`.)\n\nActivating / deactivating a virtual environment\n-----------------------------------------------\nActivate (in the project folder):\n\n    on\n\nIf you are in a subfolder of your project, then you\ndon't need to go back to the project's root folder every time when\nyou want to activate the project! Simply type `on ..` or `on ../..`, etc.,\ndepending on which subfolder you are in.\n\nInstead of `on ../..`, you can simply type `on ...` too. `on ....` means\n`on ../../..`, etc.\n\nDeactivate (anywhere):\n\n    off\n\nAutomatic activating / deactivating a virtual environment\n----------------------------------------------------------------\nBy default, your virtualenv will be activated automatically when\nyou enter a directory that has an attached virtual environment.\n\nPrerequisite: the virtual env. must be created with this tool, i.e.\nwith `venv_init` and `venv_make`. Why? The script checks the presence\nof the file `cd_venv_dir.sh`, which is created by `venv_make`.\n\nIf you don't need this auto-activation feature, then set the\nvalue of the variable `ALLOW_VIRTUALENV_AUTO_ACTIVATE` to `0`.\n\nUpdate requirements.txt\n-----------------------\nUpon initialization a convenience script was created in the project\nfolder called `update_requirements.sh`. If you installed a new\npackage, or a package was updated, then use this command to\nupdate your `requirements.txt` file:\n\n    ./update_requirements.sh \u003e requirements.txt\n\nCreate a temporary virtual environment\n--------------------------------------\nIt is useful if you want to try a module quickly but you don't want to\ninstall it globally with `sudo pip ...`.\n\n    venv_tmp\n\nYou get a temporary project folder and an associated virtual environment\nin `/tmp`. Note that when you deactivate it, it is not deleted\nautomatically!\n\nVisual Studio Code support\n--------------------------\nTo use VS Code in a virtual environment, you need to specify the\nlocation of the local Python interpreter in your workspace settings\n(`.vscode/settings.json`). If you run\n\n    venv_init_vscode\n\nthen your workspace settings will be initialized and VS Code will\nuse the Python interpreter of the virt. env.\n\nWhat's new?\n-----------\nWhen you create a new virtual environment, by default it is created in\nyour `~/.virtualenvs` folder, e.g. `~/.virtualenvs/first_project`. The\nnew thing is that a hash value is added to the folder's name (example:\n`~/.virtualenvs/first_project-ee02efc7`). This way several projects can\nhave the same name, the virtual environments will be nicely separated. You\ncan simply ignore this hash value, everything else works the same way\n(`on` will still find and activate the virt. env.). In your project\nfolder this hash value can be found in the `cd_venv_dir.sh` file.\n\nTips\n----\nAll the commands mentioned above start with `venv_`. Thus, you\ndon't need to memorize their names. Just type `ven\u003cTAB\u003e` or\n`venv_\u003cTAB\u003e` and bash will do TAB-completion for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabbalaci%2Fvirtualenv-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabbalaci%2Fvirtualenv-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabbalaci%2Fvirtualenv-tools/lists"}