Run a Python interpreter in the Datasette virtual environment
Install this plugin in the same environment as Datasette.
datasette install datasette-python
This plugin adds a new python
command to Datasette. This executes Python in the same virtual environment as Datasette itself.
You can use this to check the Python version
datasette python --version
# Should output 'Python 3.12.4' or similar
Or to run commands like pip
:
datasette python -m pip install httpx
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-python
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest