Hypermodern Python blog series pt.1

I found this fantastic looking resource so going to do a bit of studying: https://cjolowicz.github.io/posts/hypermodern-python-01-setup/

First updating my WSL :

installing pyenv

curl https://pyenv.run | bash

The blog post users bash, but I’m using zsh so have to use abit of different exports:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

and of course things could not be so simple:

So after some Googling I found out how to fix the line endings in pyenv with some regexp magic:

$ cd ~/.pyenv && find . -type f | xargs sed -i $'s/\r$//' && cd -

The course seems to be bit outdated, and I had to use another url for Poetry:

curl -sSL https://install.python-poetry.org | python3 -

AAaaand we are back to this:

more fun:

This is starting to get ridiculous

Finally found the correct poetry to modify:

Renamed to Basalmodern to avoid conflicts

For some reason the poetry init added following to the toml file:

packages = [{include = "basalmodern_python"}]

But that, for some reason, blocks the poetry init from finding the package… after lot of searching I finally got it installed.

Summary

When adding to venv using poetry 3 things happen:

Found out that Poetry allows me to run scripts like this, though not yet sure what I would use it for: