From c4a8d2267835fb96e833c2f4360b116a9924432a Mon Sep 17 00:00:00 2001 From: ReubenFrankel <60552974+ReubenFrankel@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:19:09 +0000 Subject: [PATCH] feat: Update `singer-sdk` to latest compatible version (#20) * Update `singer-sdk` to latest compatible version * Fix import order * Remove redundant type hints --- poetry.lock | 81 +++++++++++++++---- pyproject.toml | 2 +- tap_google_sheets/auth.py | 9 +-- .../tests/test_child_sheet_name_setting.py | 14 ++-- .../tests/test_discovered_stream_name.py | 4 +- .../tests/test_ignoring_unnamed_columns.py | 16 ++-- .../tests/test_table_name_setting.py | 4 +- .../tests/test_underscoring_column_names.py | 14 ++-- 8 files changed, 99 insertions(+), 45 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6b5982a..51fda78 100644 --- a/poetry.lock +++ b/poetry.lock @@ -50,6 +50,46 @@ files = [ {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, ] +[[package]] +name = "backports-datetime-fromisoformat" +version = "2.0.1" +description = "Backport of Python 3.11's datetime.fromisoformat" +optional = false +python-versions = ">3" +files = [ + {file = "backports-datetime-fromisoformat-2.0.1.tar.gz", hash = "sha256:1b6afca7f47019c22df43062cde73c1af65fbdebc66520f352c690d52fd27127"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b739ccd3f36244f618f1fbc21d89894d9dc9d1d75a68762fcf917d433df38ae3"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:afd072ca32f2ca4e838e0f7b61a56168d98837ee9a182c567a49a834e07c2b98"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a136d85f8b1db4747aa9e56a8caa0ba77c5c25b761b18e2169ea7b1b516f012"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d3a0579958ade7db62c8238163e05d46a4de61c99cebb40031ed7409a44d5f6"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:199df62af8feff5da0f4953fdc4a6994bcd7dbfe1db95901d8b93d05feda2ab5"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:afe32e60a471831058ede14fc226d9f14120e6dc67d66fbbd36e1724826ad70b"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:a1ba7e226a9694b20b713867f71b5ed2f662603c39875f14f968608d331fc96a"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:403f155deecbe94d43d0679a74abb5c9ac441422a9ececcfde030fb133865659"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4d2ee049997d3aa2e714489cb3c34864fb0f25786e7a4ff04ac9d82af58b453"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:20aa422769af9f72ca41d83238d4a3a008d6cd74bcff0a08befb11b0018d6aa5"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8ea8d85c3c9afa4ad51b6644d26516d43493f44c2131c12a2ba959433f4417f6"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:812b8c34e88a7d9615c604f1a0473a4e6d664aba94086bffb0c55627f9e3fb68"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:df5365930320b7a9d404cd6f7bc13988e28355e812aa42e21aa5c93443dcdd2e"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fe3e3968c8dce4a44da2da81a6031e992a4ee62d130c2536696d215a4db2ce3c"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:36a4abb678ab0d6a1965d70e21e424bcf7a52086a7afb1c5f13243a3d44fa2dd"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:96b7e806ade09a91d8ce195c197fc799d8fbe6b8ea9cde21f8a01f1090e51e33"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:002a77bd4f549ff5e80f1ef4a9b69982746dd6190786b90abe3d9c69c9883ce4"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7b4ad0013a96b656ebf85079921ffb211623a1e28ff4981b3927690a2ed6df54"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:065421723e735ce8f68dbb4486f07562ce8556ed543ceaa012189b9aa209f303"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:a4bf1bec08bc84095ee379202466c948fe12cff1442f58ee1a91fac4c5164c97"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1836aff09b8317e179cc7288856b61a450515d4b411f0ab723dc9692dfa5362e"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:815f85a581b142bcf34632c3ce26f7e21003f101ce88b5649631330e334bbe35"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6a6986cfd3bc40b41465a6c54c18a30ca8110333d0b71f6062af136db11c8ff0"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:82741e732d71f78b44a8c3b95f33b3630e7bfbdb02e3fede3938cdf15d5b6a83"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4eac27abb51ee84e08d1dd1e908c16cae2078c217ff5b54092e6cb92107b4c6c"}, + {file = "backports_datetime_fromisoformat-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:3b730d72061523be9600bcd281ef353f7f73b1df095adbbdc364aac8f430c44c"}, + {file = "backports_datetime_fromisoformat-2.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6e8f28f4a68539192473f427ed86794931502d186e2fffa1926250550c1335a"}, + {file = "backports_datetime_fromisoformat-2.0.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0cef151f1df77e413dc179607edb5bee11949ca5890e81c0bb742d96fec753fe"}, + {file = "backports_datetime_fromisoformat-2.0.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c28c95d6df2a44fa3540e18e484596c03e8ff7112e2f93b664f482fe3a88720b"}, + {file = "backports_datetime_fromisoformat-2.0.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91042b53de903e3725209ad6d69b6994ae4819614c0decd62d05dfea23f35e2b"}, +] + [[package]] name = "black" version = "21.12b0" @@ -1097,42 +1137,51 @@ files = [ [[package]] name = "singer-sdk" -version = "0.33.1" +version = "0.34.1" description = "A framework for building Singer taps" optional = false -python-versions = ">=3.7.1,<4" +python-versions = ">=3.7.1" files = [ - {file = "singer_sdk-0.33.1-py3-none-any.whl", hash = "sha256:2ba3fb9d7b8726c4d8cd66414fef71e117f52646e8aef35b4077ff8a8040587e"}, - {file = "singer_sdk-0.33.1.tar.gz", hash = "sha256:25a9f06e54574a5a432519f11506591dfc4073237df39389ac41dcb0e19dace9"}, + {file = "singer_sdk-0.34.1-py3-none-any.whl", hash = "sha256:2b9afa40722c2d7288992d86d16298128e38387941306267d908b9cd954227a3"}, + {file = "singer_sdk-0.34.1.tar.gz", hash = "sha256:5da11da3de07cc31cc8c1f3f19a40b8f8be4a0df9b5535fb90880c263e58aee5"}, ] [package.dependencies] -backoff = ">=2.0.0" +backoff = {version = ">=2.0.0", markers = "python_version < \"4\""} +backports-datetime-fromisoformat = {version = ">=2.0.1", markers = "python_version < \"3.11\""} click = ">=8.0,<9.0" -cryptography = ">=3.4.6,<42.0.0" +cryptography = ">=3.4.6" fs = ">=2.4.16" -importlib-metadata = {version = "<7.0.0", markers = "python_version < \"3.8\""} +importlib-metadata = {version = "<7.0.0", markers = "python_version < \"3.12\""} importlib-resources = {version = ">=5.12.0", markers = "python_version < \"3.9\""} inflection = ">=0.5.1" joblib = ">=1.0.1" jsonpath-ng = ">=1.5.3" -jsonschema = ">=4.16.0" -memoization = ">=0.3.2,<0.5.0" +jsonschema = [ + {version = ">=4.16.0", markers = "python_version >= \"3.8\""}, + {version = ">=4.16.0,<4.18", markers = "python_version < \"3.8\""}, +] +memoization = {version = ">=0.3.2,<0.5.0", markers = "python_version < \"4\""} packaging = ">=23.1" -pendulum = ">=2.1.0" +pendulum = [ + {version = ">=2.1.0,<4", markers = "python_version >= \"3.8\""}, + {version = ">=2.1.0,<3", markers = "python_version < \"3.8\""}, +] PyJWT = ">=2.4,<3.0" -python-dotenv = ">=0.20,<0.22" -pytz = ">=2022.2.1,<2024.0.0" +python-dateutil = ">=2.8.2" +python-dotenv = ">=0.20" +pytz = ">=2022.2.1" PyYAML = ">=6.0" requests = ">=2.25.1" -simpleeval = ">=0.9.13,<0.10.0" +simpleeval = ">=0.9.13" simplejson = ">=3.17.6" sqlalchemy = ">=1.4,<3.0" -typing-extensions = ">=4.2.0" +typing-extensions = ">=4.5.0" urllib3 = ">=1.26,<2" [package.extras] -docs = ["furo (>=2022.12.7)", "myst-parser (>=1)", "sphinx (>=4.5)", "sphinx-autobuild (>=2021.3.14)", "sphinx-copybutton (>=0.3.1)", "sphinx-inline-tabs (>=2023.4.21)", "sphinx-reredirects (>=0.1.1)"] +docs = ["furo (>=2022.12.7)", "myst-parser (>=1)", "sphinx (>=4.5)", "sphinx-autobuild (>=2021.3.14)", "sphinx-copybutton (>=0.3.1)", "sphinx-inline-tabs (>=2023.4.21)", "sphinx-notfound-page (>=1.0.0)", "sphinx-reredirects (>=0.1.1)"] +parquet = ["numpy (<1.22)", "numpy (>=1.22)", "numpy (>=1.22,<1.25)", "pyarrow (>=11,<13)", "pyarrow (>=13)"] s3 = ["fs-s3fs (>=1.1.1)"] testing = ["pytest (>=7.2.1)", "pytest-durations (>=1.2.0)"] @@ -1407,4 +1456,4 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "2.0" python-versions = "<3.13,>=3.7.1" -content-hash = "39461a67beeb994836fba2034a7bc62ad14b0048ba37339e46eaee08e3f974d8" +content-hash = "3a8ed98a44a4e63565f8e30c00519dc3c1a982f0850a34148e52a2f24008e76c" diff --git a/pyproject.toml b/pyproject.toml index 050945d..700565c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ license = "GNU Affero General Public License v3.0" [tool.poetry.dependencies] python = "<3.13,>=3.7.1" requests = "^2.31.0" -singer-sdk = "^0.33.0" +singer-sdk = "^0.34.1" click = "8.0.1" [tool.poetry.dev-dependencies] diff --git a/tap_google_sheets/auth.py b/tap_google_sheets/auth.py index 5cb4767..4f59049 100644 --- a/tap_google_sheets/auth.py +++ b/tap_google_sheets/auth.py @@ -2,7 +2,6 @@ import json from datetime import datetime -from typing import Optional import requests from singer_sdk.authenticators import OAuthAuthenticator, SingletonMeta @@ -44,10 +43,10 @@ def __init__( self._auth_body = auth_body # Initialize internal tracking attributes - self.access_token: Optional[str] = None - self.refresh_token: Optional[str] = None - self.last_refreshed: Optional[datetime] = None - self.expires_in: Optional[int] = None + self.access_token = None + self.refresh_token = None + self.last_refreshed = None + self.expires_in = None def is_token_valid(self) -> bool: """Check if token is valid.""" diff --git a/tap_google_sheets/tests/test_child_sheet_name_setting.py b/tap_google_sheets/tests/test_child_sheet_name_setting.py index 00e1a13..71bdf15 100644 --- a/tap_google_sheets/tests/test_child_sheet_name_setting.py +++ b/tap_google_sheets/tests/test_child_sheet_name_setting.py @@ -4,6 +4,7 @@ import responses import singer_sdk._singerlib as singer +import singer_sdk.io_base as io import tap_google_sheets.tests.utils as test_utils from tap_google_sheets.tap import TapGoogleSheets @@ -26,7 +27,7 @@ def setUp(self): responses.reset() del test_utils.SINGER_MESSAGES[:] - singer.write_message = test_utils.accumulate_singer_messages + io.singer_write_message = test_utils.accumulate_singer_messages @responses.activate() def test_discovered_stream_name(self): @@ -66,13 +67,14 @@ def test_discovered_stream_name(self): tap.sync_all() - self.assertEqual(len(test_utils.SINGER_MESSAGES), 4) - self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.SchemaMessage) + self.assertEqual(len(test_utils.SINGER_MESSAGES), 5) + self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.StateMessage) self.assertIsInstance(test_utils.SINGER_MESSAGES[1], singer.SchemaMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.RecordMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[3], singer.StateMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.SchemaMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[3], singer.RecordMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[4], singer.StateMessage) # Assert that data is sycned from the mocked response self.assertEquals( - test_utils.SINGER_MESSAGES[2].record, {"Column_One": "1", "Column_Two": "1"} + test_utils.SINGER_MESSAGES[3].record, {"Column_One": "1", "Column_Two": "1"} ) diff --git a/tap_google_sheets/tests/test_discovered_stream_name.py b/tap_google_sheets/tests/test_discovered_stream_name.py index abae96b..3f26f38 100644 --- a/tap_google_sheets/tests/test_discovered_stream_name.py +++ b/tap_google_sheets/tests/test_discovered_stream_name.py @@ -3,7 +3,7 @@ import unittest import responses -import singer_sdk._singerlib as singer +import singer_sdk.io_base as io import tap_google_sheets.tests.utils as test_utils from tap_google_sheets.tap import TapGoogleSheets @@ -18,7 +18,7 @@ def setUp(self): responses.reset() del test_utils.SINGER_MESSAGES[:] - singer.write_message = test_utils.accumulate_singer_messages + io.singer_write_message = test_utils.accumulate_singer_messages @responses.activate() def test_discovered_stream_name(self): diff --git a/tap_google_sheets/tests/test_ignoring_unnamed_columns.py b/tap_google_sheets/tests/test_ignoring_unnamed_columns.py index 59948da..72a3ae1 100644 --- a/tap_google_sheets/tests/test_ignoring_unnamed_columns.py +++ b/tap_google_sheets/tests/test_ignoring_unnamed_columns.py @@ -4,6 +4,7 @@ import responses import singer_sdk._singerlib as singer +import singer_sdk.io_base as io import tap_google_sheets.tests.utils as test_utils from tap_google_sheets.tap import TapGoogleSheets @@ -18,7 +19,7 @@ def setUp(self): responses.reset() del test_utils.SINGER_MESSAGES[:] - singer.write_message = test_utils.accumulate_singer_messages + io.singer_write_message = test_utils.accumulate_singer_messages @responses.activate() def test_ignoring_unnamed_columns(self): @@ -59,18 +60,19 @@ def test_ignoring_unnamed_columns(self): tap.sync_all() - self.assertEqual(len(test_utils.SINGER_MESSAGES), 5) - self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.SchemaMessage) + self.assertEqual(len(test_utils.SINGER_MESSAGES), 6) + self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.StateMessage) self.assertIsInstance(test_utils.SINGER_MESSAGES[1], singer.SchemaMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.RecordMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.SchemaMessage) self.assertIsInstance(test_utils.SINGER_MESSAGES[3], singer.RecordMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[4], singer.StateMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[4], singer.RecordMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[5], singer.StateMessage) # Assert that the second unnamed column and its values are ignored self.assertEquals( - test_utils.SINGER_MESSAGES[2].record, {"Column_One": "1", "Column_Two": "1"} + test_utils.SINGER_MESSAGES[3].record, {"Column_One": "1", "Column_Two": "1"} ) self.assertEquals( - test_utils.SINGER_MESSAGES[3].record, {"Column_One": "2", "Column_Two": "2"} + test_utils.SINGER_MESSAGES[4].record, {"Column_One": "2", "Column_Two": "2"} ) diff --git a/tap_google_sheets/tests/test_table_name_setting.py b/tap_google_sheets/tests/test_table_name_setting.py index c57f84a..28bc2db 100644 --- a/tap_google_sheets/tests/test_table_name_setting.py +++ b/tap_google_sheets/tests/test_table_name_setting.py @@ -3,7 +3,7 @@ import unittest import responses -import singer_sdk._singerlib as singer +import singer_sdk.io_base as io import tap_google_sheets.tests.utils as test_utils from tap_google_sheets.tap import TapGoogleSheets @@ -19,7 +19,7 @@ def setUp(self): responses.reset() del test_utils.SINGER_MESSAGES[:] - singer.write_message = test_utils.accumulate_singer_messages + io.singer_write_message = test_utils.accumulate_singer_messages @responses.activate() def test_output_name(self): diff --git a/tap_google_sheets/tests/test_underscoring_column_names.py b/tap_google_sheets/tests/test_underscoring_column_names.py index 95cad65..242adc6 100644 --- a/tap_google_sheets/tests/test_underscoring_column_names.py +++ b/tap_google_sheets/tests/test_underscoring_column_names.py @@ -4,6 +4,7 @@ import responses import singer_sdk._singerlib as singer +import singer_sdk.io_base as io import tap_google_sheets.tests.utils as test_utils from tap_google_sheets.tap import TapGoogleSheets @@ -18,7 +19,7 @@ def setUp(self): responses.reset() del test_utils.SINGER_MESSAGES[:] - singer.write_message = test_utils.accumulate_singer_messages + io.singer_write_message = test_utils.accumulate_singer_messages @responses.activate() def test_underscoring_column_names(self): @@ -67,15 +68,16 @@ def test_underscoring_column_names(self): tap.sync_all() - self.assertEqual(len(test_utils.SINGER_MESSAGES), 4) - self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.SchemaMessage) + self.assertEqual(len(test_utils.SINGER_MESSAGES), 5) + self.assertIsInstance(test_utils.SINGER_MESSAGES[0], singer.StateMessage) self.assertIsInstance(test_utils.SINGER_MESSAGES[1], singer.SchemaMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.RecordMessage) - self.assertIsInstance(test_utils.SINGER_MESSAGES[3], singer.StateMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[2], singer.SchemaMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[3], singer.RecordMessage) + self.assertIsInstance(test_utils.SINGER_MESSAGES[4], singer.StateMessage) # Assert that column names have been underscored self.assertEquals( - test_utils.SINGER_MESSAGES[2].record, + test_utils.SINGER_MESSAGES[3].record, { "Column_One": "1", "Column_Two": "1",