DEV Community

Discussion on: Build Command Line Tools with Python Poetry

 
mklengel profile image
Michael Klengel

Hi Jonathan,

thx for your suggestion. The symbolic path exists already:

➜  pygreet ls -ld $HOME/Development/pygreet
drwxr-xr-x  8 mklengel  staff  256  5 Feb 13:38 /Users/mklengel/Development/pygreet
Enter fullscreen mode Exit fullscreen mode

Create the virtualenv inside the project's root directory leads to:

➜  pygreet head -1 .venv/bin/greet
#!/Volumes/Macintosh SR0/Users/mklengel/Development/pygreet/.venv/bin/python
Enter fullscreen mode Exit fullscreen mode

Using the default virtualenv folder looks much better:

➜  pygreet poetry config virtualenvs.in-project false

➜  pygreet poetry config --list
cache-dir = "/Users/mklengel/Library/Caches/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/mklengel/Library/Caches/pypoetry/virtualenvs

➜  pygreet poetry install
Creating virtualenv greet-hlYPq_3g-py3.9 in /Users/mklengel/Library/Caches/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 24 installs, 0 updates, 0 removals

  • Installing pyparsing (2.4.7)
  • Installing six (1.15.0)
  • Installing appdirs (1.4.4)
  • Installing attrs (20.3.0)
  • Installing click (7.1.2)
  • Installing mccabe (0.6.1)
  • Installing more-itertools (8.6.0)
  • Installing mypy-extensions (0.4.3)
  • Installing packaging (20.9)
  • Installing pathspec (0.8.1)
  • Installing pluggy (0.13.1)
  • Installing py (1.10.0)
  • Installing pycodestyle (2.6.0)
  • Installing pyflakes (2.2.0)
  • Installing python-dateutil (2.8.1)
  • Installing regex (2020.11.13)
  • Installing toml (0.10.2)
  • Installing typed-ast (1.4.2)
  • Installing typing-extensions (3.7.4.3)
  • Installing wcwidth (0.2.5)
  • Installing arrow (0.17.0)
  • Installing black (20.8b1)
  • Installing flake8 (3.8.4)
  • Installing pytest (5.4.3)

Installing the current project: greet (0.1.0)
➜  pygreet head -1 ~/Library/Caches/pypoetry/virtualenvs/greet-hlYPq_3g-py3.9/bin/greet
#!/Users/mklengel/Library/Caches/pypoetry/virtualenvs/greet-hlYPq_3g-py3.9/bin/python

➜  pygreet poetry shell
Spawning shell within /Users/mklengel/Library/Caches/pypoetry/virtualenvs/greet-hlYPq_3g-py3.9

➜  pygreet . /Users/mklengel/Library/Caches/pypoetry/virtualenvs/greet-hlYPq_3g-py3.9/bin/activate

(greet-hlYPq_3g-py3.9) ➜  pygreet greet Africa/Addis_Ababa
Hello, Addis Ababa! The time is 4:50 pm.
Enter fullscreen mode Exit fullscreen mode

So may be this is the bug in poetry: the shebang line is not the symbolic one if the virtualenv folder is in the project's root directory.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

That's well put.