Skip to content

Commit e6911e5

Browse files
committed
Merge remote-tracking branch 'origin/main' into aj/feat/mini-cat-test-suites
2 parents 76a92a9 + 168c1ab commit e6911e5

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

.github/workflows/pypi_publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ on:
1414
workflow_dispatch:
1515
inputs:
1616
version:
17-
description: "Note that this workflow is intended for prereleases. For public-facing stable releases, please use the GitHub Releases workflow instead: https://github.com/airbytehq/airbyte-python-cdk/blob/main/docs/RELEASES.md. If running this workflow from main or from a dev branch, please enter the desired version number here, for instance 1.2.3dev0 or 1.2.3rc1."
17+
description: >
18+
Note that this workflow is intended for prereleases. For public-facing stable releases,
19+
please use the GitHub Releases workflow instead:
20+
https://github.com/airbytehq/airbyte-python-cdk/blob/main/docs/RELEASES.md.
21+
For prereleases, please leave the version blank to use the detected version. Alternatively,
22+
you can override the dynamic versioning for special use cases.
1823
required: false
1924
publish_to_pypi:
2025
description: "Publish to PyPI. If true, the workflow will publish to PyPI."
@@ -60,7 +65,7 @@ jobs:
6065
echo "Setting detected version to '$DETECTED_VERSION'"
6166
echo "DETECTED_VERSION=${DETECTED_VERSION}" >> $GITHUB_ENV
6267
63-
- name: Validate and set VERSION (git-ref='${{ github.ref_name }}', detected='${{ env.DETECTED_VERSION }}', input='${{ github.event.inputs.version || 'none' }}')
68+
- name: Validate and set VERSION (detected='${{ env.DETECTED_VERSION }}', input='${{ github.event.inputs.version || 'none' }}')
6469
id: set_version
6570
run: |
6671
INPUT_VERSION=${{ github.event.inputs.version }}

airbyte_cdk/sources/declarative/interpolation/macros.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def format_datetime(
177177
dt_datetime = (
178178
datetime.datetime.strptime(dt, input_format) if input_format else str_to_datetime(dt)
179179
)
180+
if dt_datetime.tzinfo is None:
181+
dt_datetime = dt_datetime.replace(tzinfo=pytz.utc)
180182
return DatetimeParser().format(dt=dt_datetime, format=format)
181183

182184

airbyte_cdk/sources/declarative/schema/default_schema_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_json_schema(self) -> Mapping[str, Any]:
3737

3838
try:
3939
return self.default_loader.get_json_schema()
40-
except OSError:
40+
except (OSError, ValueError):
4141
# A slight hack since we don't directly have the stream name. However, when building the default filepath we assume the
4242
# runtime options stores stream name 'name' so we'll do the same here
4343
stream_name = self._parameters.get("name", "")

docs/RELEASES.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ _Note:_
2121

2222
This process is slightly different from the above, since we don't necessarily want public release notes to be published for internal testing releases. The same underlying workflow will be run, but we'll kick it off directly:
2323

24-
1. Navigate to the "Packaging and Publishing" workflow in GitHub Actions.
25-
2. Type the version number - including a valid pre-release suffix. Examples: `1.2.3dev0`, `1.2.3rc1`, `1.2.3b0`, etc.
26-
3. Select `main` or your dev branch from the "Use workflow from" dropdown.
27-
4. Select your options and click "Run workflow".
28-
5. Monitor the workflow to ensure the process has succeeded.
24+
1. Navigate to the "Publish CDK" workflow in GitHub Actions.
25+
2. Select your dev branch (or `main`) from the "Use workflow from" dropdown.
26+
3. Leave the version number blank, allowing the CI workflow to pick a version number
27+
using [Dunamai](https://dunamai.readthedocs.io).
28+
4. Select from the other options and click "Run workflow".
29+
5. Monitor the workflow to ensure the process has succeeded. You will see the
30+
version number in the GitHub Actions job output and in GitHub Environments view.
2931

3032
## Understanding and Debugging Builder and SDM Releases
3133

@@ -59,15 +61,15 @@ To manually test changes against a dev image of SDM before committing to a relea
5961

6062
Once the publish pipeline has completed, choose a connector to test. Set the base_image in the connector's metadata to your pre-release version in Dockerhub (make sure to update the SHA as well).
6163
Next, build the pre-release image locally using `airbyte-ci connectors —name=<source> build`.
62-
You can now run connector interfaces against the built image using the pattern`docker run airbyte/<source-name>:dev <spec/check/discover/read>`.
64+
You can now run connector interfaces against the built image using the pattern`docker run airbyte/<source-name>:dev <spec/check/discover/read>`.
6365
The connector's README should include a list of these commands, which can be copy/pasted and run from the connector's directory for quick testing against a local config.
6466
You can also run `airbyte-ci connectors —name=<source> test` to run the CI test suite against the dev image.
6567

6668
#### Pretesting Low-Code Python connectors
6769

6870
Once the publish pipeline has completed, set the version of `airbyte-cdk` in the connector's pyproject.toml file to the pre-release version in PyPI.
69-
Update the lockfile and run connector interfaces via poetry:`poetry run source-<name> spec/check/discover/read`.
70-
You can also run `airbyte-ci connectors —name=<source> test` to run the CI test suite against the dev image.


71+
Update the lockfile and run connector interfaces via poetry:`poetry run source-<name> spec/check/discover/read`.
72+
You can also run `airbyte-ci connectors —name=<source> test` to run the CI test suite against the dev image.
7173

7274
#### Pretesting in Cloud
7375

unit_tests/sources/declarative/interpolation/test_macros.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ def test_macros_export(test_name, fn_name, found_in_macros):
101101
"%ms",
102102
"2022-01-01T01:01:01Z",
103103
),
104+
(
105+
"2022-01-01T01:01:01+0100",
106+
"%Y-%m-%dT%H:%M:%S.%f%z",
107+
None,
108+
"2022-01-01T00:01:01.000000+0000",
109+
),
110+
(
111+
"2022-01-01T01:01:01",
112+
"%Y-%m-%dT%H:%M:%S.%f%z",
113+
None,
114+
"2022-01-01T01:01:01.000000+0000",
115+
),
104116
],
105117
ids=[
106118
"test_datetime_string_to_date",
@@ -117,6 +129,8 @@ def test_macros_export(test_name, fn_name, found_in_macros):
117129
"test_timestamp_to_format_string",
118130
"test_timestamp_epoch_microseconds_to_format_string",
119131
"test_timestamp_ms_to_format_string",
132+
"test_datetime_with_timezone",
133+
"test_datetime_without_timezone_then_utc_is_inferred",
120134
],
121135
)
122136
def test_format_datetime(input_value, format, input_format, expected_output):

0 commit comments

Comments
 (0)