JSON API for DWD's open weather data.
Project description
Bright Sky
JSON API for DWD's open weather data.
The DWD (Deutscher Wetterdienst), as Germany's meteorological service, publishes a myriad of meteorological observations and calculations as part of their Open Data program.
Bright Sky is an open-source project aiming to make some of the more popular data — in particular weather observations from the DWD station network and weather forecasts from the MOSMIX model — available in a free, simple JSON API.
Looking for something specific?
I just want to retrieve some weather data
You can use the free public Bright Sky instance!
I want to run my own instance of Bright Sky
Check out the infrastructure repo!
I want to parse DWD weather files from the command line or in Python
The parsing core for Bright Sky is maintained in a separate package named
dwdparse, which has no dependencies
outside the standard library. If you find that's not quite serving your needs,
check out wetterdienst.
I want to contribute to Bright Sky's source code
Read on. :)
On Bright Sky's versioning
Starting from version 2.0, where we extracted the parsing core into a separate
package, Bright Sky is no longer
intended to be used as a Python library, but only as the service available at
brightsky.dev.
Consequentially, we adjust our version numbers from the perspective of that
service and its users – i.e., we will increase the major version number only
when we introduce backwards-incompatible (or otherwise very major) changes to
the actual JSON API interface, e.g. by changing URLs or parameters. This means
that increases of the minor version number may introduce
backwards-incompatible changes to the internals of the brightsky package,
including the database structure. If you use brightsky as a Python library,
please version-pin to a minor version, e.g. by putting brightsky==2.0.* in
your requirements.txt.
Quickstart
Running a full-fledged API instance
Note: These instructions are aimed at running a Bright Sky instance for development and testing. Check out our infrastructure repository if you want to set up a production-level API instance.
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.
Architecture
Bright Sky is a rather simple project consisting of four components:
-
The
brightskyworker, which leverages the logic contained in thebrightskyPython 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
brightskywebserver (API), 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:
sourcescontains information on the locations for which we hold weather records, andweathercontains the history of actual meteorological measurements (or forecasts) for these locations.
The database structure can be set up by running the
migratecommand, which will simply apply all.sqlfiles found in themigrationsfolder. -
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:
-
Create a virtual environment and install our dependencies:
python -m virtualenv .venv && source .venv/bin/activate && pip install -r requirements.txt && pip install -e . -
Start a PostgreSQL container:
docker-compose run --rm -p 5432:5432 postgres -
Start a Redis container:
docker-compose run --rm -p 6379:6379 redis -
Point
brightskyto your containers, and configure a tighter date threshold for parsing DWD data, by adding the following.envfile: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.
Tests
Large parts of our test suite run against a real Postgres database. By default,
these tests will be skipped. To enable them, make sure the
BRIGHTSKY_DATABASE_URL environment variable is set when calling pytest,
e.g. via:
BRIGHTSKY_DATABASE_URL=postgres://postgres:pgpass@localhost/brightsky_test pytest
Beware that adding this environment variable to your .env file will not work
as that file is not read by pytest. The database will be dropped and
recreated on every test run, so don't use your normal Bright Sky database. ;)
Acknowledgements
Bright Sky's development is boosted by the priceless guidance and support of the Open Knowledge Foundation's Prototype Fund program, and is generously funded by Germany's Federal Ministry of Education and Research. Obvious as it may be, it should be mentioned that none of this would be possible without the painstaking, never-ending effort of the Deutscher Wetterdienst.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brightsky-2.2.7.tar.gz.
File metadata
- Download URL: brightsky-2.2.7.tar.gz
- Upload date:
- Size: 48.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38fe9c8f4c1d9272126c6ab34fea1c6db4defb02520d9c6ff2361d3f06ddfe52
|
|
| MD5 |
4bf0a3da146ba80f1d6ad0ffb41a6e9c
|
|
| BLAKE2b-256 |
13eb2c8495e6410fec08358d1444368ef98c8ca9af330b006e3c029f424eb145
|
Provenance
The following attestation bundles were made for brightsky-2.2.7.tar.gz:
Publisher:
main.yml on jdemaeyer/brightsky
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brightsky-2.2.7.tar.gz -
Subject digest:
38fe9c8f4c1d9272126c6ab34fea1c6db4defb02520d9c6ff2361d3f06ddfe52 - Sigstore transparency entry: 628441268
- Sigstore integration time:
-
Permalink:
jdemaeyer/brightsky@18469397b76537e5934978392729e1911be20d02 -
Branch / Tag:
refs/tags/v2.2.7 - Owner: https://github.com/jdemaeyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@18469397b76537e5934978392729e1911be20d02 -
Trigger Event:
push
-
Statement type:
File details
Details for the file brightsky-2.2.7-py3-none-any.whl.
File metadata
- Download URL: brightsky-2.2.7-py3-none-any.whl
- Upload date:
- Size: 41.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb4066c26b7db66c0447633db41cdb4ef91e6adb5247f1de029f3f3651992e08
|
|
| MD5 |
977168c8a188dfd8b61c675861d36d9d
|
|
| BLAKE2b-256 |
20a433bb2e869e601e5910784dd861dae709136bcea7c516d9cccaa94d678bda
|
Provenance
The following attestation bundles were made for brightsky-2.2.7-py3-none-any.whl:
Publisher:
main.yml on jdemaeyer/brightsky
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brightsky-2.2.7-py3-none-any.whl -
Subject digest:
eb4066c26b7db66c0447633db41cdb4ef91e6adb5247f1de029f3f3651992e08 - Sigstore transparency entry: 628441278
- Sigstore integration time:
-
Permalink:
jdemaeyer/brightsky@18469397b76537e5934978392729e1911be20d02 -
Branch / Tag:
refs/tags/v2.2.7 - Owner: https://github.com/jdemaeyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@18469397b76537e5934978392729e1911be20d02 -
Trigger Event:
push
-
Statement type: