Skip to content

Commit

Permalink
Fix compatibility with Python3.6 and Python3.7 (#60)
Browse files Browse the repository at this point in the history
* Fix ClickBaseModel.click_options is now compatible with Python3.6 and Python3.7

* Update README

* Add tox configuration

Co-authored-by: Simo Tumelius <[email protected]>
  • Loading branch information
stumelius and datamie-simo authored Jul 14, 2022
1 parent a5f0b61 commit b5a9820
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ dist/

# pytest-cov
.coverage
cov_html/
cov_html/

# tox
.tox/
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

## Installation

`dbt-cloud-cli` has been tested on Python 3.8 but it should work on Python>=3.6.
`dbt-cloud-cli` has been tested with the following Python versions:

* ✅ Python 3.6
* ✅ Python 3.7
* ✅ Python 3.8
* ✅ Python 3.9
* ✅ Python 3.10

Installation from PyPI:

Expand Down
3 changes: 2 additions & 1 deletion dbt_cloud/command/command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
from collections import OrderedDict
from mergedeep import merge
from pydantic import validator, BaseModel, PrivateAttr
from dbt_cloud.serde import json_to_dict
Expand All @@ -21,7 +22,7 @@ def translate_click_options(**kwargs) -> dict:
class ClickBaseModel(BaseModel):
@classmethod
def click_options(cls, function, key_prefix: str = ""):
for key, field in reversed(cls.__fields__.items()):
for key, field in reversed(OrderedDict(cls.__fields__).items()):
try:
is_nested_object = issubclass(field.type_, BaseModel)
except TypeError:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool.black]
skip-string-normalization = false
include = '\.pyi?$'
exclude = 'venv/'
exclude = 'venv/|.tox/'
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tox]
envlist = py36, py37, py38, py39, p310
[testenv]
commands =
pytest
setenv =
DBT_CLOUD_ACCOUNT_ID = 123456
deps =
-e .[test]

0 comments on commit b5a9820

Please sign in to comment.