{"id":13728099,"url":"https://github.com/aiguofer/pyenv-version-alias","last_synced_at":"2025-03-21T03:42:52.899Z","repository":{"id":66088097,"uuid":"195340375","full_name":"aiguofer/pyenv-version-alias","owner":"aiguofer","description":"Pyenv plugin to add an alias to your global pyenv version and individual .python-version","archived":false,"fork":false,"pushed_at":"2019-07-12T00:55:40.000Z","size":13,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T00:23:31.811Z","etag":null,"topics":[],"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/aiguofer.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}},"created_at":"2019-07-05T04:47:36.000Z","updated_at":"2024-08-31T08:59:10.000Z","dependencies_parsed_at":"2023-02-22T06:00:33.737Z","dependency_job_id":null,"html_url":"https://github.com/aiguofer/pyenv-version-alias","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/aiguofer%2Fpyenv-version-alias","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiguofer%2Fpyenv-version-alias/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiguofer%2Fpyenv-version-alias/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiguofer%2Fpyenv-version-alias/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiguofer","download_url":"https://codeload.github.com/aiguofer/pyenv-version-alias/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244734095,"owners_count":20501014,"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":[],"created_at":"2024-08-03T02:00:37.220Z","updated_at":"2025-03-21T03:42:52.854Z","avatar_url":"https://github.com/aiguofer.png","language":"Shell","readme":"# pyenv-version-alias\nPyenv plugin to add an alias to your global pyenv version and individual .python-version\n\nThis is useful when you use multiple versions and/or virtualenvs within a pyenv version, and you want to display a more readable string in tools that display your pyenv version.\n\nFor example, if you had your global version set as:\n\n~/.pyenv/version\n```\ndefault3\ndefault2\n3.5.7\n3.6.8\n```\n\nMost tools that display this would use `pyenv version-name` which would display `default3:default2:3.5.7:3.6.8`. Using `pyenv version-alias` would display `global`.\n\nAlternatively, if you had a project like this:\n\n~/myproject/.python-version\n```\nmodule_virtualenv1\nmodule_virtualenv2\nmodule_virtualenv3\n```\n\nYoul could do `pyenv version-alias myproject`, then any time you call `pyenv version-alias` it would return `myproject`\n\n## Installation\n\n```shell\n$ git clone https://github.com/aiguofer/pyenv-version-alias $(pyenv root)/plugins/pyenv-version-alias\n```\n\n## Usage\n\nTo set a version alias (this will create a `.python-version-alias` file in the same dir as your `.python-version`):\n```shell\n$ pyenv version-alias \u003calias-name\u003e\n```\n\nTo fetch the current alias (this will return `global` for the global version):\n```shell\n$ pyenv version-alias\n```\n\nWhen using `$PYENV_VERSION` env var, you can't use the normal set method. However, you can create a `$PYENV_VERSION_ALIAS` env var with the alias you want.\n\n## Integrating it into your toolchain\n\nFor [powerlevel9k](https://github.com/bhilburn/powerlevel9k), just add this to your `~/.zshrc` (after loading the theme, since you're overriding the function):\n\n```shell\nprompt_pyenv() {\n    local pyenv_version_name=\"$(pyenv version-alias)\"\n    if [[ \"${pyenv_version_name}\" != \"global\" || \"${POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW}\" == \"true\" ]]; then\n        \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" \"$pyenv_version_name\" 'PYTHON_ICON'\n    fi\n}\n```\n\nFor [powerlevel10k](https://github.com/romkatv/powerlevel10k) it's slightly different:\n\n```shell\nprompt_pyenv() {\n    local v=$(pyenv version-alias)\n    if [[ \"${v}\" != \"global\" || \"${POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW}\" == \"true\" ]]; then\n        \"$1_prompt_segment\" \"$0\" \"$2\" \"blue\" \"$DEFAULT_COLOR\" 'PYTHON_ICON' 0 '' \"${v//\\%/%%}\"\n    fi\n}\n```\n\nFor Emacs, you can use https://github.com/aiguofer/pyenv.el and enable aliases with\n\n```lisp\n(setq pyenv-use-alias 't)\n```\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Plugins for pyenv"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiguofer%2Fpyenv-version-alias","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiguofer%2Fpyenv-version-alias","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiguofer%2Fpyenv-version-alias/lists"}