Metadata-Version: 2.1
Name: datasette-python
Version: 0.1
Summary: Run a Python interpreter in the Datasette virtual environment
Author: Simon Willison
License: Apache-2.0
Project-URL: Homepage, https://github.com/datasette/datasette-python
Project-URL: Changelog, https://github.com/datasette/datasette-python/releases
Project-URL: Issues, https://github.com/datasette/datasette-python/issues
Project-URL: CI, https://github.com/datasette/datasette-python/actions
Classifier: License :: OSI Approved :: Apache Software License
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: datasette
Provides-Extra: test
Requires-Dist: pytest; extra == "test"

# datasette-python

[![PyPI](https://img.shields.io/pypi/v/datasette-python.svg)](https://pypi.org/project/datasette-python/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-python?include_prereleases&label=changelog)](https://github.com/datasette/datasette-python/releases)
[![Tests](https://github.com/datasette/datasette-python/workflows/Test/badge.svg)](https://github.com/datasette/datasette-python/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-python/blob/main/LICENSE)

Run a Python interpreter in the Datasette virtual environment

## Installation

Install this plugin in the same environment as [Datasette](https://datasette.io/).
```bash
datasette install datasette-python
```
## Usage

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

```bash
datasette python --version
# Should output 'Python 3.12.4' or similar
```
Or  to run commands like `pip`:
```bash
datasette python -m pip install httpx
```

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd datasette-python
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```
