{"id":14982907,"url":"https://github.com/whisperity/envprobe","last_synced_at":"2025-06-20T23:08:43.748Z","repository":{"id":62591798,"uuid":"121447454","full_name":"whisperity/envprobe","owner":"whisperity","description":"Overlaying pluggable environment setter: modules reimagined + toggleable direnv on the shell, rather than the directory level.","archived":false,"fork":false,"pushed_at":"2022-05-29T11:03:06.000Z","size":447,"stargazers_count":9,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T23:07:59.867Z","etag":null,"topics":["alias","alias-management","bash","bash-configuration","bash-profile","command-line-tool","configuration-by-environment","configuration-management","environment","environment-variables","module-loader","posix","settings-storage","shell","shell-environment","virtualenv","zsh"],"latest_commit_sha":null,"homepage":"http://pypi.org/project/envprobe","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whisperity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T23:08:25.000Z","updated_at":"2023-02-14T12:15:38.000Z","dependencies_parsed_at":"2022-11-04T07:19:20.836Z","dependency_job_id":null,"html_url":"https://github.com/whisperity/envprobe","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/whisperity/envprobe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whisperity%2Fenvprobe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whisperity%2Fenvprobe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whisperity%2Fenvprobe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whisperity%2Fenvprobe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whisperity","download_url":"https://codeload.github.com/whisperity/envprobe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whisperity%2Fenvprobe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261032097,"owners_count":23100050,"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":["alias","alias-management","bash","bash-configuration","bash-profile","command-line-tool","configuration-by-environment","configuration-management","environment","environment-variables","module-loader","posix","settings-storage","shell","shell-environment","virtualenv","zsh"],"created_at":"2024-09-24T14:06:23.551Z","updated_at":"2025-06-20T23:08:38.732Z","avatar_url":"https://github.com/whisperity.png","language":"Python","readme":"Envprobe\n========\n\n**Envprobe** (`envprobe`) is a shell hook tool that helps you manage your environment variables on a per-shell basis easily.\nThere is no need for clunky `export` sequences or manual `source`-ing of who-knows-where hand-written script files.\n\nEnvprobe was originally conceived as the tool between [shell `modules`](http://modules.sourceforge.net) and [`direnv`](http://direnv.net), but with added features such as saving your configuration on the fly.\n\n- The [**full documentation**](http://envprobe.readthedocs.io/en/latest/index.html) is available on _Read the Docs_.\n- [Installation](#installation)\n  - [Dependencies](#dependencies)\n  - [Download](#download)\n  - [Hook](#hook)\n- [Quick user guide](#quick-user-guide)\n  - [Managing environment variables](#managing-environment-variables)\n  - [Saved snapshots](#saved-snapshots)\n  - [Type-safe access](#type-safe-access)\n- [Configuring variable handling](#configuring-variable-handling)\n  - [Obtaining variable type descriptions](#obtaining-variable-type-descriptions)\n\n---\n\n## Installation\n\n### Dependencies\n\nEnvprobe is supplied as a no-tools-needed Python package.\nThe only things you need to have installed on the system are one of our supported POSIX-compliant shells and Python **3**.\n\nSupported shells are reasonably modern versions of Bash and Zsh.\n\n### Officially supported configurations\n\nThese are the configurations that the [CI](http://github.com/whisperity/Envprobe/actions) is running tests on:\n\n| Operating system                     | Required dependencies | Shells supported                     |\n|:-------------------------------------|:---------------------:|:-------------------------------------|\n| Ubuntu 18.04 LTS (_Bionic Beaver_)   |    Python \u0026ge; 3.6    | Bash (\u0026ge; 4.4), Zsh (\u0026ge; 5.4)      |\n| Ubuntu 20.04 LTS (_Focal Fossa_)     |    Python \u0026ge; 3.8    | Bash (\u0026ge; 5.0), Zsh (\u0026ge; 5.8)      |\n\n\n### Download\n\nYou can download Envprobe's official releases from [PyPI](http://pypi.org/project/envprobe).\n\n~~~{.sh}\npip install envprobe\n~~~\n\n\n#### From GitHub\n\nYou can also download Envprobe from the GitHub repository, either via `git` or in a tarball form.\nDownload the project anywhere you please, and extract the archive.\nIn this example, we'll use `~/envprobe` as the location.\n\n~~~{.sh}\ngit clone http://github.com/whisperity/envprobe.git ~/envprobe \\\n    --origin upstream --single-branch --branch master --depth 1\n~~~\n\nor\n\n~~~{.sh}\nmkdir ~/envprobe\nwget http://github.com/whisperity/envprobe/tarball/master -O envprobe.tar.gz\ntar xzf envprobe.tar.gz --strip-components=1 -C ~/envprobe/\n~~~\n\n\n### Hook\n\nEnvprobe applies the changes to your environment variable every time a prompt is generated in your shell.\nFor this to work, a hook must be set up in each shell you're using.\n\nThe easiest way to do this is to add the hook script at the end of the configuration file for your respective shell.\n\n\u003e **:warning: Note!** If you are using other custom shell extensions, it is **well-advised** for the best experience to load Envprobe **last**.\n\n| Shell                              |             Configuration file (usually)              |                Code to add                |\n|:-----------------------------------|:-----------------------------------------------------:|:-----------------------------------------:|\n| Bash                               |                   `~/.bashrc`                         | `eval \"$(envprobe config hook bash $$)\";` |\n| Zsh (stock)                        | `~/.zshrc`                                            | `eval \"$(envprobe config hook zsh $$)\";`  |\n| Zsh ([Oh My Zsh](http://ohmyz.sh)) | `~/.oh-my-zsh/custom/zzzzzz_envprobe.zsh` (new file!) | `eval \"$(envprobe config hook zsh $$)\";`  |\n\n\n## Quick user guide\n\nIf Envprobe is successfully [installed and hooked](#hook), the `ep`/`envprobe` and `epc`/`envprobe-config` convenience _functions_ will be defined in the current shell.\nIf you see something like below, the tool is good to go.\n\n~~~{.bash}\n$ ep\nusage: envprobe [-h] ...\n~~~\n\nThe following guide will show the usage of Envprobe through a few practical examples.\n\nFor a complete overview on the commands available and their usage, you can always call `ep -h` (or `ep get -h`, etc. for each subcommand) to get a quick help.\nThe [complete documentation](http://envprobe.readthedocs.io/en/latest/main/index.html) for the user-facing commands is available behind the link.\n\n\n### Managing environment variables\n\nFor easy access, the environment variable managing commands are also offered as shortcuts.\n\n| Command                 | Shortcut                                            | Usage                          |\n|:------------------------|:----------------------------------------------------|:-------------------------------|\n| `get VARIABLE`          | `?VARIABLE`, or simply `VARIABLE`                   | Print the value of `VARIABLE`. |\n| `set VARIABLE VALUE   ` | `!VARIABLE`, `VARIABLE=VALUE`                       | Sets `VARIABLE` to `VALUE`.    |\n| `undefine VARIABLE`     | `^VARIABLE`                                         | Undefine `VARIABLE`.           |\n| `add VARIABLE VALUE`    | `+VARIABLE VALUE` (front), `VARIABLE+ VALUE` (back) | Add a `VALUE` to an array.     |\n| `remove VARIABLE VALUE` | `-VARIABLE VALUE`                                   | Remove `VALUE` from an array.  |\n\n\n~~~{.bash}\n$ ep get USER\nUSER=root\n\n$ ep USER\nUSER=root\n\n$ ep PATH\nPATH=/usr/local/bin:/usr/bin:/sbin:/bin\n\n$ echo $SOME_VARIABLE\n# No result, variable is not defined.\n$ ep SOME_VARIABLE=MyValue\n$ echo $SOME_VARIABLE\nMyValue\n\n$ ep ^SOME_VARIABLE\n$ echo $SOME_VARIABLE\n# No result.\n\n\n\n$ fancy\nfancy: command not found!\n\n$ ep +PATH /opt/fancy/bin\n$ fancy\nFancy tool works!\n\n$ ep PATH\nPATH=/opt/fancy/bin:/usr/local/bin:/usr/bin:/sbin:/bin\n\n$ pwd\n/root\n\n$ ep -PATH /opt/fancy/bin\n$ ep PATH+ .\n$ ep PATH\nPATH=/usr/local/bin:/usr/bin:/sbin:/bin:/root\n\n$ ep +PATH ..\nPATH=/:/usr/local/bin:/usr/bin:/sbin:/bin:/root\n~~~\n\n\n### Saved snapshots\n\nFor easy access, some of the snapshot management commands are also offered as shortcuts.\n\n| Command                                   | Shortcut                        | Usage                                                                                                                                                           |\n|:------------------------------------------|:--------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `diff [var1 var2...]`                     | `% [var1 var2...]`              | Show the difference between the current environment and the last saved one (optionally only for the variables named).                                           |\n| `save [--patch] SNAPSHOT [var1 var2...]`  | `}SNAPSHOT [-p] [var1 var2...]` | Save the changes (optionally of only the variables named) to the snapshot named `SNAPSHOT`. If `-p` is given, ask for confirmation of each individual change.   |\n| `load [--patch] SNAPSHOT [var1 var2...]`  | `{SNAPSHOT [-p] [var1 var2...]` | Load the changes (optionally to only the variables names) from the snapshot named `SNAPSHOT`. If `-p` is given, ask for confirmation of each individual change. |\n| `list`                                    |                                 | List the saved snapshots' names.                                                                                                                                |\n| `delete SNAPSHOT`                         |                                 | Delete the snapshot named `SNAPSHOT`.                                                                                                                           |\n\n\n~~~{.bash}\n$ ep %\n# (No output, initially the environment hasn't been changed yet.)\n\n$ ep PATH\nPATH=/usr/local/bin:/usr/bin/:/sbin:/bin\n\n$ ep SOME_VARIABLE=foo\n$ ep +PATH /tmp\n$ ep -PATH /sbin\n$ ep PATH+ /home/user/bin\n\n$ ep %\n(+) Added:       SOME_VARIABLE\n        defined value: foo\n\n(!) Changed:     PATH\n        added:         /tmp\n        added:         /home/user/bin\n        removed:       /sbin\n\n$ ep } mypath PATH\nFor variable 'PATH' the element '/tmp' was added.\nFor variable 'PATH' the element '/home/user/bin' was added.\nFor variable 'PATH' the element '/sbin' was removed.\n\n$ ep } other_vars -p\nNew variable 'SOME_VARIABLE' with value 'foo'.\nSave this change? (y/N) _\n\n\n\n$ ep list\nmypath\nother_vars\n\n$ ep delete mypath\n$ ep list\nother_var\n\n\n\n$ ep load custompaths\nFor variable 'PATH' the element '/srv/custom/bin' will be added.\n\n$ ep PATH\nPATH=/srv/custom/bin:/tmp:/home/user/bin\n\n$ ep { foobar -n\nNew variable 'FOO' will be created with value 'bar'.\n\n$ ep FOO\nFOO is not defined\n\n$ ep { foobar -p\nNew variable 'FOO' will be created with value 'bar'.\nLoad and apply this change? (y/N) _\n~~~\n\n### Saved snapshots\n\nEnvprobe offers type safety when accessing environment variables, such as prohibiting assigning a textual value to a `_PID` variable.\nThe type of a variable is decided based on several heuristics by default, and can be [configured by the user](#configuring-variable-handling).\n\n~~~{.bash}\n$ echo $SSH_AGENT_PID\n12345\n\n$ export SSH_AGENT_PID=\"invalid-value\"\n# The above example works, even though a \"_PID\" variable should only\n# contain numbers.\n\n$ ep SSH_AGENT_PID=98765\n$ ep SSH_AGENT_PID=\"foo\"\n[ERROR] Failed to execute: could not convert string to number.\n\n$ ep SSH_AGENT_PID\nSSH_AGENT_PID=98765\n~~~\n\n\n## Configuring variable handling\n\nThe `envprobe-config` (or `epc`) command contains various subcommands that can be used to configure Envprobe's behaviour.\n\nFor a complete overview on the commands available and their usage, you can always call `epc -h` (or `epc track -h`, etc. for each subcommand) to get a quick help.\nThe [complete documentation](http://envprobe.readthedocs.io/en/latest/config/index.html) for the user-facing commands is available behind the link.\n\n|  Command              |  Usage                                                                                                   |\n|:----------------------|:---------------------------------------------------------------------------------------------------------|\n| `hook ...`            | Generate the [Shell hook](#hook) that allows Envprobe to interface with the environment.                 |\n| `set VARIABLE ...`    | Set additional information, such as a *description*, for a variable.                                     |\n| `track VARIABLE`      | Configure whether changes to a `VARIABLE` should be managed in [saved snapshots](#saved-snapshots).      |\n| `descriptions update` | Download the [variable descriptions](http://github.com/whisperity/Envprobe-Descriptions) to use locally. |\n\n\n### Obtaining variable type descriptions\n\nEnvprobe is managed with a sister project, the *[Envprobe Variable Descriptions Knowledge Base](http://github.com/whisperity/Envprobe-Descriptions)* which contains a curated list of environment variable descriptions and types.\nThis database is used together with other heuristics to provide type-safe access to variables.\nThe description of a variable, when queried, may come from a local copy of this database too.\n[Read more about this feature.](http://envprobe.readthedocs.io/en/latest/community_descriptions.html)\n\nTo initially download, or subsequently update, the description database, execute:\n\n    epc descriptions update\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhisperity%2Fenvprobe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhisperity%2Fenvprobe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhisperity%2Fenvprobe/lists"}