Skip to content

Instantly share code, notes, and snippets.

@r0nny8000
Last active November 25, 2023 17:26
Show Gist options
  • Save r0nny8000/76039cf1770002c0bbe44cb13fc1d334 to your computer and use it in GitHub Desktop.
Save r0nny8000/76039cf1770002c0bbe44cb13fc1d334 to your computer and use it in GitHub Desktop.
Python Cheat Sheet

Python Cheat Sheet

Pyenv

List installed versions of Python

pyenv versions

List available versions of Python

pyenv install --list
pyenv install --list | grep 3.10

Install specific Python version

pyenv install 3.10.12

Switch Python version local and global

pyenv global 3.10.12
pyenv local 3.10.12

Show full path to the current version of python

pyenv which python

Poetry

Init Poetry with a new folder or try to use Poetry inside the folder.

poetry new dca-func

poetry install
poetry shell

Adding azure function as dependency to poetry from requirements.txt

poetry add azure-functions

Export Dependencies

poetry export -f requirements.txt --output requirements.txt --without-hashes

Switched Python Interpreter in Codium in .vscode/settings.json (or using CMD+Shift+P and "Select Interpreter")

which python

{
    "python.defaultInterpreterPath": "/Users/me/Library/Caches/pypoetry/virtualenvs/marketdata-cli-MiIDVtXc-py3.7/bin/python"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment