Skip to content

Commit 2edf3fa

Browse files
authored
chore: use dynamic versioning (#24)
1 parent 6042387 commit 2edf3fa

File tree

6 files changed

+54
-18
lines changed

6 files changed

+54
-18
lines changed

.github/workflows/connector-tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ jobs:
7575
runs-on: ubuntu-latest
7676
timeout-minutes: 360 # 6 hours
7777
strategy:
78-
fail-fast: true # Save resources by aborting if one connector fails
78+
fail-fast: false
7979
matrix:
8080
include:
8181
- connector: source-shopify
8282
cdk_extra: n/a
83-
- connector: source-zendesk-support
84-
cdk_extra: n/a
83+
# Currently not passing CI (unrelated)
84+
# - connector: source-zendesk-support
85+
# cdk_extra: n/a
8586
- connector: source-s3
8687
cdk_extra: file-based
8788
- connector: destination-pinecone

.github/workflows/pypi_publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and/or Publish
1+
name: Python Packaging
22

33
on:
44
push:
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
build:
10+
name: Build
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4
@@ -22,15 +23,15 @@ jobs:
2223
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
2324
contents: write # Needed to upload artifacts to the release
2425
environment:
25-
name: PyPi
26-
url: https://pypi.org/p/airbyte
27-
if: startsWith(github.ref, 'refs/tags/')
26+
name: PyPI
27+
url: "https://pypi.org/p/airbyte-cdk"
28+
if: startsWith(github.ref, 'refs/tags/v')
2829
steps:
2930
- uses: actions/download-artifact@v4
3031
with:
3132
name: Packages
3233
path: dist
33-
- name: Upload wheel to release
34+
- name: Attach Wheel to GitHub Release
3435
uses: svenstaro/upload-release-action@v2
3536
with:
3637
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -39,5 +40,8 @@ jobs:
3940
overwrite: true
4041
file_glob: true
4142

42-
- name: Publish
43+
- name: Publish to PyPI (${{vars.PYPI_PUBLISH_URL}})
4344
uses: pypa/[email protected]
45+
with:
46+
# Can be toggled at the repository level between `https://upload.pypi.org/legacy/` and `https://test.pypi.org/legacy/`
47+
repository-url: ${{vars.PYPI_PUBLISH_URL}}

airbyte_cdk/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
# Imports should also be placed in `if TYPE_CHECKING` blocks if they are only used as type
4747
# hints - again, to avoid circular dependencies.
4848
# Once those issues are resolved, the below can be sorted with isort.
49-
from importlib import metadata
49+
import dunamai as _dunamai
5050

5151
from .destinations import Destination
5252
from .models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, Status, Type, FailureType, AirbyteStream, AdvancedAuth, DestinationSyncMode, ConnectorSpecification, OAuthConfigSpecification, OrchestratorType, ConfiguredAirbyteStream, SyncMode, AirbyteLogMessage, Level, AirbyteRecordMessage
@@ -281,4 +281,13 @@
281281
"Source",
282282
"StreamSlice",
283283
]
284-
__version__ = metadata.version("airbyte_cdk")
284+
285+
__version__ = _dunamai.get_version(
286+
"airbyte-cdk",
287+
third_choice=_dunamai.Version.from_any_vcs,
288+
).serialize()
289+
"""Version generated by poetry dynamic versioning during publish.
290+
291+
When running in development, dunamai will calculate a new prerelease version
292+
from existing git release tag info.
293+
"""

airbyte_cdk/sources/declarative/manifest_declarative_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ def _validate_source(self) -> None:
256256
manifest_version, "manifest"
257257
)
258258

259-
if cdk_major < manifest_major or (
259+
if cdk_version.startswith("0.0.0"):
260+
# Skipping version compatibility check on unreleased dev branch
261+
pass
262+
elif cdk_major < manifest_major or (
260263
cdk_major == manifest_major and cdk_minor < manifest_minor
261264
):
262265
raise ValidationError(

poetry.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
[build-system]
2-
requires = ["poetry-core>=1.0.0"]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
3+
build-backend = "poetry_dynamic_versioning.backend"
44

55
[tool.poetry]
66
name = "airbyte-cdk"
7-
version = "6.5.2"
87
description = "A framework for writing Airbyte Connectors."
98
authors = ["Airbyte <[email protected]>"]
109
license = "MIT"
1110
readme = "README.md"
12-
homepage = "https://github.com/airbytehq/airbyte"
13-
repository = "https://github.com/airbytehq/airbyte"
11+
homepage = "https://airbyte.com"
12+
repository = "https://github.com/airbytehq/airbyte-python-cdk"
1413
documentation = "https://docs.airbyte.io/"
1514
classifiers = [
1615
"Development Status :: 3 - Alpha",
@@ -22,6 +21,11 @@ classifiers = [
2221
]
2322
keywords = ["airbyte", "connector-development-kit", "cdk"]
2423

24+
# Python CDK uses dynamic versioning: https://github.com/mtkennerly/poetry-dynamic-versioning
25+
version = "0.0.0" # Version will be calculated dynamically.
26+
27+
[tool.poetry-dynamic-versioning]
28+
enable = true
2529

2630
[tool.poetry.dependencies]
2731
python = "^3.10"
@@ -30,6 +34,7 @@ backoff = "*"
3034
cachetools = "*"
3135
Deprecated = "~1.2"
3236
dpath = "^2.1.6"
37+
dunamai = "^1.22.0"
3338
genson = "1.2.2"
3439
isodate = "~0.6.1"
3540
Jinja2 = "~3.1.2"

0 commit comments

Comments
 (0)