{"id":43485076,"url":"https://github.com/markosamuli/ansible-pyenv","last_synced_at":"2026-02-03T09:07:39.638Z","repository":{"id":25901545,"uuid":"106179543","full_name":"markosamuli/ansible-pyenv","owner":"markosamuli","description":"Ansible role to install pyenv on Ubuntu or macOS development machines","archived":false,"fork":false,"pushed_at":"2025-12-22T10:38:37.000Z","size":274,"stargazers_count":62,"open_issues_count":20,"forks_count":19,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-23T21:49:59.407Z","etag":null,"topics":["ansible","debian","homebrew","macos","pengwin","pyenv","pyenv-virtualenv","ubuntu"],"latest_commit_sha":null,"homepage":"","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/markosamuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-10-08T13:45:43.000Z","updated_at":"2025-08-27T12:14:22.000Z","dependencies_parsed_at":"2024-01-11T23:19:31.260Z","dependency_job_id":"a8f0e17d-862d-4bef-bda4-9e56f13fcc04","html_url":"https://github.com/markosamuli/ansible-pyenv","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/markosamuli/ansible-pyenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosamuli%2Fansible-pyenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosamuli%2Fansible-pyenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosamuli%2Fansible-pyenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosamuli%2Fansible-pyenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markosamuli","download_url":"https://codeload.github.com/markosamuli/ansible-pyenv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosamuli%2Fansible-pyenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29039342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T08:41:49.363Z","status":"ssl_error","status_checked_at":"2026-02-03T08:40:19.255Z","response_time":96,"last_error":"SSL_read: 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":["ansible","debian","homebrew","macos","pengwin","pyenv","pyenv-virtualenv","ubuntu"],"created_at":"2026-02-03T09:07:38.912Z","updated_at":"2026-02-03T09:07:39.632Z","avatar_url":"https://github.com/markosamuli.png","language":"Shell","readme":"# markosamuli.pyenv\n\n[![Ansible Quality Score](https://img.shields.io/ansible/quality/38342.svg)](https://galaxy.ansible.com/markosamuli/pyenv)\n[![Ansible Role](https://img.shields.io/ansible/role/38342.svg)](https://galaxy.ansible.com/markosamuli/pyenv)\n[![GitHub release](https://img.shields.io/github/release/markosamuli/ansible-pyenv.svg)](https://github.com/markosamuli/ansible-pyenv/releases)\n[![License](https://img.shields.io/github/license/markosamuli/ansible-pyenv.svg)](https://github.com/markosamuli/ansible-pyenv/blob/master/LICENSE)\n\n| Branch | Pipeline                                    |\n| ------ | ------------------------------------------- |\n| master | [![master][status-master]][pipeline-master] |\n\n[pipeline-master]: https://github.com/markosamuli/ansible-pyenv/actions/workflows/pipeline.yml?query=branch%3Amaster\n[status-master]: https://github.com/markosamuli/ansible-pyenv/workflows/Test%20and%20release/badge.svg?branch=master\n\nAnsible role to install [pyenv] and [pyenv-virtualenv] on Ubuntu or macOS\ndevelopment machines.\n\nOptionally, [pyenv-virtualenvwrapper] can be installed and used for managing\nenvironments.\n\nDon't use this role on production servers as it supports installing pyenv only\nunder user home directory.\n\n[pyenv]: https://github.com/pyenv/pyenv\n[pyenv-virtualenv]: https://github.com/pyenv/pyenv-virtualenv\n[pyenv-virtualenvwrapper]: https://github.com/pyenv/pyenv-virtualenvwrapper\n\n## Install from Homebrew on macOS\n\nThe default method to install pyenv and plugins on macOS is to use Homebrew.\n\nThe role doesn't know how to migrate from existing Homebrew installs to\nGit-based installations, so it will try to detect any existing installation\nand keep using the previous method.\n\nIf you want to migrate, backup and delete your existing `~/.pyenv` directory\nbefore running this role.\n\n## Install from Homebrew on Linux\n\nThe role includes an experimental support for installing pyenv and plugins\nwith Homebrew on Linux.\n\nThe role doesn't install Homebrew on Linux itself and expects it to be installed\nin the default `/home/linuxbrew/.linuxbrew` location.\n\nInstalling Python versions with pyenv on Linux when Homebrew installation exists\nhas some known issues:\n\n- readline extension was not compiled, installed pyenv by Linuxbrew on\n  Ubuntu 16 [#1479][pyenv-1479]\n\n[pyenv-1479]: https://github.com/pyenv/pyenv/issues/1479\n\n## Installed Python versions\n\nThis role installs [Python][python] versions defined in `pyenv_python_versions`\nvariable.\n\nTo set global version, set `pyenv_global` variable to the desired version(s).\n\n```yaml\npyenv_global: \"{{ pyenv_python37_version }} system\"\n```\n\nThis is configured to use latest Python 2 and Python 3 versions and the\nsystem version as default.\n\n[python]: https://www.python.org\n\n## Changes to shell config files\n\nThis role creates config file in `~/.pyenv/.pyenvrc` that is loaded in\n`.bashrc` and `.zshrc` files.\n\nCode completion is loaded by default.\n\nIf you're managing your shell scripts `.dotfiles` or are using a framework, you\nshould set `pyenv_init_shell` to `false` and update these files yourself to keep\nthem clean.\n\nReference `.bashrc` configuration:\n\n```bash\nif [ -e \"$HOME/.pyenv/.pyenvrc\" ]; then\n  source $HOME/.pyenv/.pyenvrc\n  if [ -e \"$HOME/.pyenv/completions/pyenv.bash\" ]; then\n    source $HOME/.pyenv/completions/pyenv.bash\n  elif [ -e \"/usr/local/opt/pyenv/completions/pyenv.bash\" ]; then\n    source /usr/local/opt/pyenv/completions/pyenv.bash\n  fi\nfi\n```\n\nReference `.zshrc` configuration:\n\n```zsh\nif [ -e \"$HOME/.pyenv/.pyenvrc\" ]; then\n  source $HOME/.pyenv/.pyenvrc\n  if [ -e \"$HOME/.pyenv/completions/pyenv.zsh\" ]; then\n    source $HOME/.pyenv/completions/pyenv.zsh\n  elif [ -e \"/usr/local/opt/pyenv/completions/pyenv.zsh\" ]; then\n    source /usr/local/opt/pyenv/completions/pyenv.zsh\n  fi\nfi\n```\n\n## Role Variables\n\nPath to `~/.pyenv` is based on environment variables:\n\n```yaml\npyenv_home: \"{{ ansible_env.HOME }}\"\npyenv_root: \"{{ ansible_env.HOME }}/.pyenv\"\n```\n\nUpdate `.bashrc` and `.zshrc` files in user home directory:\n\n```yaml\npyenv_init_shell: true\n```\n\nVersions to install:\n\n```yaml\npyenv_version: \"v1.2.13\"\npyenv_virtualenv_version: \"v1.1.5\"\npyenv_virtualenvwrapper_version: \"v20140609\"\n```\n\nLatest Python 3.7 and Python 3.8 versions:\n\n```yaml\npyenv_python37_version: \"3.7.6\"\npyenv_python38_version: \"3.8.1\"\n```\n\nPython 2 and Python 3 versions are installed by default:\n\n```yaml\npyenv_python_versions:\n  - \"{{ pyenv_python37_version }}\"\n  - \"{{ pyenv_python38_version }}\"\n```\n\nSet global version to Python 3.7 with `system` fallback:\n\n```yaml\npyenv_global: \"{{ pyenv_python37_version }} system\"\n```\n\nInstall virtualenvwrapper plugin:\n\n```yaml\npyenv_virtualenvwrapper: false\npyenv_virtualenvwrapper_home: \"{{ ansible_env.HOME }}/.virtualenvs\"\n```\n\nInstall using Homebrew package manager on macOS:\n\n```yaml\npyenv_install_from_package_manager: true\n```\n\nDetect existing installation method and use that:\n\n```yaml\npyenv_detect_existing_install: true\n```\n\nInstall using Homebrew on Linux:\n\n```yaml\npyenv_homebrew_on_linux: true\n```\n\n## Example Playbook\n\n```yaml\n- hosts: localhost\n  connection: local\n  become: false\n  roles:\n    - role: markosamuli.pyenv\n```\n\n## Updating versions\n\nRun the following scripts to get latest releases from GitHub and update them in\nrole defaults.\n\nUpdate [pyenv] release:\n\n```bash\n./update-release pyenv\n```\n\nUpdate [pyenv-virtualenv] release:\n\n```bash\n./update-release pyenv-virtualenv\n```\n\nUpdate default [Python] 3.7 version:\n\n```bash\n./update-python python37\n```\n\nUpdate default [Python] 3.8 version:\n\n```bash\n./update-python python38\n```\n\nUpdate all versions:\n\n```bash\nmake update\n```\n\n## Coding style\n\nInstall pre-commit hooks and validate coding style:\n\n```bash\nmake lint\n```\n\n## Run tests\n\nRun tests in Ubuntu and Debian using Docker:\n\n```bash\nmake test\n```\n\n## Acknowledgements\n\nUse of `.pyenvrc` file and parts used for installing python version taken from\n[avanov.pyenv](https://github.com/avanov/ansible-galaxy-pyenv) role.\n\n## Development\n\nInstall development dependencies in a local virtualenv:\n\n```bash\nmake setup\n```\n\nInstall [pre-commit] hooks:\n\n```bash\nmake install-git-hooks\n```\n\n[pre-commit]: https://pre-commit.com/\n\n## Changes\n\n- [CHANGELOG.md](CHANGELOG.md)\n\n## License\n\n- [MIT](LICENSE)\n\n## Author Information\n\n- [@markosamuli](https://github.com/markosamuli)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkosamuli%2Fansible-pyenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkosamuli%2Fansible-pyenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkosamuli%2Fansible-pyenv/lists"}