From 57b7aacfe58e40812401a70efebd7d1b6d21f236 Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Sat, 15 Jan 2022 10:00:21 +0800 Subject: [PATCH] [ACR] Change to support python3.6 or above only (#22325) --- .../azure-containerregistry/README.md | 7 ++++++- .../_container_registry_client.py | 2 -- .../azure-containerregistry/dev_requirements.txt | 2 +- .../azure-containerregistry/samples/README.md | 5 ++--- .../azure-containerregistry/setup.cfg | 2 -- .../azure-containerregistry/setup.py | 16 ++++------------ .../azure-containerregistry/tests/conftest.py | 8 -------- .../tests/perfstress_tests/README.md | 2 +- 8 files changed, 14 insertions(+), 30 deletions(-) delete mode 100644 sdk/containerregistry/azure-containerregistry/setup.cfg diff --git a/sdk/containerregistry/azure-containerregistry/README.md b/sdk/containerregistry/azure-containerregistry/README.md index 531f4bca7627..b87a6255fb12 100644 --- a/sdk/containerregistry/azure-containerregistry/README.md +++ b/sdk/containerregistry/azure-containerregistry/README.md @@ -11,6 +11,10 @@ Use the client library for Azure Container Registry to: [Source code][source] | [Package (Pypi)][package] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + ## Getting started ### Install the package @@ -23,7 +27,8 @@ pip install --pre azure-containerregistry ### Prerequisites -You need an [Azure subscription][azure_sub] and a [Container Registry account][container_registry_docs] to use this package. +* Python 3.6 or later is required to use this package. +* You need an [Azure subscription][azure_sub] and a [Container Registry account][container_registry_docs] to use this package. To create a new Container Registry, you can use the [Azure Portal][container_registry_create_portal], [Azure PowerShell][container_registry_create_ps], or the [Azure CLI][container_registry_create_cli]. diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index bb3a8cef54b5..7eadad5e563d 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -183,8 +183,6 @@ def extract_data(pipeline_response): link = None if "Link" in pipeline_response.http_response.headers.keys(): link = _parse_next_link(pipeline_response.http_response.headers["Link"]) - elif "link" in pipeline_response.http_response.headers.keys(): # python 2.7 turns this into lowercase - link = _parse_next_link(pipeline_response.http_response.headers["link"]) return link, iter(list_of_elem) def get_next(next_link=None): diff --git a/sdk/containerregistry/azure-containerregistry/dev_requirements.txt b/sdk/containerregistry/azure-containerregistry/dev_requirements.txt index 49ec18358303..5e41d00a6f6d 100644 --- a/sdk/containerregistry/azure-containerregistry/dev_requirements.txt +++ b/sdk/containerregistry/azure-containerregistry/dev_requirements.txt @@ -2,6 +2,6 @@ -e ../../../tools/azure-devtools ../../core/azure-core ../azure-mgmt-containerregistry -aiohttp>=3.0; python_version >= '3.5' +aiohttp>=3.0; python_version >= '3.6' azure-identity msrestazure>=0.4.11 \ No newline at end of file diff --git a/sdk/containerregistry/azure-containerregistry/samples/README.md b/sdk/containerregistry/azure-containerregistry/samples/README.md index 05ebbee4d5bd..885aa79f3f45 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/README.md +++ b/sdk/containerregistry/azure-containerregistry/samples/README.md @@ -23,7 +23,7 @@ The async versions of the samples require Python 3.6 or later. |[sample_list_tags.py][list_tags] and [sample_list_tags_async.py][list_tags_async] | List tags on an image using an anonymous access | ### Prerequisites -* Python 2.7, or 3.6 or later is required to use this package. +* Python 3.6 or later is required to use this package. * You need an [Azure subscription][azure_sub] and a [Container Registry account][container_registry_docs] to use this package. ## Setup @@ -48,10 +48,9 @@ Check out the [API reference documentation][rest_docs] to learn more about what +[azure_sub]: https://azure.microsoft.com/free/ [rest_docs]: https://docs.microsoft.com/rest/api/containerregistry/ - [container_registry_docs]: https://docs.microsoft.com/azure/container-registry/container-registry-intro - [hello_world]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_hello_world.py [hello_world_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_hello_world_async.py [delete_tags]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_delete_tags.py diff --git a/sdk/containerregistry/azure-containerregistry/setup.cfg b/sdk/containerregistry/azure-containerregistry/setup.cfg deleted file mode 100644 index 3c6e79cf31da..000000000000 --- a/sdk/containerregistry/azure-containerregistry/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal=1 diff --git a/sdk/containerregistry/azure-containerregistry/setup.py b/sdk/containerregistry/azure-containerregistry/setup.py index f502a49c0e47..60376b3d39fc 100644 --- a/sdk/containerregistry/azure-containerregistry/setup.py +++ b/sdk/containerregistry/azure-containerregistry/setup.py @@ -3,13 +3,7 @@ from io import open import re -# example setup.py Feel free to copy the entire "azure-template" folder into a package folder named -# with "azure-". Ensure that the below arguments to setup() are updated to reflect -# your package. - -# this setup.py is set up in a specific way to keep the azure* and azure-mgmt-* namespaces WORKING all the way -# up from python 2.7. Reference here: https://github.com/Azure/azure-sdk-for-python/wiki/Azure-packaging - +# Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-containerregistry" PACKAGE_PPRINT_NAME = "Azure Container Registry" @@ -43,13 +37,13 @@ classifiers=[ "Development Status :: 4 - Beta", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "License :: OSI Approved :: MIT License", ], packages=find_packages( @@ -59,13 +53,11 @@ "azure", ] ), + python_requires=">=3.6", install_requires=[ "azure-core>=1.20.0,<2.0.0", "msrest>=0.6.21", ], - extras_require={ - # ":python_version<'3.0'": ["azure-nspkg"], - }, project_urls={ "Bug Reports": "https://github.com/Azure/azure-sdk-for-python/issues", "Source": "https://github.com/Azure/azure-sdk-python", diff --git a/sdk/containerregistry/azure-containerregistry/tests/conftest.py b/sdk/containerregistry/azure-containerregistry/tests/conftest.py index c29ec3831836..7566eb4bf7f9 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/conftest.py +++ b/sdk/containerregistry/azure-containerregistry/tests/conftest.py @@ -5,16 +5,8 @@ # license information. # -------------------------------------------------------------------------- -import sys - # Fixture from testcase import load_registry -# Ignore async tests for Python < 3.5 -collect_ignore_glob = [] -if sys.version_info < (3, 5): - collect_ignore_glob.append("*_async.py") - - def pytest_configure(config): config.addinivalue_line("usefixtures", "load_registry") diff --git a/sdk/containerregistry/azure-containerregistry/tests/perfstress_tests/README.md b/sdk/containerregistry/azure-containerregistry/tests/perfstress_tests/README.md index 883c6574168e..6fccebddc438 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/perfstress_tests/README.md +++ b/sdk/containerregistry/azure-containerregistry/tests/perfstress_tests/README.md @@ -2,7 +2,7 @@ In order to run the performance tests, the `azure-devtools` package must be installed. This is done as part of the `dev_requirements` install. Start by creating a new virtual environment for your perf tests. This will need to be a -Python 3 environment, preferably >=3.7. +Python 3 environment, preferably >=3.6. ### Setup for test resources