Skip to content

Commit

Permalink
feat(ci): migrate to poetry-publish action
Browse files Browse the repository at this point in the history
- Switch from twine to poetry for package publishing
- Add automatic version sync between GitHub releases and package
- Consolidate build system to poetry-core

To release: create GitHub release with tag vX.Y.Z
  • Loading branch information
Molier committed Jan 30, 2025
1 parent c20b3ef commit 113c37e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 68 deletions.
42 changes: 13 additions & 29 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Build and Publish Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
environment: release

contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- uses: actions/checkout@v4

- name: Publish PyPI package
uses: cadifyai/poetry-publish@v0.1.0
with:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.7.1"
POETRY_CORE_VERSION: "1.8.1"
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_REGISTRY_PASSWORD: ${{ secrets.PYPI_TOKEN }}
64 changes: 25 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[project]
dynamic = ["version"]
[tool.poetry]
name = "openenergyid"
version = "0.1.21"
description = "Open Source Python library for energy analytics and simulations"
authors = [
{ name = "Jan Pecinovsky", email = "jan@energieid.be" },
{ name = "Max Helskens", email = "max@energieid.be" },
"Jan Pecinovsky <jan@energieid.be>",
"Max Helskens <max@energieid.be>",
"Oscar Swyns <oscar@energieid.be>"
]
maintainers = [{ name = "Jan Pecinovsky", email = "jan@energieid.be" }]
description = "Open Source Python library for energy analytics and simulations"
readme = "README.md"
license = { file = "LICENSE" }
license = "MIT"
homepage = "https://energyid.eu"
repository = "https://github.com/EnergieID/OpenEnergyID"
documentation = "https://github.com/EnergieID/OpenEnergyID"
keywords = ["energy", "analytics", "simulation"]
classifiers = [
"Development Status :: 3 - Alpha",
Expand All @@ -25,38 +28,18 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries :: Python Modules"
]

[project.urls]
Homepage = "https://energyid.eu"
Repository = "https://github.com/EnergieID/OpenEnergyID"
"Bugs Tracker" = "https://github.com/EnergieID/OpenEnergyID/issues"

[tool.hatch.version]
path = "openenergyid/__init__.py"

[tool.ruff]
line-length = 100


[tool.poetry]
name = "openenergyid"
version = "0.1.21" # You'll need to set this manually or use a different method for dynamic versioning
description = "Open Source Python library for energy analytics and simulations"
authors = [
"Jan Pecinovsky <jan@energieid.be>",
"Max Helskens <max@energieid.be>",
"Oscar Swyns <oscar@energieid.be>",
]
dependencies.python = "^3.11"
dependencies.pandera = {extras = ["polars"], version = "^0.22.1"}
dependencies.polars = "^1.9.0"
dependencies.numpy = "^2.0.0"
dependencies.patsy = "^0.5.6"
dependencies.statsmodels = "^0.14.2"
dependencies.pydantic = "^2.8.2"
dependencies.pandas = "^2.2.2"
[tool.poetry.dependencies]
python = "^3.11"
polars = "^1.9.0"
numpy = "^2.0.0"
patsy = "^0.5.6"
statsmodels = "^0.14.2"
pydantic = "^2.8.2"
pandas = "^2.2.2"
pandera = {extras = ["polars"], version = "^0.22.1"}

[tool.poetry.group.dev.dependencies]
altair = "^5.4.1"
Expand All @@ -77,3 +60,6 @@ deptry = "^0.23.0"

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"

[tool.ruff]
line-length = 100

0 comments on commit 113c37e

Please sign in to comment.