Skip to content

Instantly share code, notes, and snippets.

@adithyabsk
Created July 6, 2022 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adithyabsk/6bcb552fc1f9f37a6867e95ad7140897 to your computer and use it in GitHub Desktop.
Save adithyabsk/6bcb552fc1f9f37a6867e95ad7140897 to your computer and use it in GitHub Desktop.
Working Pyenv / Poetry Setup Example
pwd
/Users/adithyabalaji/Coding/test
❯ ls
❯ pyenv --version
pyenv 2.3.2
❯ poetry --version
Poetry version 1.1.13
❯ pyenv global
3.8.10
❯ pyenv local
pyenv: no local version configured for this directory
❯ pyenv virtualenv test
Looking in links: /var/folders/ky/xpvlh4052fb99mp1n12s4pzc0000gn/T/tmpeqh5zx8j
Requirement already satisfied: setuptools in /Users/adithyabalaji/.pyenv/versions/3.8.10/envs/test/lib/python3.8/site-packages (56.0.0)
Requirement already satisfied: pip in /Users/adithyabalaji/.pyenv/versions/3.8.10/envs/test/lib/python3.8/site-packages (21.1.1)
❯ pyenv local test 3.6.13
❯ pyenv local
test
3.6.13
❯ which python
/Users/adithyabalaji/.pyenv/shims/python
❯ printenv | grep VIRTUAL_ENV
PYENV_VIRTUAL_ENV=/Users/adithyabalaji/.pyenv/versions/3.8.10/envs/test
VIRTUAL_ENV=/Users/adithyabalaji/.pyenv/versions/3.8.10/envs/test
❯ poetry init
[... TRUNCATED OUTPUT ...]
❯ cat pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2.28.1"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
❯ poetry install
Updating dependencies
Resolving dependencies... (1.1s)

Writing lock file

Package operations: 5 installs, 0 updates, 0 removals

  • Installing certifi (2022.6.15)
  • Installing charset-normalizer (2.1.0)
  • Installing idna (3.3)
  • Installing urllib3 (1.26.9)
  • Installing requests (2.28.1)
❯ pip freeze
certifi @ file:///Users/adithyabalaji/Library/Caches/pypoetry/artifacts/0f/59/de/e5e6d69facca7b107575f87c21dfaf9a9407da4d9e72ae24b880961a24/certifi-2022.6.15-py3-none-any.whl
charset-normalizer @ file:///Users/adithyabalaji/Library/Caches/pypoetry/artifacts/82/7c/da/5f435ce823f9a86128f00ef96ff190f2846d4714c188c8ceb14ba7c333/charset_normalizer-2.1.0-py3-none-any.whl
idna @ file:///Users/adithyabalaji/Library/Caches/pypoetry/artifacts/f7/09/c9/8e80952436ff87855ddff4891a35ecf913b2b5dc97911f02a070ff2b1f/idna-3.3-py3-none-any.whl
requests @ file:///Users/adithyabalaji/Library/Caches/pypoetry/artifacts/73/b6/11/8a5136f9e1ac320567e50227250ded8bfa8942970419dd6c48eea64899/requests-2.28.1-py3-none-any.whl
urllib3 @ file:///Users/adithyabalaji/Library/Caches/pypoetry/artifacts/82/6d/7d/27c3eb08fd57859a15aa9472bf2acde15878f936b4283bae9b2ad55599/urllib3-1.26.9-py2.py3-none-any.whl
❯ pip list
Package            Version
------------------ ---------
certifi            2022.6.15
charset-normalizer 2.1.0
idna               3.3
pip                21.1.1
requests           2.28.1
setuptools         56.0.0
urllib3            1.26.9
WARNING: You are using pip version 21.1.1; however, version 22.1.2 is available.
You should consider upgrading via the '/Users/adithyabalaji/.pyenv/versions/3.8.10/envs/test/bin/python3.8 -m pip install --upgrade pip' command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment