Last active
July 29, 2025 09:58
-
-
Save royratcliffe/cbb98a962e0cbffe0804f79a9c3395c5 to your computer and use it in GitHub Desktop.
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if IS_WINDOWS: | |
| import os | |
| os.environ['PATH'] += ';' + os.path.dirname(__file__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run a Python script in a virtual environment as superuser. | |
| sudo -E env PATH=$PATH python script.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Makefile for setting up Python virtual environment and installing dependencies | |
| .PHONY: all | |
| all: .venv pip-install | |
| # Create a Python virtual environment in the .venv directory | |
| # and install the required packages from requirements.txt | |
| # | |
| # Ensure that the virtual environment is created before installing packages | |
| .PHONY: .venv | |
| .venv: ; python3 -m venv .venv | |
| # Activate the virtual environment and install the required packages | |
| .PHONY: pip-install | |
| pip-install: requirements.txt ; pip install -r $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "debugpy.debugJustMyCode": false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment