Skip to content

Commit

Permalink
Small fixes to support python3.8 (#23653)
Browse files Browse the repository at this point in the history
* Use ** instead of |

* Using typing type

* Using typing type

* Using typing type

* Revert "Merge branch 'master' into alex/support_3.8"

This reverts commit 5c75815, reversing
changes made to 5cb47f8.

* Revert "Merge branch 'master' into alex/support_3.8"

This reverts commit 5cb47f8, reversing
changes made to 4058fce.

* Revert "Merge branch 'master' into alex/support_3.8"

This reverts commit e1d1099, reversing
changes made to da881ef.

* reset changes

* undo borked publish

* downgrade bumpversion.cfg and Dockerfile too

* explicitely support >=3.8

* update readme
  • Loading branch information
girarda authored Mar 2, 2023
1 parent da881ef commit 677fa97
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion airbyte-cdk/python/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.29.3
current_version = 0.29.1
commit = False

[bumpversion:file:setup.py]
Expand Down
6 changes: 0 additions & 6 deletions airbyte-cdk/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Changelog

## 0.29.3
small fix to support python 3.8

## 0.29.2
minor fixes to support python3.8

## 0.29.1
Publishing Docker image for source-declarative-manifest

Expand Down
4 changes: 2 additions & 2 deletions airbyte-cdk/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN apk --no-cache upgrade \
&& apk --no-cache add tzdata build-base

# install airbyte-cdk
RUN pip install --prefix=/install airbyte-cdk==0.29.3
RUN pip install --prefix=/install airbyte-cdk==0.29.1

# build a clean environment
FROM base
Expand All @@ -32,5 +32,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

# needs to be the same as CDK
LABEL io.airbyte.version=0.29.3
LABEL io.airbyte.version=0.29.1
LABEL io.airbyte.name=airbyte/source-declarative-manifest
2 changes: 1 addition & 1 deletion airbyte-cdk/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ See the [concepts docs](docs/concepts/) for a tour through what the API offers.

### First time setup

We assume `python` points to python >=3.9.
We assume `python` points to python >=3.8.

Setup a virtual env:

Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/airbyte_cdk/sources/utils/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from jsonschema import Draft7Validator, ValidationError, validators

json_to_python_simple = {"string": str, "number": float, "integer": int, "boolean": bool, "null": type(None)}
json_to_python = json_to_python_simple | {"object": dict, "array": list}
json_to_python = {**json_to_python_simple, **{"object": dict, "array": list}}
python_to_json = {v: k for k, v in json_to_python.items()}

logger = logging.getLogger("airbyte")
Expand Down
6 changes: 3 additions & 3 deletions airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="airbyte-cdk",
version="0.29.3",
version="0.29.1",
description="A framework for writing Airbyte Connectors.",
long_description=README,
long_description_content_type="text/markdown",
Expand All @@ -33,7 +33,7 @@
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
# Python Version Support
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
],
keywords="airbyte connector-development-kit cdk",
project_urls={
Expand Down Expand Up @@ -61,7 +61,7 @@
"Jinja2~=3.1.2",
"cachetools",
],
python_requires=">=3.9",
python_requires=">=3.8",
extras_require={
"dev": [
"freezegun",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import datetime
from multiprocessing import current_process
from typing import Dict
from typing import Dict, List

from airbyte_cdk.models import AirbyteRecordMessage, Type
from mimesis import Datetime, Numeric
Expand Down Expand Up @@ -47,13 +47,13 @@ def random_date_in_range(
random_date = start_date + datetime.timedelta(days=random_number_of_days)
return random_date

def generate(self, user_id: int) -> list[Dict]:
def generate(self, user_id: int) -> List[Dict]:
"""
Because we are doing this work in parallel processes, we need a deterministic way to know what a purchase's ID should be given on the input of a user_id.
tldr; Every 10 user_ids produce 10 purchases. User ID x5 has no purchases, User ID mod x7 has 2, and everyone else has 1
"""

purchases: list[Dict] = []
purchases: List[Dict] = []
last_user_id_digit = int(repr(user_id)[-1])
purchase_count = 1
id_offset = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import os
from multiprocessing import Pool
from typing import Any, Dict, Iterable, Mapping, Optional
from typing import Any, Dict, Iterable, List, Mapping, Optional

from airbyte_cdk.sources.streams import IncrementalMixin, Stream

Expand Down Expand Up @@ -38,7 +38,7 @@ def state(self) -> Mapping[str, Any]:
def state(self, value: Mapping[str, Any]):
self._state = value

def load_products(self) -> list[Dict]:
def load_products(self) -> List[Dict]:
dirname = os.path.dirname(os.path.realpath(__file__))
return read_json(os.path.join(dirname, "record_data", "products.json"))

Expand Down

0 comments on commit 677fa97

Please sign in to comment.