datasette-codespaces by simonw

53 downloads this week        Star

README source code

datasette-codespaces

PyPI Changelog Tests License

Conveniences for running Datasette on GitHub Codespaces

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-codespaces

Tutorial

Using Datasette in GitHub Codespaces provides a detailed tutorial introduction to this plugin.

Usage

Install this when you are using Datasette inside of GitHub Codespaces. It makes the following changes:

  • All requests will identified as representing the root actor - provided Datasette is running inside Codespaces. This is detected through the presence of the CODESPACE_NAME environment variable. GitHub restricts access to servers running in the Codespaces environment based on GitHub authentication, so treating all requests as root should be acceptably secure.
  • The datasette-x-forwarded-host plugin will be installed, ensuring links to other pages within Datasette such as facet navigation work correctly.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-codespaces
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest