Skip to content

Commit

Permalink
Merge pull request #514 from OpenEnergyPlatform/release-v0.14.3
Browse files Browse the repository at this point in the history
Release v0.14.3
  • Loading branch information
FlorianK13 authored Apr 24, 2024
2 parents 2f623f3 + d2d2dec commit f18ecac
Show file tree
Hide file tree
Showing 18 changed files with 230 additions and 145 deletions.
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.14.2
current_version = 0.14.3
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>(a|na))+(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}{release}{build}
Expand All @@ -15,7 +15,7 @@ values =
[bumpversion:part:build]
first_value = 1

[bumpversion:file:setup.py]
[bumpversion:file:pyproject.toml]

[bumpversion:file:./.github/workflows/ci-production.yml]

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI - Pytest Develop

on:
workflow_dispatch:
Expand All @@ -15,14 +15,14 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.9, '3.10']
python-version: ['3.10', '3.11', '3.12']
name: pytest (Python ${{ matrix.python-version }}) (OS ${{ matrix.os }})

# Configure tests
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI - Pytest Production

on:
workflow_dispatch:
Expand All @@ -15,23 +15,24 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.9, '3.10']
python-version: ['3.10', '3.11', '3.12']
name: pytest (Python ${{ matrix.python-version }}) (OS ${{ matrix.os }})

# Configure tests
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: create package
run: python setup.py sdist
run: python -m build --sdist
- name: import open-mastr
run: python -m pip install ./dist/open_mastr-0.14.2.tar.gz
run: python -m pip install ./dist/open_mastr-0.14.3.tar.gz
- name: Create credentials file
env:
MASTR_TOKEN: ${{ secrets.MASTR_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- test-release # update setup.py version number with bump2version (implemented in #407)
- test-release # update pyproject.toml version number

jobs:
build-n-publish:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ For each version important additions, changes and removals are listed here.
The format is inspired from [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [v0.14.3] Fix Pypi Release - 2024-04-24
### Added
- Add new table `changed_dso_assignment` [#510](https://github.com/OpenEnergyPlatform/open-MaStR/pull/510)
- Add deprecation warning for `MaStRMirror` and `MaStRDownload` [#492](https://github.com/OpenEnergyPlatform/open-MaStR/pull/492)
### Changed
- Change from `setup.py` to `pyproject.toml` based installation [#513](https://github.com/OpenEnergyPlatform/open-MaStR/pull/513)
### Removed
- Remove outdated and deprecated dependencies [#506](https://github.com/OpenEnergyPlatform/open-MaStR/pull/506)

## [v0.14.2] Maintenance - 2024-04-10
### Changed
- Fix and add URLs of example projects in readme [#481](https://github.com/OpenEnergyPlatform/open-MaStR/pull/481)
Expand All @@ -16,6 +26,7 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/
### Removed
- Remove unused Docker File [#501](https://github.com/OpenEnergyPlatform/open-MaStR/pull/501)


## [v0.14.1] Hotfix - 2024-01-17
### Changed
- Change data type of NetzbetreiberpruefungStatus to string [#483](https://github.com/OpenEnergyPlatform/open-MaStR/pull/483)
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ authors:
title: "open-MaStR"
type: software
license: AGPL-3.0
version: 0.14.2
version: 0.14.3
doi:
date-released: 2024-04-10
date-released: 2024-04-24
url: "https://github.com/OpenEnergyPlatform/open-MaStR/"
15 changes: 8 additions & 7 deletions RELEASE_PROCEDURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
### 3. 🐙 Create a `Draft GitHub Release`
* [Draft a new release](https://github.com/OpenEnergyPlatform/open-MaStR/releases/new)
* Enter the release version number `v0.12.1` as title
* Summarize key changes in the description
* Use the `generate release notes` button provided by github (This might only work after the release branch is merged on production)
* Save draft

### 4. 🐙 Finish all planned Developments
Expand All @@ -52,7 +50,7 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.

### 5. 💠 Create a `release` branch
* Checkout `develop` and branch with `git checkout -b release-v0.12.1`
* Update version for test release with e.g. `bump2version patch`. To specify version numbers manually use `bump2version --current-version <current_version> --new-version <new_version> patch`
* Update version for test release with `bump2version --current-version <current_version> --new-version <new_version> patch`
* Commit version update with `git commit -am "version update v0.12.1a1"`
* Push branch with `git push --set-upstream origin release-v0.12.1`

Expand All @@ -77,11 +75,11 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
### 8. 🐙 Create a `Release Pull Request`
* Use `📝PR_TEMPLATE_RELEASE` (❗ToDo❗)
* Merge `release` into `production` branch
* Assign two reviewers to check the release
* Assign reviewers to check the release
* Run all test
* Execute the software locally
* Wait for reviews and tests
* Merge PR and delete `release` branch
* Merge PR

### 9. 💠 Set the `Git Tag`
* Checkout `production` branch and pull
Expand All @@ -96,6 +94,7 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
### 10. 🐙 Publish `Release` on GitHub and PyPI
* Navigate to your [releases](https://github.com/OpenEnergyPlatform/open-MaStR/releases/) on GitHub and open your draft release.
* Summarize key changes in the description
* Use the `generate release notes` button provided by github (This only works after the release branch is merged on production)
* Choose the correct git `tag`
* Choose the `production` branch
* Publish release
Expand All @@ -105,19 +104,21 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
▶️ In the background the GitHub workflow (pypi-publish.yml) will publish the package 📦 on PyPI!

### 11. 🐙 Set up new development
* Create a Pull request from `production` to `develop`
* Create a Pull request from `release-*` to `develop`
* Create a new **unreleased section** in the `📝CHANGELOG.md`
```
## [v0.XX.X] unreleased
### Added
### Changed
### Removed
```
* Merge `release-*` to `develop` and delete `release-*` branch

▶️ Continue the developments 🛠

## Documentation on Read the Docs (RTD)
ToDo
* ReadTheDocs triggers a new built automatically after the release on github. To see
the build status, visit https://readthedocs.org/projects/open-mastr/builds/


## Sources:
Expand Down
2 changes: 2 additions & 0 deletions docs/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ After downloading the MaStR, you will find a database with a large number of tab
| Table name | Comments |
|------|------|
| balancing_area | *Related to the energy market* |
| changed_dso_assignment | *Units where the DSO responsibility changed* |
| electricity_consumer | *Only large consumers* |
| gas_consumer | *Only large consumers* |
| gas_producer | |
Expand All @@ -81,6 +82,7 @@ After downloading the MaStR, you will find a database with a large number of tab
| storage_units | |
| kwk | *short for: Combined heat and power (CHP)* |


### MaStR data model
A useful overview of the MaStR data model can be found [here (in german)](https://www.marktstammdatenregister.de/MaStRHilfe/files/webdienst/Objektmodell%20-%20Fachliche%20Ansicht%20V1.2.0.pdf). A translated version using the names from the tables you can find in your local database is presented here:

Expand Down
16 changes: 10 additions & 6 deletions open_mastr/mastr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ class Mastr:
A SQL database is used to mirror the MaStR database. It can be filled with
data either from the MaStR-bulk download or from the MaStR-API.
!!! example
```python
from open_mastr import Mastr
db = Mastr()
db.download()
```
Parameters
----------
engine : {'sqlite', sqlalchemy.engine.Engine}, optional
Expand All @@ -63,13 +72,8 @@ class Mastr:
Allows connection to an existing translated database. Default is 'False'.
Only for 'sqlite'-type engines.
!!! example
```python
from open_mastr import Mastr
db = Mastr()
db.download()
```
"""

def __init__(self, engine="sqlite", connect_to_translated_db=False) -> None:
Expand Down
64 changes: 43 additions & 21 deletions open_mastr/soap_api/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,14 @@ def _missed_units_to_file(data, data_type, missed_units):


class MaStRDownload:
"""Use the higher level interface for bulk download
"""
!!! warning
**This class is deprecated** and will not be maintained from version 0.15.0 onwards.
Instead use [`Mastr.download`][open_mastr.Mastr.download] with parameter
`method` = "bulk" to get bulk downloads of the dataset.
Use the higher level interface for bulk download
`MaStRDownload` builds on top of [`MaStRAPI`][open_mastr.soap_api.download.MaStRAPI] and provides
an interface for easier downloading.
Expand Down Expand Up @@ -451,6 +458,17 @@ def __init__(self, parallel_processes=None):
multiprocessing package) choose False.
Defaults to number of cores (including hyperthreading).
"""
log.warn(
"""
The `MaStRDownload` class is deprecated and will not be maintained in the future.
To get a full table of the Marktstammdatenregister, use the open_mastr.Mastr.download
method.
If this change causes problems for you, please comment in this issue on github:
https://github.com/OpenEnergyPlatform/open-MaStR/issues/487
"""
)

# Number of parallel processes
if parallel_processes == "max":
Expand Down Expand Up @@ -762,26 +780,30 @@ def basic_unit_data(self, data=None, limit=2000, date_from=None, max_retries=3):
log.info(
f"Get list of units with basic information for data type {data} ({et})"
)
yield from basic_data_download(
self._mastr_api,
"GetListeAlleEinheiten",
"Einheiten",
chunks_start,
limits,
date_from,
max_retries,
data,
et=et,
) if et is None else basic_data_download(
self._mastr_api,
"GetGefilterteListeStromErzeuger",
"Einheiten",
chunks_start,
limits,
date_from,
max_retries,
data,
et=et,
yield from (
basic_data_download(
self._mastr_api,
"GetListeAlleEinheiten",
"Einheiten",
chunks_start,
limits,
date_from,
max_retries,
data,
et=et,
)
if et is None
else basic_data_download(
self._mastr_api,
"GetGefilterteListeStromErzeuger",
"Einheiten",
chunks_start,
limits,
date_from,
max_retries,
data,
et=et,
)
)

def additional_data(self, data, unit_ids, data_fcn, timeout=10):
Expand Down
19 changes: 19 additions & 0 deletions open_mastr/soap_api/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

class MaStRMirror:
"""
!!! warning
**This class is deprecated** and will not be maintained from version 0.15.0 onwards.
Instead use [`Mastr.download`][open_mastr.Mastr.download] with parameter
`method` = "bulk" to mirror the MaStR dataset to a local database.
Mirror the Marktstammdatenregister database and keep it up-to-date.
A PostgreSQL database is used to mirror the MaStR database. It builds
Expand Down Expand Up @@ -93,6 +99,18 @@ def __init__(
Number of parallel processes used to download additional data.
Defaults to `None`.
"""
log.warn(
"""
The `MaStRMirror` class is deprecated and will not be maintained in the future.
To get a full table of the Marktstammdatenregister, use the open_mastr.Mastr.download
method.
If this change causes problems for you, please comment in this issue on github:
https://github.com/OpenEnergyPlatform/open-MaStR/issues/487
"""
)

self._engine = engine

# Associate downloader
Expand Down Expand Up @@ -979,6 +997,7 @@ def restore(self, dumpfile):
!!! warning
If tables that are restored from the dump contain data, restore doesn't work!
"""
Expand Down
5 changes: 5 additions & 0 deletions open_mastr/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"permit",
"deleted_units",
"retrofit_units",
"changed_dso_assignment",
]

# Possible values for parameter 'data' with API download method
Expand Down Expand Up @@ -62,6 +63,7 @@
"permit",
"deleted_units",
"retrofit_units",
"changed_dso_assignment",
]

# Possible data types for API download
Expand Down Expand Up @@ -102,6 +104,7 @@
"permit": ["einheitengenehmigung"],
"deleted_units": ["geloeschteunddeaktivierteeinheiten"],
"retrofit_units": ["ertuechtigungen"],
"changed_dso_assignment": ["einheitenaenderungnetzbetreiberzuordnungen"],
}

# Map bulk data to database table names, for csv export
Expand All @@ -120,6 +123,7 @@
"permit": ["permit"],
"deleted_units": ["deleted_units"],
"retrofit_units": ["retrofit_units"],
"changed_dso_assignment": ["changed_dso_assignment"],
}

# used to map the parameter options in open-mastr to the exact table class names in orm.py
Expand Down Expand Up @@ -176,6 +180,7 @@
"permit": "Permit",
"deleted_units": "DeletedUnits",
"retrofit_units": "RetrofitUnits",
"changed_dso_assignment": "ChangedDSOAssignment",
}

UNIT_TYPE_MAP = {
Expand Down
Loading

0 comments on commit f18ecac

Please sign in to comment.