This project is used to demonstrate my idea of a perfect Python project configuration. Nearly everything I've chosen can be bikeshedded for hours or days, but feel free to submit a PR if you can back up your suggestions with evidence. 😊
(Last updated September 13, 2020)
- Latest version of Python (3.8.5)
- Latest version of Poetry ()
For installing Python, you should you PyEnv, regardless of operating system. PyEnv will allow you to easily switch versions of Python. In a perfect world, everyone would be on the latest version, but often we don't have the luxury.
(You are using Homebrew right?)
brew update
brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc # Add pyenv to Path
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc # Or .bashrc,. .bash_profile, etc. if not using ZSH
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc # Autocompletion, requires shell restart
(You are using Chocolatey right?) **NOTE: ** You should just move to WSL, trust me, the sooner you do it the better everything will be. :)
choco install pyenv-win
# Restart PowerShell
pyenv update # To get the latest versions of Python, otherwise you won't see 3.8.5
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc # Add pyenv to Path
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc # Or .bashrc,. .bash_profile, etc. if not using ZSH
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc # Autocompletion, requires shell restart
Time to install the latest version of Python!
pyenv install 3.8.5
pyenv global 3.8.5 # Sets python and python3 globally to point to 3.8.5
# Let's verify 3.8.5 is set globally, close whatever terminal you are using, then run:
python --version # This should say 3.8.5, great job!
Poetry is a fantastic package manager for Python.
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
echo 'source $HOME/.poetry/env' >> ~/.zshrc
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python