From cc158680ef2b3fb78c438a9d99df0ee73d42558b Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Wed, 24 Feb 2021 23:52:30 +0300 Subject: [PATCH 1/3] update "install_requires" in setup.py --- setup.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index e7d0c28..ae0d6e6 100644 --- a/setup.py +++ b/setup.py @@ -30,20 +30,9 @@ def get_description(): return f.read() -def get_requirements(filename=None): - """ - Read requirements from 'requirements.txt' - - :return: requirements - :rtype: list - """ - if filename is None: - filename = 'requirements.txt' - - file = WORK_DIR / filename - - install_reqs = parse_requirements(str(file), session='hack') - return [str(ir.req) for ir in install_reqs] +requirements_filepath = WORK_DIR / "requirements.txt" +with open(requirements_filepath) as fp: + install_requires = fp.read() setup( @@ -68,5 +57,5 @@ def get_requirements(filename=None): 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries :: Application Frameworks', ], - install_requires=get_requirements() + install_requires=install_requires, ) From f4f51dff2235f28a82bafd4e178f34c145c36b80 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Wed, 24 Feb 2021 23:57:26 +0300 Subject: [PATCH 2/3] upgrade attrs to 20.3.0 and update converter kwarg --- aioalice/types/alice_request.py | 6 +++--- aioalice/types/alice_response.py | 4 ++-- aioalice/types/card.py | 8 ++++---- aioalice/types/card_footer.py | 2 +- aioalice/types/entity.py | 2 +- aioalice/types/image.py | 2 +- aioalice/types/meta.py | 2 +- aioalice/types/natural_language_understanding.py | 2 +- aioalice/types/request.py | 2 +- aioalice/types/response.py | 4 ++-- requirements.txt | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/aioalice/types/alice_request.py b/aioalice/types/alice_request.py index 455d8c7..8bfd041 100644 --- a/aioalice/types/alice_request.py +++ b/aioalice/types/alice_request.py @@ -18,9 +18,9 @@ class AliceRequest(AliceObject): """AliceRequest is a request from Alice API""" original_request = attrib(type=WebRequest) - meta = attrib(convert=ensure_cls(Meta)) - request = attrib(convert=ensure_cls(Request)) - session = attrib(convert=ensure_cls(Session)) + meta = attrib(converter=ensure_cls(Meta)) + request = attrib(converter=ensure_cls(Request)) + session = attrib(converter=ensure_cls(Session)) version = attrib(type=str) def _response(self, response): diff --git a/aioalice/types/alice_response.py b/aioalice/types/alice_response.py index dddaf8a..f91e5fe 100644 --- a/aioalice/types/alice_response.py +++ b/aioalice/types/alice_response.py @@ -8,6 +8,6 @@ class AliceResponse(AliceObject): """AliceResponse is a response to Alice API""" - response = attrib(convert=ensure_cls(Response)) - session = attrib(convert=ensure_cls(BaseSession)) + response = attrib(converter=ensure_cls(Response)) + session = attrib(converter=ensure_cls(BaseSession)) version = attrib(type=str) diff --git a/aioalice/types/card.py b/aioalice/types/card.py index acf25c9..a96f2e8 100644 --- a/aioalice/types/card.py +++ b/aioalice/types/card.py @@ -15,13 +15,13 @@ class Card(AliceObject): image_id = attrib(default=None, type=str) title = attrib(default=None, type=str) description = attrib(default=None, type=str) - button = attrib(default=None, convert=ensure_cls(MediaButton)) + button = attrib(default=None, converter=ensure_cls(MediaButton)) # for ItemsList - header = attrib(default=None, convert=ensure_cls(CardHeader)) - items = attrib(default=None, convert=ensure_cls(Image)) # List of Image objects + header = attrib(default=None, converter=ensure_cls(CardHeader)) + items = attrib(default=None, converter=ensure_cls(Image)) # List of Image objects - footer = attrib(default=None, convert=ensure_cls(CardFooter)) + footer = attrib(default=None, converter=ensure_cls(CardFooter)) @type.validator def check(self, attribute, value): diff --git a/aioalice/types/card_footer.py b/aioalice/types/card_footer.py index 03f98c0..40fe3fa 100644 --- a/aioalice/types/card_footer.py +++ b/aioalice/types/card_footer.py @@ -8,4 +8,4 @@ class CardFooter(AliceObject): """This object represents a card's footer""" text = attrib(type=str) - button = attrib(default=None, convert=ensure_cls(MediaButton)) + button = attrib(default=None, converter=ensure_cls(MediaButton)) diff --git a/aioalice/types/entity.py b/aioalice/types/entity.py index eece355..3e58c1c 100644 --- a/aioalice/types/entity.py +++ b/aioalice/types/entity.py @@ -12,7 +12,7 @@ class Entity(AliceObject): """Entity object""" type = attrib(type=str) - tokens = attrib(convert=ensure_cls(EntityTokens)) + tokens = attrib(converter=ensure_cls(EntityTokens)) value = attrib(factory=dict) @type.validator diff --git a/aioalice/types/image.py b/aioalice/types/image.py index 3026428..f6ab145 100644 --- a/aioalice/types/image.py +++ b/aioalice/types/image.py @@ -10,4 +10,4 @@ class Image(AliceObject): image_id = attrib(type=str) title = attrib(type=str) description = attrib(type=str) - button = attrib(default=None, convert=ensure_cls(MediaButton)) + button = attrib(default=None, converter=ensure_cls(MediaButton)) diff --git a/aioalice/types/meta.py b/aioalice/types/meta.py index a9e39bd..641e92c 100644 --- a/aioalice/types/meta.py +++ b/aioalice/types/meta.py @@ -10,5 +10,5 @@ class Meta(AliceObject): locale = attrib(type=str) timezone = attrib(type=str) client_id = attrib(type=str) - interfaces = attrib(default=None, convert=ensure_cls(Interfaces)) + interfaces = attrib(default=None, converter=ensure_cls(Interfaces)) flags = attrib(factory=list) diff --git a/aioalice/types/natural_language_understanding.py b/aioalice/types/natural_language_understanding.py index b219778..83997f1 100644 --- a/aioalice/types/natural_language_understanding.py +++ b/aioalice/types/natural_language_understanding.py @@ -12,4 +12,4 @@ class NaturalLanguageUnderstanding(AliceObject): """Natural Language Understanding object""" tokens = attrib(factory=list) - entities = attrib(factory=list, convert=ensure_cls(Entity)) + entities = attrib(factory=list, converter=ensure_cls(Entity)) diff --git a/aioalice/types/request.py b/aioalice/types/request.py index 6982e33..1aada6f 100644 --- a/aioalice/types/request.py +++ b/aioalice/types/request.py @@ -13,7 +13,7 @@ class Request(AliceObject): original_utterance = attrib(default='', type=str) # Can be none if payload passed markup = attrib(default=None) payload = attrib(default=None) - nlu = attrib(default=None, convert=ensure_cls(NaturalLanguageUnderstanding)) + nlu = attrib(default=None, converter=ensure_cls(NaturalLanguageUnderstanding)) @type.validator def check(self, attribute, value): diff --git a/aioalice/types/response.py b/aioalice/types/response.py index d51ccbc..38ebd1f 100644 --- a/aioalice/types/response.py +++ b/aioalice/types/response.py @@ -10,6 +10,6 @@ class Response(AliceObject): text = attrib(type=str) tts = attrib(default=None, type=str) - card = attrib(default=None, convert=ensure_cls(Card)) - buttons = attrib(default=None, convert=ensure_cls(Button)) + card = attrib(default=None, converter=ensure_cls(Card)) + buttons = attrib(default=None, converter=ensure_cls(Button)) end_session = attrib(default=False, type=bool) diff --git a/requirements.txt b/requirements.txt index bf86eba..e254630 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ aiohttp>=3.3.2 -attrs==18.1.0 +attrs==20.3.0 From 6faa492299f906aba46b736ec34f07e87f636ad7 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Wed, 24 Feb 2021 23:58:35 +0300 Subject: [PATCH 3/3] test lib for different python versions: 3.6, 3.7, 3.8, 3.9 --- .github/workflows/run_tests.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 423f808..e0aca4c 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -6,13 +6,16 @@ jobs: unit-tests: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 - - name: Set up Python 3.6 - uses: actions/setup-python@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 with: - python-version: 3.6 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip