Skip to main content

JSON API for DWD's open weather data.

Project description

Bright Sky

JSON API for DWD's open weather data.

API Documentation: https://brightsky.dev/

Quickstart

Just run docker-compose up and you should be good to go. This will set up a PostgreSQL database (with persistent storage in .data), run a Redis server, and start the Bright Sky worker and webserver. The worker periodically polls the DWD Open Data Server for updates, parses them, and stores them in the database. The webserver will be listening to API requests on port 5000.

Overview

Bright Sky is a rather simple project consisting of four components:

  • The brightsky worker, which leverages the logic contained in the brightsky Python package to retrieve weather records from the DWD server, parse them, and store them in a database. It will periodically poll the DWD servers for new data.

  • The brightsky webserver, which serves as gate to our database and processes all queries for weather records coming from the outside world.

  • A PostgreSQL database consisting of two relevant tables:

    • sources contains information on the locations for which we hold weather records, and
    • weather contains the history of actual meteorological measurements (or forecasts) for these locations.

    The database structure can be set up by running the migrate command, which will simply apply all .sql files found in the migrations folder.

  • A Redis server, which is used as the backend of the worker's task queue.

Most of the tasks performed by the worker and webserver can also be performed independently. Run docker-compose run --rm brightsky to get a list of available commands.

Hacking

Constantly rebuilding the brightsky container while working on the code can become cumbersome, and the default setting of parsing records dating all the way back to 2010 will make your development database unnecessarily large. You can set up a more lightweight development environment as follows:

  1. Create a virtual environment and install our dependencies: python -m virtualenv .venv && source .venv/bin/activate && pip install -r requirements.txt && pip install -e .

  2. Start a PostgreSQL container: docker-compose run --rm -p 5432:5432 postgres

  3. Start a Redis container: docker-compose run --rm -p 6379:6379 redis

  4. Point brightsky to your containers, and configure a tighter date threshold for parsing DWD data, by adding the following .env file:

    BRIGHTSKY_DATABASE_URL=postgres://postgres:pgpass@localhost
    BRIGHTSKY_BENCHMARK_DATABASE_URL=postgres://postgres:pgpass@localhost/benchmark
    BRIGHTSKY_REDIS_URL=redis://localhost
    BRIGHTSKY_MIN_DATE=2020-01-01
    

You should now be able to directly run brightsky commands via python -m brightsky, and changes to the source code should be effective immediately.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brightsky-0.9.3.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

brightsky-0.9.3-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file brightsky-0.9.3.tar.gz.

File metadata

  • Download URL: brightsky-0.9.3.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for brightsky-0.9.3.tar.gz
Algorithm Hash digest
SHA256 7de12b3780b2ae406a1cd00598a11887d136b3774f8dae17051867375f440bb2
MD5 787f6265ffcae21a16a5798ccfe06b48
BLAKE2b-256 a95b5c7a34080499d31ef1d1a67a32bf96e9341792786a5be0f09cba73c324ad

See more details on using hashes here.

Provenance

File details

Details for the file brightsky-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: brightsky-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for brightsky-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a00b251c71168df0ffde8a390d59dafe880026bf30f6c2ceee3371a6c2825b71
MD5 0c0806eecf094ad9c8d213c1d429cf75
BLAKE2b-256 2611d282c2f920d4d71cf7debdbb93c074bca5077cfd515bdfcc407acb8f40bc

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page