Demonstration of Python workflow with Github, venv, and VSCode using (what I understand to be) best practices.
- create remote repository (with Python
.gitignoretemplate) - clone from remote repo + open project in VSCode
- install/verify python installation with
brew install [email protected]on Mac - create virtual environment with
venvusingpython3.X -m venv .venv - associate the
.venvfolder with the project in VSCode (cmd + shift + pto open command palette >Python: Select Interpreter) pip installany packages you needpip freeze > requirements.txtto export a list of installad packages- create your Python file .py
- run
pythonin the terminal to start an interactive session using.venv - run the Python command
with open('<pythonfilename>.py', 'r') as f: exec(f.read())to execute your Python file interactively, i.e., with all variables and results in memory
git statusto see status of local repository (with comparison to remote)git add .to add all untracked/changed filesgit commit -m "<commitmessage>"to commit changes locallygit pushto push to the remote repository (originby default)
git remote -vto list remote repo URLs