My man Corey Schafer has a video here on pipenv that combines virtualenv and pip
# packages only in dev environment
--dev
# remove a package
pipenv uninstall packageName
# update python version used to 3.6 from 3.7
# update value in pipfile
# recreate virtual environment
pipenv --python 3.6
# run python for current environment
pipenv run python
# check executable running from python
import sys
sys.executable
# You can also remove the environment completely and then recreate from scratch using the pip file
pipenv --rm
# and then create virtual environment that matches your pip file
pipenv install
# To activate this project's virtualenv, run
pipenv shell
#Alternatively, run a command inside the virtualenv with
pipenv run
# path to virtual environment
pipenv --venv
# easily check for known vulnerabilities
pipenv check
# display a dependency graph
pipenv graph
# push to exact versions of packages in production
# update pipfile.lock with current dependencies
pipenv lock
# install environment from pipfile.lock
# instead of from default pipfile
pipenv install --ignore-pipfile
# environment variables by creating .env file
pipenv run python
import os
os.environ['SECRET_KEY'] // returns value
! Do not commit the .env file
Docs here
Silos the environment with the “python3 -m venv env” command
pip install fastapi uvicorn sqlalchemy pymysql
Make sure environment is activated
Note: ran into a bunch of issues with typing.Annotated. Saw on Stack overflow here that “FastAPI 0.9.5 (released yesteday) adds support for dependencies and parameters using Annotated
.” So I tried upgrading from 0.70 to 0.100.1 which is the latest release.
This fixed the errors.
Sidenote: the fastapi docs said “Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette and Pydantic).”
Note: Revisited python in June 2022 after listening to some Wang and Oliphant on Lex Fridman podcast.
Upgraded interpreter from 3.7 to 3.10
Pycharm Community by Jetbrains: I have 2019.1.4 and to upgrade to 2022.1.1 is 3.4GB!? No Thank you I will stick with VSCode or current JetBrains.
Derek Banas 2 hour video here.
FastAPI Authentication with JWT by Bek Brace here
FastAPI with MySQL database by Eric Roby here
7 hour Django course on Traversy Channel