Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into regen_qna

* 'main' of https://github.com/Azure/azure-sdk-for-python: (38 commits)
  update code owner for identity and synapse (Azure#20941)
  [AutoRelease] t2-quota-2021-09-07-50984 (Azure#20558)
  [AutoRelease] t2-fluidrelay-2021-09-30-54645 (Azure#20962)
  [formrecognizer] Update doc strings for v3 (Azure#20920)
  update changelog (Azure#20958)
  [SchemaRegistry] add lru cache to avro serializer (Azure#20813)
  [formrecognizer] fixing error on ModelOperation to include details (Azure#20954)
  [rest] fix aiohttp read in rest (Azure#20952)
  docstring feedback from service team (Azure#20955)
  Prepare EG for release (Azure#20956)
  [formrecognizer] Print fields in custom documents samples (Azure#20904)
  Ma test fixes (Azure#20946)
  Update samples in ACR (Azure#20902)
  New Events (Azure#20951)
  skip v2.0 compatibility tests (Azure#20949)
  [Key Vault] Get default API version from sync client base (Azure#20379)
  [purview scanning] new release by new LLC version (Azure#20823)
  [Purview catalog] release for new api-version `2021-09-01` (Azure#20822)
  disable regression testing for beta version of questionanswering (Azure#20924)
  Oct release (Azure#20890)
  ...
  • Loading branch information
iscai-msft committed Sep 30, 2021
2 parents 2522ff3 + a8b85fc commit ed2e216
Show file tree
Hide file tree
Showing 1,081 changed files with 139,337 additions and 219,438 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Service team
####
# PRLabel: %Azure.Identity
/sdk/identity/ @chlowell @mccoyp @schaabs
/sdk/identity/ @chlowell @mccoyp @schaabs @xiangyan99

# PRLabel: %Event Hubs
/sdk/eventhub/ @annatisch @yunhaoling @swathipil @rakshith91
Expand Down Expand Up @@ -101,7 +101,7 @@
/sdk/servicebus/ @annatisch @yunhaoling @swathipil @rakshith91

# PRLabel: %Synapse
/sdk/synapse/ @aim-for-better @idear1203
/sdk/synapse/ @wonner @idear1203 @xiangyan99

# PRLabel: %EngSys
/sdk/template/ @Azure/azure-sdk-eng
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our [public developer docs](https://docs.microsoft.com/python/azure/) or our versioned [developer docs](https://azure.github.io/azure-sdk-for-python).

## _Disclaimer_

_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

## Getting started

For your convenience, each service has a separate set of libraries that you can choose to use instead of one, large Azure package. To get started with a specific library, see the `README.md` (or `README.rst`) file located in the library's project folder.
Expand Down
15 changes: 6 additions & 9 deletions eng/common/scripts/Detect-Api-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Param (
)

# Submit API review request and return status whether current revision is approved or pending or failed to create review
function Submit-Request($filePath)
function Submit-Request($filePath, $packageName)
{
$repoName = $RepoFullName
if (!$repoName) {
Expand All @@ -29,6 +29,7 @@ function Submit-Request($filePath)
$query.Add('commitSha', $CommitSha)
$query.Add('repoName', $repoName)
$query.Add('pullRequestNumber', $PullRequestNumber)
$query.Add('packageName', $packageName)
$uri = [System.UriBuilder]$APIViewUri
$uri.query = $query.toString()
Write-Host "Request URI: $($uri.Uri.OriginalString)"
Expand Down Expand Up @@ -71,6 +72,7 @@ function Log-Input-Params()
Write-Host "Language: $($Language)"
Write-Host "Commit SHA: $($CommitSha)"
Write-Host "Repo Name: $($RepoFullName)"
Write-Host "Package Name: $($PackageName)"
}

. (Join-Path $PSScriptRoot common.ps1)
Expand All @@ -95,7 +97,7 @@ foreach ($artifact in $ArtifactList)
if (Should-Process-Package -pkgPath $pkgPath -packageName $artifact.name)
{
$filePath = $pkgPath.Replace($ArtifactPath , "").Replace("\", "/")
$respCode = Submit-Request -filePath $filePath
$respCode = Submit-Request -filePath $filePath -packageName $artifact.name
if ($respCode -ne '200')
{
$responses[$artifact.name] = $respCode
Expand All @@ -108,12 +110,7 @@ foreach ($artifact in $ArtifactList)
}
}

if ($responses)
foreach($pkg in $responses.keys)
{
# Will update this with a link to wiki on how to resolve
Write-Warning "API change detection failed for following packages. Please check above for package level error details."
foreach($pkg in $responses.keys)
{
Write-Host "$pkg failed with $($responses[$pkg]) code"
}
Write-Host "API detection request status for $($pkg) : $($responses[$pkg])"
}
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/auth-dev-feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ steps:
displayName: 'Pip Authenticate to feed'
inputs:
artifactFeeds: $(DevFeedName)
onlyAddExtraIndex: true
onlyAddExtraIndex: false
1 change: 1 addition & 0 deletions eng/pipelines/templates/steps/verify-autorest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ steps:
- task: PythonScript@0
displayName: 'Verify autorest'
continueOnError: true
inputs:
scriptPath: 'scripts/devops_tasks/verify_autorest.py'
arguments: >-
Expand Down
3 changes: 3 additions & 0 deletions eng/tox/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ platform = linux: linux
passenv = *
setenv =
SPHINX_APIDOC_OPTIONS=members,undoc-members,inherited-members
PIP_EXTRA_INDEX_URL=https://pypi.python.org/simple
deps = {[base]deps}
changedir = {toxinidir}
install_command = python -m pip install {opts} {packages} --cache-dir {toxinidir}/../.tox_pip_cache_{envname}
Expand Down Expand Up @@ -225,6 +226,7 @@ changedir =
{toxinidir}
passenv = *
setenv =
{[testenv]setenv}
DEPENDENCY_TYPE=Latest
commands =
{[deptestcommands]commands}
Expand All @@ -240,6 +242,7 @@ deps =
changedir = {toxinidir}
passenv = *
setenv =
{[testenv]setenv}
DEPENDENCY_TYPE=Minimum
commands =
{[deptestcommands]commands}
Expand Down
2 changes: 1 addition & 1 deletion scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def find_whl(package_name, version, whl_directory):
def install_package_from_whl(
package_whl_path, working_dir, python_sym_link=sys.executable
):
commands = [python_sym_link, "-m", "pip", "install", package_whl_path]
commands = [python_sym_link, "-m", "pip", "install", package_whl_path, "--extra-index", "https://pypi.python.org/simple"]
run_check_call(commands, working_dir)
logging.info("Installed package from {}".format(package_whl_path))

Expand Down
1 change: 1 addition & 0 deletions scripts/devops_tasks/git_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'azure-communication-phonenumbers': '1.0.0',
'azure-communication-sms': '1.0.0',
'azure-search-documents': '11.2.0b3',
'azure-ai-language-questionanswering': '1.0.0b1'
}

# This method identifies release tag for latest or oldest released version of a given package
Expand Down
2 changes: 1 addition & 1 deletion scripts/devops_tasks/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _install_packages(self, dependent_pkg_path, pkg_to_exclude):
"Installing filtered dev requirements from {}".format(filtered_dev_req_path)
)
run_check_call(
[python_executable, "-m", "pip", "install", "-r", filtered_dev_req_path],
[python_executable, "-m", "pip", "install", "-r", filtered_dev_req_path, "--extra-index", "https://pypi.org/simple"],
dependent_pkg_path,
)
else:
Expand Down
1 change: 0 additions & 1 deletion scripts/devops_tasks/verify_autorest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import argparse
import os
import logging
import sys

from common_tasks import run_check_call

Expand Down
5 changes: 3 additions & 2 deletions sdk/containerregistry/azure-containerregistry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ The [Azure Identity library][identity] provides easy Azure Active Directory supp
from azure.containerregistry import ContainerRegistryClient
from azure.identity import DefaultAzureCredential

account_url = "https://MYCONTAINERREGISTRY.azurecr.io"
client = ContainerRegistryClient(account_url, DefaultAzureCredential())
account_url = "https://mycontainerregistry.azurecr.io"
audience = "https://management.azure.com"
client = ContainerRegistryClient(account_url, DefaultAzureCredential(), audience=audience)
```

## Key concepts
Expand Down
25 changes: 17 additions & 8 deletions sdk/containerregistry/azure-containerregistry/samples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Samples for Azure Container Registry

---
page_type: sample
languages:
Expand All @@ -10,14 +8,19 @@ products:
urlFragment: containerregistry-samples
---

# Samples for Azure Container Registry

These code samples show common scenario operations with the Azure Container Registry client library. The code samples assume an environment variable `CONTAINERREGISTRY_ENDPOINT` is set, which includes the name of the login server and the `https://` prefix. For more information on using AAD with Azure Container Registry, please see the service's [Authentication Overview](https://docs.microsoft.com/azure/container-registry/container-registry-authentication).
The async versions of the samples require Python 3.6 or later.


|**File Name**|**Description**|
|-------------|---------------|
|[sample_create_client.py][create_client] ([async version][create_client_async]) |Instantiate a client | Authorizing a `ContainerRegistryClient` object and `ContainerRepositoryClient` object |
|[sample_delete_old_tags.py][delete_old_tags] and [sample_delete_old_tags_async.py][delete_old_tags_async] | Delete tags from a repository |
|[sample_hello_world.py][hello_world] ([sample_hello_world_async.py][hello_world_async]) |Instantiate a `ContainerRegistryClient` object and `ContainerRepositoryClient` object |
|[sample_delete_tags.py][delete_tags] and [sample_delete_tags_async.py][delete_tags_async] | Delete tags from a repository |
|[sample_delete_images.py][delete_images] and [sample_delete_images_async.py][delete_images_async] | Delete images from a repository |
|[sample_set_image_properties.py][set_image_properties] and [sample_set_image_properties_async.py][set_image_properties_async] | Set read/write/delete properties on an image |
|[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.
Expand Down Expand Up @@ -49,7 +52,13 @@ Check out the [API reference documentation][rest_docs] to learn more about what

[container_registry_docs]: https://docs.microsoft.com/azure/container-registry/container-registry-intro

[create_client]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_create_client.py
[create_client_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_create_client_async.py
[delete_old_tags]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_delete_old_tags.py
[delete_old_tags_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_old_tags_async.py
[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
[delete_tags_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_tags_async.py
[delete_images]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_delete_images.py
[delete_images_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_images_async.py
[set_image_properties]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_set_image_properties.py
[set_image_properties_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_set_image_properties_async.py
[list_tags]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/sample_list_tags.py
[list_tags_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_list_tags_async.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# coding: utf-8

# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------

"""
FILE: sample_delete_images_async.py
DESCRIPTION:
This sample demonstrates deleting all but the most recent three images for each repository.
USAGE:
python sample_delete_images_async.py
Set the environment variables with your own values before running the sample:
1) CONTAINERREGISTRY_ENDPOINT - The URL of you Container Registry account
"""

import asyncio
from dotenv import find_dotenv, load_dotenv
import os

from azure.containerregistry import ManifestOrder
from azure.containerregistry.aio import ContainerRegistryClient
from azure.identity.aio import DefaultAzureCredential


class DeleteImagesAsync(object):
def __init__(self):
load_dotenv(find_dotenv())

async def delete_images(self):
# [START list_repository_names]
audience = "https://management.azure.com"
account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"]
credential = DefaultAzureCredential()
client = ContainerRegistryClient(account_url, credential, audience=audience)

async with client:
async for repository in client.list_repository_names():
print(repository)
# [END list_repository_names]

# [START list_manifest_properties]
# Keep the three most recent images, delete everything else
manifest_count = 0
async for manifest in client.list_manifest_properties(repository, order_by=ManifestOrder.LAST_UPDATE_TIME_DESCENDING):
manifest_count += 1
if manifest_count > 3:
await client.delete_manifest(repository, manifest.digest)
# [END list_manifest_properties]


async def main():
sample = DeleteImagesAsync()
await sample.delete_images()


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# --------------------------------------------------------------------------

"""
FILE: sample_delete_old_tags_async.py
FILE: sample_delete_tags_async.py
DESCRIPTION:
These samples demonstrates deleting the three oldest tags for each repository asynchronously.
This sample demonstrates deleting all but the most recent three tags for each repository.
USAGE:
python sample_delete_old_tags_async.py
python sample_delete_tags_async.py
Set the environment variables with your own values before running the sample:
1) CONTAINERREGISTRY_ENDPOINT - The URL of you Container Registry account
Expand All @@ -23,23 +23,21 @@
from dotenv import find_dotenv, load_dotenv
import os

from azure.containerregistry import TagOrder
from azure.containerregistry.aio import ContainerRegistryClient
from azure.identity.aio import DefaultAzureCredential

class DeleteOperations(object):

class DeleteTagsAsync(object):
def __init__(self):
load_dotenv(find_dotenv())
self.account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"]

async def delete_old_tags(self):
from azure.containerregistry import TagOrder
from azure.containerregistry.aio import (
ContainerRegistryClient,
)
from azure.identity.aio import DefaultAzureCredential

async def delete_tags(self):
# [START list_repository_names]
audience = "https://management.azure.com"
account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"]
credential = DefaultAzureCredential()
client = ContainerRegistryClient(account_url, credential)
client = ContainerRegistryClient(account_url, credential, audience=audience)

async with client:
async for repository in client.list_repository_names():
Expand All @@ -57,8 +55,8 @@ async def delete_old_tags(self):


async def main():
sample = DeleteOperations()
await sample.delete_old_tags()
sample = DeleteTagsAsync()
await sample.delete_tags()


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit ed2e216

Please sign in to comment.