Skip to content

ImperialCollegeLondon/solar_data_viewer

Repository files navigation

Solar Data Viewer

A Django web app for displaying solar weather data.

This is a Python application that uses uv for packaging and dependency management. It provides pre-commit hooks for various linters and formatters and automated tests using pytest and GitHub Actions. Pre-commit hooks are automatically kept updated with a dedicated GitHub Action, this can be removed and replaced with pre-commit.ci if using a public repo. The package version is dynamically generated from the most recent git tag using setuptools-scm.

It was developed by the Imperial College Research Software Engineering Team.

Usage

To get started:

  1. Download and install uv following the instructions for your OS.

  2. Activate a git repository (required for pre-commit and the package versioning with setuptools-scm):

    git init
  3. Install the package and dependencies and set up the virtual environment:

    uv sync
  4. Activate the virtual environment, or just preface your commands with uv run to use the virtual environment (see uv activate for more info):

    source .venv/bin/activate
    <command>

    or

    uv run <command>
  5. Install the pre-commit git hooks:

    pre-commit install
  6. Update the pre-commit hooks

    pre-commit autoupdate
  7. Run the web app:

    python manage.py runserver

    When running the webapp for the first time you may get a warning similar to:

    You have 19 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, main, sessions.

    If this is the case, stop your webapp (with CONTROL-C) and apply the migrations with:

    python manage.py migrate

    then restart it.

  8. Run the tests:

    pytest
  9. Create an initial commit (it's possible there might be some failures in pre-commit):

    git add .
    git commit -m "Initial commit"

Installation with Docker

The app can be run within a Docker container and a docker-compose.yml file is provided to make this easy for development.

Ensure you have Docker installed and simply run:

docker compose up

The app will be available at http://127.0.0.1:8000/ (or http://localhost:8000/).

Updating Dependencies

Use the commands uv add <package> and uv remove <package> to add or remove dependencies.

  • Use the optional flag --dev to add/remove development dependencies.
  • Include the optional flag --group <group-name> to add/remove dependencies from specific groups.
  • These will automatically update the pyproject.toml file.

For further information, see the uv docs for managing dependencies.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors