Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use dynamic versioning #24

Merged
merged 13 commits into from
Nov 12, 2024
7 changes: 4 additions & 3 deletions .github/workflows/connector-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 360 # 6 hours
strategy:
fail-fast: true # Save resources by aborting if one connector fails
fail-fast: false
matrix:
include:
- connector: source-shopify
cdk_extra: n/a
- connector: source-zendesk-support
cdk_extra: n/a
# Currently not passing CI (unrelated)
# - connector: source-zendesk-support
# cdk_extra: n/a
- connector: source-s3
cdk_extra: file-based
- connector: destination-pinecone
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and/or Publish
name: Python Packaging

on:
push:
Expand All @@ -7,6 +7,7 @@ on:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -22,15 +23,15 @@ jobs:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # Needed to upload artifacts to the release
environment:
name: PyPi
url: https://pypi.org/p/airbyte
if: startsWith(github.ref, 'refs/tags/')
name: PyPI
url: "https://pypi.org/p/airbyte-cdk"
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload wheel to release
- name: Attach Wheel to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,5 +40,8 @@ jobs:
overwrite: true
file_glob: true

- name: Publish
- name: Publish to PyPI (${{vars.PYPI_PUBLISH_URL}})
uses: pypa/[email protected]
with:
# Can be toggled at the repository level between `https://upload.pypi.org/legacy/` and `https://test.pypi.org/legacy/`
repository-url: ${{vars.PYPI_PUBLISH_URL}}
13 changes: 11 additions & 2 deletions airbyte_cdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# Imports should also be placed in `if TYPE_CHECKING` blocks if they are only used as type
# hints - again, to avoid circular dependencies.
# Once those issues are resolved, the below can be sorted with isort.
from importlib import metadata
import dunamai as _dunamai

from .destinations import Destination
from .models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, Status, Type, FailureType, AirbyteStream, AdvancedAuth, DestinationSyncMode, ConnectorSpecification, OAuthConfigSpecification, OrchestratorType, ConfiguredAirbyteStream, SyncMode, AirbyteLogMessage, Level, AirbyteRecordMessage
Expand Down Expand Up @@ -281,4 +281,13 @@
"Source",
"StreamSlice",
]
__version__ = metadata.version("airbyte_cdk")

__version__ = _dunamai.get_version(
"airbyte-cdk",
third_choice=_dunamai.Version.from_any_vcs,
).serialize()
"""Version generated by poetry dynamic versioning during publish.

When running in development, dunamai will calculate a new prerelease version
from existing git release tag info.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ def _validate_source(self) -> None:
manifest_version, "manifest"
)

if cdk_major < manifest_major or (
if cdk_version.startswith("0.0.0"):
# Skipping version compatibility check on unreleased dev branch
pass
elif cdk_major < manifest_major or (
cdk_major == manifest_major and cdk_minor < manifest_minor
):
raise ValidationError(
Expand Down
16 changes: 15 additions & 1 deletion poetry.lock

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

15 changes: 10 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry]
name = "airbyte-cdk"
version = "6.5.2"
description = "A framework for writing Airbyte Connectors."
authors = ["Airbyte <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/airbytehq/airbyte"
repository = "https://github.com/airbytehq/airbyte"
homepage = "https://airbyte.com"
repository = "https://github.com/airbytehq/airbyte-python-cdk"
documentation = "https://docs.airbyte.io/"
classifiers = [
"Development Status :: 3 - Alpha",
Expand All @@ -22,6 +21,11 @@ classifiers = [
]
keywords = ["airbyte", "connector-development-kit", "cdk"]

# Python CDK uses dynamic versioning: https://github.com/mtkennerly/poetry-dynamic-versioning
version = "0.0.0" # Version will be calculated dynamically.

[tool.poetry-dynamic-versioning]
enable = true

[tool.poetry.dependencies]
python = "^3.10"
Expand All @@ -30,6 +34,7 @@ backoff = "*"
cachetools = "*"
Deprecated = "~1.2"
dpath = "^2.1.6"
dunamai = "^1.22.0"
genson = "1.2.2"
isodate = "~0.6.1"
Jinja2 = "~3.1.2"
Expand Down
Loading