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
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish to PyPI

on:
push:
branches: [ master ]

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

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Build package
run: uv build

- name: Publish to PyPI
run: uv publish
3 changes: 1 addition & 2 deletions hasql/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
__version_info__ = (0, 9, 0)
__version__ = ".".join(map(str, __version_info__))
from hasql.version import __version__

package_info = (
"hasql is a module for acquiring actual connections with masters "
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=69", "wheel"]
requires = ["setuptools>=69", "wheel", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -80,10 +80,10 @@ Tracker = "https://github.com/aiokitchen/hasql/issues"
Documentation = "https://github.com/aiokitchen/hasql/blob/master/README.rst"

[tool.setuptools.dynamic]
version = { attr = "hasql.__version__" }
version = { attr = "hasql.version.__version__" }

[tool.setuptools.packages.find]
exclude = ["tests*", "example*"]
include = ["hasql*"]

[tool.setuptools.package-data]
hasql = ["py.typed"]
Expand Down
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from setuptools import setup


def version_scheme(version):
"""Custom version: MAJOR.MINOR.COMMITS_SINCE_TAG"""
if version.exact:
return f"{version.tag}.0"
return f"{version.tag}.{version.distance}"


def local_scheme(version):
"""No local version component."""
return ""


setup(
use_scm_version={
"version_scheme": version_scheme,
"local_scheme": local_scheme,
"tag_regex": r"^v(?P<version>\d+\.\d+)$",
"write_to": "hasql/version.py",
}
)
Loading