Skip to content

Commit

Permalink
Merge pull request #378 from OpenEnergyPlatform/release-v0.12.1
Browse files Browse the repository at this point in the history
Release v0.12.1
  • Loading branch information
chrwm authored Nov 15, 2022
2 parents 19a5db1 + 5bf6077 commit a826d15
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: create package
run: python setup.py sdist
- name: import open-mastr
run: python -m pip install ./dist/open_mastr-0.12.0.tar.gz
run: python -m pip install ./dist/open_mastr-0.12.1.tar.gz
- name: Create credentials file
env:
MASTR_TOKEN: ${{ secrets.MASTR_TOKEN }}
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build 📦 and release on pypi

on:
release:
types: [published]

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment: pypi-publish
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI }}
38 changes: 38 additions & 0 deletions .github/workflows/test-pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and release on pypi tests

on:
push:
branches:
- test-release # update setup.py version number manually before pushing to branch workflow
- 'release-*' # update setup.py version number manually before pushing to branch workflow

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
environment: pypi-publish
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TEST }}
repository_url: https://test.pypi.org/legacy/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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.12.1] Patch release - 2022-11-15
### Added
- Add workflows to release on PyPI and Test-PyPI [#375](https://github.com/OpenEnergyPlatform/open-MaStR/pull/375)
### Changed
- Change error handling for missing tables in postgres [#370](https://github.com/OpenEnergyPlatform/open-MaStR/pull/370)


## [v0.12.0] Minor Release - 2022-11-07

### Added
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ authors:
title: "open-MaStR"
type: software
license: AGPL-3.0
version: 0.12.0
version: 0.12.1
doi:
date-released: 2022-11-07
url: "https://github.com/OpenEnergyPlatform/open-MaStR/"
date-released: 2022-11-15
url: "https://github.com/OpenEnergyPlatform/open-MaStR/"
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.. figure:: https://user-images.githubusercontent.com/14353512/199113556-4b53660f-c628-4138-8d01-3719595ecda1.png
.. image:: https://user-images.githubusercontent.com/14353512/199113556-4b53660f-c628-4138-8d01-3719595ecda1.png
:align: left
:target: https://github.com/OpenEnergyPlatform/open-MaStR
:alt: MaStR logo
Expand Down Expand Up @@ -54,7 +54,7 @@ Documentation
=============

| The documentation is in `sphinx <http://www.sphinx-doc.org/en/stable/>`_ reStructuredText format in the ``doc`` sub-folder of the repository.
| Find the `documentation <https://open-mastr.readthedocs.io/en/dev>`_ hosted on ReadTheDocs.
| Find the `documentation <https://open-mastr.readthedocs.io/en/latest/>`_ hosted on ReadTheDocs.
| The original API documentation can be found on the `Webhilfe des Marktstammdatenregisters <https://www.marktstammdatenregister.de/MaStRHilfe/subpages/webdienst.html>`_.
| If you are interested in browsing the MaStR online, check out the privately hosted `Marktstammdatenregister.dev <https://marktstammdatenregister.dev/>`_.
Expand Down
59 changes: 29 additions & 30 deletions RELEASE_PROCEDURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
## GitHub and PyPI Release

### 1. 🐙 Create a `GitHub Issue`
* Named `Release Patch v0.11.7`
* Named `Release Patch v0.12.1`
* Use `📝ISSUE_TEMPLATE_RELEASE` (❗ToDo❗)
* Discuss a good and suitable name of the release
* Define a day for the release
Expand All @@ -31,22 +31,22 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
### 2. 🐙 Create a `GitHub Project`
* Create [New classic project](https://github.com/OpenEnergyPlatform/open-MaStR/projects?type=classic)
* Use the project template *Automated kanban with reviews*
* Named `Release v0.11.7`
* Named `Release v0.12.1`
* Add a meaningful description
* Track project progress

▶️ It gives an overview of open and finished issues and pull requests!

### 3. 🐙 Create a `Draft GitHub Release`
* [Draft a new release](https://github.com/OpenEnergyPlatform/open-MaStR/releases/new)
* Enter the release version number `v0.11.7` as title
* Enter the release version number `v0.12.1` as title
* Summarize key changes in the description
* `## [v0.11.7] Patch - Name - Date`
* `## [v0.12.1] Patch - Name - Date`
* `### Added`
* `### Changed`
* `### Removed`
* Add a link to compare versions
* `**Compare versions:** [v0.11.6 - v0.11.7](https://github.com/OpenEnergyPlatform/open-MaStR/compare/v0.11.6...v0.11.7)`
* `**Compare versions:** [v0.12.0 - v0.12.1](https://github.com/OpenEnergyPlatform/open-MaStR/compare/v0.12.0...v0.12.1)`
* Add a link to the `📝CHANGELOG.md`
* `Also see [**CHANGELOG.md**](https://github.com/OpenEnergyPlatform/open-MaStR/blob/production/CHANGELOG.md)`
* Save draft
Expand All @@ -58,10 +58,19 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
* Merge everything on the `develop` branch

### 5. 💠 Create a `release` branch
* Checkout `develop` and branch with `git checkout -b release-v0.11.7`
* Push branch with `git push --set-upstream origin release-v0.11.7`
* Checkout `develop` and branch with `git checkout -b release-v0.12.1`
* Push branch with `git push --set-upstream origin release-v0.12.1`

### 6. 📝 Update the version files
### 6. Check release on Test-PyPI

* Check if the release it correctly displayed on [Test-PyPI](https://test.pypi.org/project/open-mastr/#history)
* With each push to the release branch or the branch `test-release` the package is released on [Test-PyPI](https://test.pypi.org/project/open-mastr/#history) by GitHub workflow (test-pypi-publish.yml).
* Note: Pre-releases on Test-PyPI are only shown under `Release history` in the navigation bar.
* Note: The branch status can only be released to a version on Test-PyPI once. Thus, for every branch status that you want to see on Test-PyPI you'll need to increase the version in `📝setup.py` to a number that has not been released on Test-PyPI yet, otherwise the workflow fails. Use alpha-versioning, e.g. `v0.12.1a1`, `v0.12.1a2`,...
* Once testing on Test-PyPI is done, change the release version to the final desired version in `📝setup.py`, e.g. `v0.12.1`
* Note: The release on Test-PyPI might fail but it will be the correct release version for the PyPI server.

### 7. 📝 Update the version files
* `📝CHANGELOG.md`
* All Pull Request are included
* Add a new section with correct version number
Expand All @@ -71,52 +80,42 @@ It always has the format `YYYY-MM-DD`, e.g. `2022-05-16`.
* Update `date-released`
* `📝setup.py`
* Update `version`
* Update `download_url` (.../v0.11.7.tar.gz)
* Update `download_url` (.../v0.12.1.tar.gz)
* `📝ci-production.yml`
* Update version number in `run` command (line 36)

### 7. 🐙 Create a `Release Pull Request`
### 8. 🐙 Create a `Release Pull Request`
* Use `📝PR_TEMPLATE_RELEASE` (❗ToDo❗)
* Merge `release` into `production` branch
* Assign two reviewers to check the release
* Run all test
* Execute the software locally
* Wait for reviews and tests
* Merge PR but do not delete `release` branch
* Merge PR and delete `release` branch

### 8. 💠 Set the `Git Tag`
### 9. 💠 Set the `Git Tag`
* Checkout `production` branch and pull
* Check existing tags `git tag -n`
* Create new tag: `git tag -a v0.11.7 -m "super-repo Patch Release v0.11.7 with PyPI"`
* Create new tag: `git tag -a v0.12.1 -m "open-mastr release v0.12.1 with PyPI"`
* This commit will be the final version for the release, breath three times and check again
* Push tag: `git push --tags`
* If you messed up, remove tags and start again
* Delete local tag: `git tag -d v0.11.7`
* Delete remote tag: `git push --delete origin v0.11.7`

### 9. 💻 Create and publish package on PyPI
* Navigate to git folder `cd D:\git\github\GROUP\REPO\`
* Create package using `python setup.py sdist`
* Check that file has been created in folder `dist`
* Activate python environment `activate release_py38`
* Upload to PyPI using `twine upload dist/NAME_0.5.1.tar.gz`
* Enter `name` and `password`
* Check on PyPI if release arrived
* Breath three times and smile

▶️ Publish the Package 📦

### 10. 🐙 Publish `GitHub Release`
* Delete local tag: `git tag -d v0.12.1`
* Delete remote tag: `git push --delete origin v0.12.1`

### 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
* Choose the correct git `tag`
* Choose the `production` branch
* Publish release

▶️ Release on GitHub!

▶️ 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`
* Delete the `release` branch
* Create a new **unreleased section** in the `📝CHANGELOG.md`

▶️ Continue the developments 🛠
Expand Down
6 changes: 3 additions & 3 deletions open_mastr/mastr.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def download(
self,
method="bulk",
data=None,
date="today",
date=None,
bulk_cleansing=True,
api_processes=None,
api_limit=50,
Expand Down Expand Up @@ -129,9 +129,9 @@ def download(
date: None or :class:`datetime.datetime` or str, optional
For bulk method:
Either "today" if the newest data dump should be downloaded from the MaStR website. If
Either "today" or None if the newest data dump should be downloaded from the MaStR website. If
an already downloaded dump should be used, state the date of the download in the format
"yyyymmdd". Default to "today".
"yyyymmdd". Defaults to None.
For API method:
Expand Down
7 changes: 5 additions & 2 deletions open_mastr/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def validate_parameter_api_limit(api_limit) -> None:


def validate_parameter_date(method, date) -> None:
if date is None: # default
return
if method == "bulk":
if date != "today":
try:
Expand All @@ -183,7 +185,7 @@ def validate_parameter_date(method, date) -> None:
"or 'today' for bulk method."
) from e
elif method == "API":
if not isinstance(date, datetime) and date not in ["latest", None]:
if not isinstance(date, datetime) and date != "latest":
raise ValueError(
"parameter api_date has to be 'latest' or a datetime object or 'None' for API method."
)
Expand Down Expand Up @@ -232,7 +234,7 @@ def raise_warning_for_invalid_parameter_combinations(
api_limit,
api_chunksize,
):
if method == "API" and (bulk_cleansing is not True or date != "today"):
if method == "API" and bulk_cleansing is not True:
warn(
"For method = 'API', bulk download related parameters "
"(with prefix bulk_) are ignored."
Expand Down Expand Up @@ -296,6 +298,7 @@ def transform_date_parameter(method, date, **kwargs):

if method == "bulk":
date = kwargs.get("bulk_date", date)
date = "today" if date is None else date
elif method == "API":
date = kwargs.get("api_date", date)

Expand Down
Loading

0 comments on commit a826d15

Please sign in to comment.