From 0e4e91f8c7bb243b9c83feea5bc4dbd4986d8da5 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 14 May 2021 15:02:12 -0700 Subject: [PATCH] update awscrt to 0.11.19. Remove support for python3.5 as it's EOL (#194) - update awscrt to 0.11.19. Remove support for python3.5 as it's EOL - Version and metadata of life updates --- README.md | 5 +++- awsiot/__init__.py | 10 +++++--- builder.json | 17 +++++++----- continuous-delivery/publish_to_prod_pypi.yml | 2 +- continuous-delivery/publish_to_test_pypi.yml | 2 +- setup.py | 27 +++++++++++++++++--- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3395c9b1..0129e420 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # AWS IoT Device SDK v2 for Python + +[![Version](https://img.shields.io/pypi/v/awsiotsdk.svg?style=flat)](https://pypi.org/project/awsiotsdk/) + This document provides information about the AWS IoT Device SDK v2 for Python. If you have any issues or feature requests, please file an issue or pull request. @@ -27,7 +30,7 @@ to Python by the `awscrt` package ([PyPI](https://pypi.org/project/awscrt/)) ([G ## Installation ### Minimum Requirements -* Python 3.5+ +* Python 3.6+ ### Install from PyPI ``` diff --git a/awsiot/__init__.py b/awsiot/__init__.py index 5fb74261..accc4c46 100644 --- a/awsiot/__init__.py +++ b/awsiot/__init__.py @@ -15,6 +15,8 @@ import json from typing import Any, Callable, Dict, Optional, Tuple, TypeVar +__version__ = '1.0.0-dev' + T = TypeVar('T') PayloadObj = Dict[str, Any] @@ -30,7 +32,7 @@ class MqttServiceClient: """ def __init__(self, mqtt_connection: mqtt.Connection): - self._mqtt_connection = mqtt_connection # type: mqtt.Connection + self._mqtt_connection = mqtt_connection # type: mqtt.Connection @property def mqtt_connection(self) -> mqtt.Connection: @@ -50,7 +52,7 @@ def unsubscribe(self, topic: str) -> Future: `Future` whose result will be `None` when the server has acknowledged the unsubscribe. """ - future = Future() # type: Future + future = Future() # type: Future try: def on_unsuback(unsuback_future): if unsuback_future.exception(): @@ -80,7 +82,7 @@ def _publish_operation(self, topic: str, qos: int, payload: Optional[PayloadObj] server has acknowledged the message, or an exception if the publish fails. """ - future = Future() # type: Future + future = Future() # type: Future try: def on_puback(puback_future): if puback_future.exception(): @@ -135,7 +137,7 @@ def _subscribe_operation(self, Note that messages may arrive before the subscription is acknowledged. """ - future = Future() # type: Future + future = Future() # type: Future try: def on_suback(suback_future): try: diff --git a/builder.json b/builder.json index 4d98f7e7..992b0932 100644 --- a/builder.json +++ b/builder.json @@ -23,6 +23,16 @@ }, "manylinux": { "post_build_steps": [ + ["echo", "------ Python 3.9 ------"], + ["/opt/python/cp39-cp39/bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools"], + ["/opt/python/cp39-cp39/bin/python", "-m", "pip", "install", ".", "--verbose"], + ["/opt/python/cp39-cp39/bin/python", "-m", "pip", "install", "boto3", "autopep8"], + ["/opt/python/cp39-cp39/bin/python", "-m", "unittest", "discover", "--verbose"], + ["echo", "------ Python 3.8 ------"], + ["/opt/python/cp38-cp38/bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools"], + ["/opt/python/cp38-cp38/bin/python", "-m", "pip", "install", ".", "--verbose"], + ["/opt/python/cp38-cp38/bin/python", "-m", "pip", "install", "boto3", "autopep8"], + ["/opt/python/cp38-cp38/bin/python", "-m", "unittest", "discover", "--verbose"], ["echo", "------ Python 3.7 ------"], ["/opt/python/cp37-cp37m/bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools"], ["/opt/python/cp37-cp37m/bin/python", "-m", "pip", "install", ".", "--verbose"], @@ -32,12 +42,7 @@ ["/opt/python/cp36-cp36m/bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools"], ["/opt/python/cp36-cp36m/bin/python", "-m", "pip", "install", ".", "--verbose"], ["/opt/python/cp36-cp36m/bin/python", "-m", "pip", "install", "boto3", "autopep8"], - ["/opt/python/cp36-cp36m/bin/python", "-m", "unittest", "discover", "--verbose"], - ["echo", "------ Python 3.5 ------"], - ["/opt/python/cp35-cp35m/bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools"], - ["/opt/python/cp35-cp35m/bin/python", "-m", "pip", "install", ".", "--verbose"], - ["/opt/python/cp35-cp35m/bin/python", "-m", "pip", "install", "boto3", "autopep8"], - ["/opt/python/cp35-cp35m/bin/python", "-m", "unittest", "discover", "--verbose"] + ["/opt/python/cp36-cp36m/bin/python", "-m", "unittest", "discover", "--verbose"] ], "run_tests": false, "_comment": "manylinux has all its own build steps, turn off 'tests' which is where normal build steps are declared. using data to program sucks" diff --git a/continuous-delivery/publish_to_prod_pypi.yml b/continuous-delivery/publish_to_prod_pypi.yml index 683dca4f..c8d78851 100644 --- a/continuous-delivery/publish_to_prod_pypi.yml +++ b/continuous-delivery/publish_to_prod_pypi.yml @@ -14,7 +14,7 @@ phases: - pypirc=$(aws secretsmanager get-secret-value --secret-id "prod/aws-crt-python/.pypirc" --query "SecretString" | cut -f2 -d\") && echo "$pypirc" > ~/.pypirc - export PKG_VERSION=$(git describe --tags | cut -f2 -dv) - echo "Updating package version to ${PKG_VERSION}" - - sed --in-place -E "s/version='.+'/version='${PKG_VERSION}'/" setup.py + - sed --in-place -E "s/__version__ = '.+'/__version__ = '${PKG_VERSION}'/" awsiot/__init__.py build: commands: - echo Build started on `date` diff --git a/continuous-delivery/publish_to_test_pypi.yml b/continuous-delivery/publish_to_test_pypi.yml index 2606be1c..86cde41e 100644 --- a/continuous-delivery/publish_to_test_pypi.yml +++ b/continuous-delivery/publish_to_test_pypi.yml @@ -14,7 +14,7 @@ phases: - cd aws-iot-device-sdk-python-v2 - export PKG_VERSION=$(git describe --tags | cut -f2 -dv) - echo "Updating package version to ${PKG_VERSION}" - - sed --in-place -E "s/version='.+'/version='${PKG_VERSION}'/" setup.py + - sed --in-place -E "s/__version__ = '.+'/__version__ = '${PKG_VERSION}'/" awsiot/__init__.py build: commands: - echo Build started on `date` diff --git a/setup.py b/setup.py index 429b327b..33a46a49 100644 --- a/setup.py +++ b/setup.py @@ -3,13 +3,34 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. +import codecs +import re +import os from setuptools import setup, find_packages +VERSION_RE = re.compile(r""".*__version__ = ["'](.*?)['"]""", re.S) +PROJECT_DIR = os.path.dirname(os.path.realpath(__file__)) + + +def _load_readme(): + readme_path = os.path.join(PROJECT_DIR, 'README.md') + with codecs.open(readme_path, 'r', 'utf-8') as f: + return f.read() + + +def _load_version(): + init_path = os.path.join(PROJECT_DIR, 'awsiot', '__init__.py') + with open(init_path) as fp: + return VERSION_RE.match(fp.read()).group(1) + + setup( name='awsiotsdk', - version='1.0.0-dev', + version=_load_version(), license='License :: OSI Approved :: Apache Software License', description='AWS IoT SDK based on the AWS Common Runtime', + long_description=_load_readme(), + long_description_content_type='text/markdown', author='AWS SDK Common Runtime Team', url='https://github.com/aws/aws-iot-device-sdk-python-v2', packages=find_packages(include=['awsiot*']), @@ -19,7 +40,7 @@ "Operating System :: OS Independent", ], install_requires=[ - 'awscrt==0.11.17', + 'awscrt==0.11.19', ], - python_requires='>=3.5', + python_requires='>=3.6', )