Cosmic Data Stories are online interactive resources for teaching the public data science skills. They are built on research-grade visualization tools like glue and WorldWide Telescope.
This repository is a monorepo for the Cosmic Data Stories project. It contains the code for the Cosmic Data Stories website, as well as the code for the individual stories.
Story Name | Description | Version |
---|---|---|
Hubble's Law | Explore the expansion of the universe using Hubble's Law | 0.1.0 |
To install a data story, clone or download this repository and navigate to the story directory. Note: it is recommended to install the stories in a virtual environment to avoid conflicts with other packages.
# Example install for Hubble's Law
cd cosmicds/packages/cds-hubble
pip install uv
uv pip install .
Developer setup is done using uv
, a Python package and project manager. To get started, follow these steps:
- Follow the
uv
installation instructions to installuv
. - If you use
conda
or have an activeconda
environment, it is recommended you disable it asuv
will create its own environment. You can do this by running:conda deactivate
conda
's auto-activation feature can also be disabled by running:which will ensure that theconda config --set auto_activate_base false
conda
base environment is not automatically activated when initiating a new terminal session. - Move to the top-level directory of the repository and run the following command to create a new
uv
environment:A new environment should now be defined in thecd cosmicds uv sync --all-packages
.venv
directory. - Activate the environment:
This environment can be referenced in your editor of choice by setting the interpreter to
source .venv/bin/activate
.venv/bin/python
.
All data stories should now be accessible by the command line. To start a story, run the following command:
<environment variables> solara run <story>.pages
# Example for Hubble's Law
SOLARA_SESSION_SECRET_KEY="..." \
SOLARA_OAUTH_CLIENT_ID="..." \
SOLARA_OAUTH_CLIENT_SECRET="..." \
SOLARA_OAUTH_API_BASE_URL="..." \
SOLARA_OAUTH_SCOPE="..." \
SOLARA_SESSION_HTTPS_ONLY=false \
CDS_API_KEY="..."
solara run cds_hubble.pages