Skip to content

Commit

Permalink
bulk update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Apr 9, 2021
1 parent 977bfe9 commit df73fa8
Show file tree
Hide file tree
Showing 288 changed files with 30,989 additions and 2,902 deletions.
8 changes: 7 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ omit =
*/test*
env*

[paths]
source =
sdk/
**/sdk

[report]
exclude_lines =
pragma: no cover
if raw:
if custom_headers:
if headers:
if response.status_code not in
if response.status_code not in
if TYPE_CHECKING:
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ __pycache__/
# Virtual environment
env*/

# Codespace virtual environment
pythonenv*/

# PTVS analysis
.ptvs/

Expand All @@ -30,6 +33,7 @@ build/

# Test results
TestResults/
ENV_DIR/

# tox generated artifacts
test-junit-*.xml
Expand Down Expand Up @@ -84,7 +88,7 @@ src/build

# [begoldsm] ignore virtual env if it exists.
adlEnv/

venv/
code_reports

# Azure Storage test credentials
Expand All @@ -96,4 +100,7 @@ sdk/storage/azure-storage-file-datalake/tests/settings_real.py
sdk/cosmos/azure-cosmos/test/test_config.py

# temp path to to run regression test
.tmp_code_path/
.tmp_code_path/

# env vars
.env
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ members of the project's leadership.
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
available at [https://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
18 changes: 13 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing to Azure Python SDK

If you would like to become an active contributor to this project please
follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/).
follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](https://opensource.microsoft.com/collaborate/).

## Building and Testing

Expand Down Expand Up @@ -111,9 +111,17 @@ Mypy install and run.
**Example: Invoke tox, breaking into the debugger on failure**
`tox -e whl -c ../../../eng/tox/tox.ini -- --pdb`

### Daily Dev Build
Daily dev build version of Azure sdk packages for python are available and are uploaded to Azure devops feed nightly. We have also created a tox environment to test a package against dev built version of dependent packages. Below is the link to Azure devops feed.
`https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-python`
### Performance Testing

SDK performance testing is supported via the custom `perfstress` framework. For full details on this framework, and how to write and run tests for an SDK - see the [perfstress tests documentation](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/perfstress_tests.md).

### More Reading

We maintain an [additional document](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/eng_sys_checks.md) that has a ton of detail as to what is actually _happening_ in these executions.

### Dev Feed
Daily dev build version of Azure sdk packages for python are available and are uploaded to Azure devops feed daily. We have also created a tox environment to test a package against dev built version of dependent packages. Below is the link to Azure devops feed.
[`https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-python`](https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-python)

##### To install latest dev build version of a package
```
Expand All @@ -139,4 +147,4 @@ This tox test( devtest) will fail if installed dependent packages are not dev bu
## Code of Conduct
This project's code of conduct can be found in the
[CODE_OF_CONDUCT.md file](https://github.com/Azure/azure-sdk-for-python/blob/master/CODE_OF_CONDUCT.md)
(v1.4.0 of the http://contributor-covenant.org/ CoC).
(v1.4.0 of the https://contributor-covenant.org/ CoC).
20 changes: 15 additions & 5 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
This file list any third-party libraries or other resources that may be
distributed under licenses different than the Azure SDK for Python software.
NOTICES AND INFORMATION
Do Not Translate or Localize

In the event that we accidentally failed to list a required notice, please
bring it to our attention by opening an issue.
This software incorporates material from third parties. Microsoft makes certain
open source code available at https://3rdpartysource.microsoft.com, or you may
send a check or money order for US $5.00, including the product name, the open
source component name, and version number, to:

The attached notices are provided for information only.
Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA

Notwithstanding any other terms, you may reverse engineer this software to the
extent required to debug changes to any libraries licensed under the GNU Lesser
General Public License.
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Packages](https://img.shields.io/badge/packages-latest-blue.svg)](https://azure.github.io/azure-sdk/releases/latest/python.html) [![Dependencies](https://img.shields.io/badge/dependency-report-blue.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-python/dependencies/dependencies.html) [![DepGraph](https://img.shields.io/badge/dependency-graph-blue.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-python/dependencies/InterdependencyGraph.html) [![Python](https://img.shields.io/pypi/pyversions/azure-core.svg?maxAge=2592000)](https://pypi.python.org/pypi/azure/) [![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/python/python%20-%20core%20-%20ci?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=458&branchName=master)

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/en-us/python/azure/) or our versioned [developer docs](https://azure.github.io/azure-sdk-for-python).
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).

## Getting started

Expand All @@ -17,25 +17,34 @@ The client libraries are supported on Python 2.7 and 3.5.3 or later.
## Packages available

Each service might have a number of libraries available from each of the following categories:
* [Client - New Releases](#Client-New-Releases)
* [Client - Previous Versions](#Client-Previous-Versions)
* [Management](#Management)
* [Client - New Releases](#client-new-releases)
* [Client - Previous Versions](#client-previous-versions)
* [Management - New Releases](#management-new-releases)
* [Management - Previous Versions](#management-previous-versions)

### Client: New Releases

New wave of packages that we are announcing as **GA** and several that are currently releasing in **preview**. These libraries allow you to use and consume existing resources and interact with them, for example: upload a blob. These libraries share a number of core functionalities such as: retries, logging, transport protocols, authentication protocols, etc. that can be found in the [azure-core](./sdk/core/azure-core) library. You can learn more about these libraries by reading guidelines that they follow [here](https://azure.github.io/azure-sdk/python_introduction.html).
New wave of packages that we are announcing as **GA** and several that are currently releasing in **preview**. These libraries allow you to use and consume existing resources and interact with them, for example: upload a blob. These libraries share a number of core functionalities such as: retries, logging, transport protocols, authentication protocols, etc. that can be found in the [azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core) library. You can learn more about these libraries by reading guidelines that they follow [here](https://azure.github.io/azure-sdk/python/guidelines/index.html).

You can find the [most up to date list of all of the new packages on our page](https://azure.github.io/azure-sdk/releases/latest/index.html#python-packages)

> NOTE: If you need to ensure your code is ready for production use one of the stable, non-preview libraries.
### Client: Previous Versions

Last stable versions of packages that have been provided for usage with Azure and are production-ready. These libraries provide you with similar functionalities to the Preview ones as they allow you to use and consume existing resources and interact with them, for example: upload a blob. They might not implement the [guidelines](https://azure.github.io/azure-sdk/python_introduction.html) or have the same feature set as the Novemeber releases. They do however offer wider coverage of services.
Last stable versions of packages that have been provided for usage with Azure and are production-ready. These libraries provide you with similar functionalities to the Preview ones as they allow you to use and consume existing resources and interact with them, for example: upload a blob. They might not implement the [guidelines](https://azure.github.io/azure-sdk/python/guidelines/index.html) or have the same feature set as the Novemeber releases. They do however offer wider coverage of services.

### Management
### Management: New Releases
A new set of management libraries that follow the [Azure SDK Design Guidelines for Python](https://azure.github.io/azure-sdk/python/guidelines/) are now available. These new libraries provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.
Documentation and code samples for these new libraries can be found [here](https://aka.ms/azsdk/python/mgmt). In addition, a migration guide that shows how to transition from older versions of libraries is located [here](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/sphinx/mgmt_quickstart.rst#migration-guide).

Libraries which enable you to provision specific resources. They are responsible for directly mirroring and consuming Azure service's REST endpoints. The management libraries use the `azure-mgmt-<service name>` convention for their package names.
You can find the [most up to date list of all of the new packages on our page](https://azure.github.io/azure-sdk/releases/latest/mgmt/python.html)

> NOTE: If you need to ensure your code is ready for production use one of the stable, non-preview libraries. Also, if you are experiencing authentication issues with the management libraries after upgrading certain packages, it's possible that you upgraded to the new versions of SDK without changing the authentication code, please refer to the migration guide mentioned above for proper instructions.
### Management: Previous Versions
For a complete list of management libraries which enable you to provision and manage Azure resources, please [check here](https://azure.github.io/azure-sdk/releases/latest/all/python.html). They might not have the same feature set as the new releases but they do offer wider coverage of services.
Management libraries can be identified by namespaces that start with `azure-mgmt-`, e.g. `azure-mgmt-compute`

## Need help?

Expand All @@ -53,7 +62,7 @@ Security issues and bugs should be reported privately, via email, to the Microso

## Contributing

For details on contributing to this repository, see the [contributing guide](CONTRIBUTING.md).
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-python/blob/master/CONTRIBUTING.md).

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
Expand Down
41 changes: 37 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
# Security Policy
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->

## Reporting a Vulnerability
## Security

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <[email protected]>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

Please do not open issues for anything you think might have a security implication.
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
7 changes: 4 additions & 3 deletions build_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import argparse
import os
import glob
from subprocess import check_call
import sys

from subprocess import check_call

DEFAULT_DEST_FOLDER = "./dist"

Expand All @@ -19,8 +20,8 @@ def create_package(name, dest_folder=DEFAULT_DEST_FOLDER):
absdirs = [os.path.dirname(package) for package in (glob.glob('{}/setup.py'.format(name)) + glob.glob('sdk/*/{}/setup.py'.format(name)))]

absdirpath = os.path.abspath(absdirs[0])
check_call(['python', 'setup.py', 'bdist_wheel', '-d', dest_folder], cwd=absdirpath)
check_call(['python', 'setup.py', "sdist", "--format", "zip", '-d', dest_folder], cwd=absdirpath)
check_call([sys.executable, 'setup.py', 'bdist_wheel', '-d', dest_folder], cwd=absdirpath)
check_call([sys.executable, 'setup.py', "sdist", "--format", "zip", '-d', dest_folder], cwd=absdirpath)


if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions ci_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ trigger:
branches:
include:
- master
- main
- hotfix/*
- release/*
- restapi*
Expand All @@ -16,6 +17,7 @@ pr:
branches:
include:
- master
- main
- feature/*
- hotfix/*
- release/*
Expand Down
2 changes: 1 addition & 1 deletion common/smoketest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pip install -r requiriments.txt
pip install -r requiriments_async.txt
```

If a python version below 3.5 is being used, it is still possible to run the samples. When it gets to the async tests a message `'Async not suported'` will be displayed.
If a python version below 3.5 is being used, it is still possible to run the samples. When it gets to the async tests a message `'Async not supported'` will be displayed.

## Key concepts

Expand Down
25 changes: 15 additions & 10 deletions common/smoketest/key_vault_base.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from azure.identity import DefaultAzureCredential, KnownAuthorities
from azure.identity import AzureAuthorityHosts, DefaultAzureCredential


class KeyVaultBase:
credential_type = DefaultAzureCredential
host_alias_map = {
'AzureChinaCloud': KnownAuthorities.AZURE_CHINA,
'AzureGermanCloud': KnownAuthorities.AZURE_GERMANY,
'AzureUSGovernment': KnownAuthorities.AZURE_GOVERNMENT,
'AzureCloud': KnownAuthorities.AZURE_PUBLIC_CLOUD,
"AzureChinaCloud": (AzureAuthorityHosts.AZURE_CHINA, "2016-10-01"),
"AzureGermanCloud": (AzureAuthorityHosts.AZURE_GERMANY, "2016-10-01"),
"AzureUSGovernment": (AzureAuthorityHosts.AZURE_GOVERNMENT, "2016-10-01"),
"AzureCloud": (AzureAuthorityHosts.AZURE_PUBLIC_CLOUD, "7.1"),
}

# Instantiate a default credential based on the credential_type
def get_default_credential(self, authority_host_alias=None):
alias = authority_host_alias or os.environ.get("AZURE_CLOUD")
authority_host = self.host_alias_map.get(alias, KnownAuthorities.AZURE_PUBLIC_CLOUD)
return self.credential_type(authority=authority_host)
def get_client_args(self, authority_host_alias=None):
alias = authority_host_alias or os.environ.get("AZURE_CLOUD", "AzureCloud")
authority_host, api_version = self.host_alias_map[alias]
credential = self.credential_type(authority=authority_host)
return {"api_version": api_version, "credential": credential, "vault_url": os.environ["AZURE_PROJECT_URL"]}
5 changes: 5 additions & 0 deletions common/smoketest/key_vault_base_async.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from key_vault_base import KeyVaultBase
from azure.identity.aio import DefaultAzureCredential


class KeyVaultBaseAsync(KeyVaultBase):
credential_type = DefaultAzureCredential
10 changes: 3 additions & 7 deletions common/smoketest/key_vault_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
import uuid
from azure.keyvault.certificates import CertificateClient, CertificatePolicy
from key_vault_base import KeyVaultBase


class KeyVaultCertificates(KeyVaultBase):
def __init__(self):

credential = self.get_default_credential()
self.certificate_client = CertificateClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)

args = self.get_client_args()
self.certificate_client = CertificateClient(**args)
self.certificate_name = "cert-name-" + uuid.uuid1().hex

def create_certificate(self):
Expand Down
Loading

0 comments on commit df73fa8

Please sign in to comment.