Demonstration of Python workflow with Github, venv, and VSCode using (what I understand to be) best practices.
- create remote repository (with Python
.gitignore
template) - clone from remote repo + open project in VSCode
- install/verify python installation with
brew install [email protected]
on Mac - create virtual environment with
venv
usingpython3.X -m venv .venv
- associate the
.venv
folder with the project in VSCode (cmd + shift + p
to open command palette >Python: Select Interpreter
) pip install
any packages you needpip freeze > requirements.txt
to export a list of installad packages- create your Python file .py
- run
python
in 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 status
to see status of local repository (with comparison to remote)git add .
to add all untracked/changed filesgit commit -m "<commitmessage>"
to commit changes locallygit push
to push to the remote repository (origin
by default)
git remote -v
to list remote repo URLs