diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index f2b47ddd9..081748384 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.9.9 - run: pip install -e . - run: pip install mypy types-requests - run: mypy looker_sdk/ @@ -57,7 +57,7 @@ jobs: - macos - windows python-version: - - '3.9' + - '3.9.9' include: - python-version: '3.6' os: ubuntu @@ -179,7 +179,7 @@ jobs: pip install tox - name: Determine credentials version - # Prior to 21_18, each version had different credentials and a + # Prior to 21_18, each version had different credentials and a # different secret. 21_20 and later all use the same credentials # as 21_18. The parse_version.sh script parses the version and # yields 21_12, 21_14, 21_16 etc for those versions but 21_18 for @@ -220,7 +220,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.9.9 - name: Twine upload check run: | pip install wheel twine diff --git a/python/.python-version b/python/.python-version index a43eb03b9..4e8cb5855 100644 --- a/python/.python-version +++ b/python/.python-version @@ -1,3 +1,4 @@ +3.9.9 3.9.0 3.8.2 3.7.6 diff --git a/python/Pipfile b/python/Pipfile index 87ba09a41..1319d5000 100644 --- a/python/Pipfile +++ b/python/Pipfile @@ -8,6 +8,7 @@ pytest = "*" ptpython = "*" ipython = "*" mypy = "*" +types-requests = "*" pytest-cov = "*" black = "*" flake8 = "*" @@ -26,11 +27,12 @@ tox-pyenv = "*" [packages] requests = "*" attrs = "*" -cattrs = "==1.1.2" +cattrs = ">=1.3" python-dateutil = "*" [requires] -python_full_version = "3.8.2" +# pin python at 3.9.9 due to https://github.com/looker-open-source/sdk-codegen/issues/944 +python_full_version = "3.9.9" [pipenv] # for `black` diff --git a/python/looker_sdk/rtl/serialize.py b/python/looker_sdk/rtl/serialize.py index ff6b7505e..36e30e723 100644 --- a/python/looker_sdk/rtl/serialize.py +++ b/python/looker_sdk/rtl/serialize.py @@ -138,6 +138,13 @@ def unstructure_hook(api_model): del data[key] elif value == model.EXPLICIT_NULL: data[key] = None + # bug here: in the unittests cattrs unstructures this correctly + # as an enum calling .value but in the integration tests we see + # it doesn't for WriteCreateQueryTask.result_format for some reason + # Haven't been able to debug it fully, so catching and processing + # it here. + elif isinstance(value, enum.Enum): + data[key] = value.value for reserved in keyword.kwlist: if f"{reserved}_" in data: data[reserved] = data.pop(f"{reserved}_") @@ -153,7 +160,6 @@ def datetime_structure_hook( ) -> datetime.datetime: return parser.isoparse(d) - else: def datetime_structure_hook( @@ -165,4 +171,4 @@ def datetime_structure_hook( converter31.register_structure_hook(datetime.datetime, datetime_structure_hook) converter40.register_structure_hook(datetime.datetime, datetime_structure_hook) cattr.register_unstructure_hook(model.Model, unstructure_hook) # type: ignore -cattr.register_unstructure_hook(datetime.datetime, lambda dt: dt.strftime(DATETIME_FMT)) +cattr.register_unstructure_hook(datetime.datetime, lambda dt: dt.strftime(DATETIME_FMT)) # type: ignore diff --git a/python/setup.py b/python/setup.py index 4ca746fbc..455920ddd 100644 --- a/python/setup.py +++ b/python/setup.py @@ -38,7 +38,7 @@ "python-dateutil;python_version<'3.7'", # Python 3.7+ "attrs >= 20.1.0;python_version>='3.7'", - "cattrs == 1.1.2;python_version>='3.7'", + "cattrs >= 1.3;python_version>='3.7'", "typing-extensions;python_version<'3.8'", ] @@ -54,7 +54,8 @@ name=NAME, package_data={"looker_sdk": ["py.typed", "looker_sdk/looker-sample.ini"]}, packages=find_packages(), - python_requires="~=3.6", + # restrict python to <=3.9.9 due to https://github.com/looker-open-source/sdk-codegen/issues/944 + python_requires=">=3.6, <=3.9.9", url="https://pypi.python.org/pypi/looker_sdk", version=VERSION, )