Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Continuous Delivery

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mbdata
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: snok/install-poetry@v1
with:
plugins: |
poetry-dynamic-versioning[plugin]
- run: poetry build
- uses: pypa/gh-action-pypi-publish@release/v1
15 changes: 4 additions & 11 deletions DEVELOPMENT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Clone the repository and setup virtualenv::
source venv/bin/activate
pip install poetry
poetry install
poetry self add 'poetry-dynamic-versioning[plugin]'

Updating SQL files and models
=============================
Expand All @@ -25,16 +26,8 @@ Run these scripts to update SQL files and rebuild SQLAlchemy models from them::
Release a new version
=====================

1. Change the version number in ``mbdata/__init__.py``.
1. Add notes to ``CHANGELOG.rst``

2. Add notes to ``CHANGELOG.rst``
2. Create a new Github release.

3. Tag the repository::

git tag -s vX.Y.Z

4. Upload the package to PyPI::

rm -rf dist/
python setup.py sdist
twine upload dist/mbdata-*.tar.gz
3. The publish workflow will build a new package distribution and upload it to pypi.
4 changes: 3 additions & 1 deletion mbdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (C) 2013 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.

__version__ = "30.0.0"
# automatically filled in and updated by poetry-dynamic-versioning plugin
# in distributions
__version__ = "0.0.0"
Comment on lines +4 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add references to the related docs at the bottom of your first commit message. Is it the one below?
https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#static-vs-dynamic-metadata

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the general pyproject.toml reference yes but this change is from poetry and poetry-dynamic-versioning specific. If we were using setuptools instead of poetry, this would be done differently.

Basically, poetry-dynamic-versioning plugin during build time substitutes the __version__ attribute with the current version in the sdist and the wheel. I can leave it an empty string here and the substitution would work fine but I chose to use 0.0.0 as that's the base version in pyproject.toml as well. The base version is an arbitrary version required by poetry in tool.poetry section. I have added references to both poetry's and poetry-dynamic-versioning plugin's documentation in the first commit.

75 changes: 56 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading