diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..933e6b1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: pip + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "chore(deps): " + prefix-development: "chore(deps-dev): " + - package-ecosystem: pip + directory: "/.github/workflows" + schedule: + interval: daily + commit-message: + prefix: "ci: " + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: "ci: " diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6842b74 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +### A CI workflow template that runs linting and python testing +### TODO: Modify as needed or as desired. + +name: Test tap-spotify + +on: [push] + +jobs: + pytest: + runs-on: ubuntu-latest + continue-on-error: true + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + TAP_SPOTIFY_CLIENT_ID: ${{secrets.TAP_SPOTIFY_CLIENT_ID}} + TAP_SPOTIFY_CLIENT_SECRET: ${{secrets.TAP_SPOTIFY_CLIENT_SECRET}} + TAP_SPOTIFY_REFRESH_TOKEN: ${{secrets.TAP_SPOTIFY_REFRESH_TOKEN}} + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: | + pip install poetry + - name: Install dependencies + run: | + poetry env use ${{ matrix.python-version }} + poetry install + - name: Test with pytest + run: | + poetry run pytest diff --git a/poetry.lock b/poetry.lock index f12c371..56ac2ee 100644 --- a/poetry.lock +++ b/poetry.lock @@ -58,6 +58,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 = "22.12.0" @@ -1173,6 +1213,17 @@ docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-g testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +[[package]] +name = "simpleeval" +version = "0.9.13" +description = "A simple, safe single expression evaluator library." +optional = false +python-versions = "*" +files = [ + {file = "simpleeval-0.9.13-py2.py3-none-any.whl", hash = "sha256:22a2701a5006e4188d125d34accf2405c2c37c93f6b346f2484b6422415ae54a"}, + {file = "simpleeval-0.9.13.tar.gz", hash = "sha256:4a30f9cc01825fe4c719c785e3762623e350c4840d5e6855c2a8496baaa65fac"}, +] + [[package]] name = "simplejson" version = "3.19.2" @@ -1282,43 +1333,53 @@ files = [ [[package]] name = "singer-sdk" -version = "0.31.1" +version = "0.34.1" description = "A framework for building Singer taps" optional = false -python-versions = ">=3.7.1,<3.12" +python-versions = ">=3.7.1" files = [ - {file = "singer_sdk-0.31.1-py3-none-any.whl", hash = "sha256:c5e20a1b042ab49f8446c2db150f7f75e3e6a99a0d579f1a7ff9eed9abeda084"}, - {file = "singer_sdk-0.31.1.tar.gz", hash = "sha256:cdd76f05259c1244ae91b4ac6fe44f7e3a182a3c480a29b60dfee9c51d498ea0"}, + {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,<3.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" -fs = ">=2.4.16,<3.0.0" -importlib-metadata = {version = "<5.0.0", markers = "python_version < \"3.8\""} -importlib-resources = {version = "5.12.0", markers = "python_version < \"3.9\""} -inflection = ">=0.5.1,<0.6.0" -joblib = ">=1.0.1,<2.0.0" -jsonpath-ng = ">=1.5.3,<2.0.0" -jsonschema = ">=4.16.0,<5.0.0" -memoization = ">=0.3.2,<0.5.0" +cryptography = ">=3.4.6" +fs = ">=2.4.16" +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 = [ + {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,<3.0.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" -PyYAML = ">=6.0,<7.0" -requests = ">=2.25.1,<3.0.0" -simplejson = ">=3.17.6,<4.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" +simplejson = ">=3.17.6" sqlalchemy = ">=1.4,<3.0" -typing-extensions = ">=4.2.0,<5.0.0" +typing-extensions = ">=4.5.0" urllib3 = ">=1.26,<2" [package.extras] -docs = ["furo (>=2022.12.7,<2024.0.0)", "myst-parser (>=0.17.2,<1.1.0)", "sphinx (>=4.5,<6.0)", "sphinx-autobuild (>=2021.3.14,<2022.0.0)", "sphinx-copybutton (>=0.3.1,<0.6.0)", "sphinx-inline-tabs (>=2023.4.21)", "sphinx-reredirects (>=0.1.1,<0.2.0)"] -s3 = ["fs-s3fs (>=1.1.1,<2.0.0)"] -testing = ["pytest (>=7.2.1,<8.0.0)", "pytest-durations (>=1.2.0,<2.0.0)"] +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)"] [[package]] name = "six" @@ -1607,4 +1668,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "<3.11,>=3.7.1" -content-hash = "2ea865b15d91bc3e73fbe2422f594edd44379eba553c3a90a9f85af6f78e1ca9" +content-hash = "57d4a80b0ccb9047dc5c78928176f8b1b9debd27c51ab343ef723c46fa23a5dc" diff --git a/pyproject.toml b/pyproject.toml index caef125..80a0221 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,9 @@ keywords = [ license = "Apache 2.0" [tool.poetry.dependencies] -python = "<3.11,>=3.7.1" +python = "^3.7.1" requests = "^2.31.0" -singer-sdk = "^0.31.1" +singer-sdk = "^0.34.1" [tool.poetry.group.dev.dependencies] pytest = "^7.4.3" diff --git a/tap_spotify/tests/test_core.py b/tap_spotify/tests/test_core.py deleted file mode 100644 index f572eb2..0000000 --- a/tap_spotify/tests/test_core.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Tests standard tap features using the built-in SDK tests library.""" - -import datetime - -from singer_sdk.testing import get_standard_tap_tests - -from tap_spotify.tap import TapSpotify - -SAMPLE_CONFIG = { - "start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d") - # TODO: Initialize minimal tap config -} - - -# Run standard built-in tap tests from the SDK: -def test_standard_tap_tests(): - """Run standard tap tests from the SDK.""" - tests = get_standard_tap_tests(TapSpotify, config=SAMPLE_CONFIG) - for test in tests: - test() - - -# TODO: Create additional tests as appropriate for your tap. diff --git a/tap_spotify/tests/__init__.py b/tests/__init__.py similarity index 100% rename from tap_spotify/tests/__init__.py rename to tests/__init__.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..6bb3ec2 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,3 @@ +"""Test Configuration.""" + +pytest_plugins = ("singer_sdk.testing.pytest_plugin",) diff --git a/tests/test_core.py b/tests/test_core.py new file mode 100644 index 0000000..73e3043 --- /dev/null +++ b/tests/test_core.py @@ -0,0 +1,18 @@ +"""Tests standard tap features using the built-in SDK tests library.""" + + +from singer_sdk.testing import get_tap_test_class + +from tap_spotify.tap import TapSpotify + +SAMPLE_CONFIG = {} + + +# Run standard built-in tap tests from the SDK: +TestTapSpotify = get_tap_test_class( + tap_class=TapSpotify, + config=SAMPLE_CONFIG, +) + + +# TODO: Create additional tests as appropriate for your tap. diff --git a/tox.ini b/tox.ini index ef3acf1..70b9e4a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,19 @@ -# This file can be used to customize dox tests as well as other test frameworks like flake8 and mypy +# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy [tox] -envlist = py38 -; envlist = py36, py38, py39 +envlist = py37, py38, py39, py310, py311 isolated_build = true [testenv] -whitelist_externals = poetry - +allowlist_externals = poetry commands = poetry install -v poetry run pytest - poetry run black --check tap_spotify/ - poetry run flake8 tap_spotify - poetry run pydocstyle tap_spotify - poetry run mypy tap_spotify --exclude='tap_spotify/tests' - - -[flake8] -ignore = W503 -max-line-length = 88 -max-complexity = 10 -[pydocstyle] -ignore = D105,D203,D213 +[testenv:pytest] +# Run the python tests. +# To execute, run `tox -e pytest` +envlist = py37, py38, py39, py310, py311 +commands = + poetry install -v + poetry run pytest