Skip to content

Commit 44af22f

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-python into regenerate_keys
* 'master' of https://github.com/Azure/azure-sdk-for-python: Add foundations for eng/common restructure (Azure#12725) Sync eng/common directory with azure-sdk-tools repository (Azure#12730) fix flaky test (Azure#12721) python link verification (Azure#12543) [ServiceBus] Remove legacy control client (Azure#12644) mirror update from MicrosoftDocs/azure-docs-sdk-python#709 (Azure#12691) [Service Bus] Rule supports parameters of sql expressions and properties of cor filter with multiple data types (Azure#12580)
2 parents e1f08b2 + 612d7bc commit 44af22f

File tree

313 files changed

+1619
-15311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+1619
-15311
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Management libraries can be identified by namespaces that start with `azure-mgmt
4747
## Need help?
4848

4949
* For detailed documentation visit our [Azure SDK for Python documentation](https://aka.ms/python-docs)
50-
* File an issue via [Github Issues](../../issues)
50+
* File an issue via [Github Issues](https://github.com/Azure/azure-sdk-for-python/issues)
5151
* Check [previous questions](https://stackoverflow.com/questions/tagged/azure+python) or ask new ones on StackOverflow using `azure` and `python` tags.
5252

5353
### Community

doc/dev/mgmt/swagger/multi_api/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is the AutoRest configuration file for Network.
88

99
## Getting Started
1010

11-
To build the SDK for Network, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:
11+
To build the SDK for Network, simply [Install AutoRest](https://github.com/Azure/autorest/blob/master/docs/installing-autorest.md) and in this folder, run:
1212

1313
> `autorest`
1414
@@ -66,4 +66,4 @@ swagger-to-sdk:
6666

6767
## Python
6868

69-
See configuration in [readme.python.md](./readme.python.md)
69+
See configuration in [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md)

doc/dev/mgmt/swagger/single_api/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is the AutoRest configuration file for Cdn.
88

99
---
1010
## Getting Started
11-
To build the SDK for Cdn, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:
11+
To build the SDK for Cdn, simply [Install AutoRest](https://github.com/Azure/autorest/blob/master/docs/installing-autorest.md) and in this folder, run:
1212

1313
> `autorest`
1414

doc/dev/mgmt/swagger_conf.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,38 @@ Writing the readme is the responsibility of the Python SDK team. There is curren
1818
- Readme that handles only one API version, and generates packages that handle one API version only
1919
- Readme that handles several API versions, and generates packages with multiples API and profile supports
2020

21-
These templates can be found in the [single_api](./single_api) and the [multi_api](./multi_api) folders.
21+
These templates can be found in the [single_api](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/single_api) and the [multi_api](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api) folders.
2222

2323

2424
### Single API readmes
2525

2626
This one is the most simple:
27-
- Copy the [readme.python.md](./single_api/readme.python.md) and replace `servicetoreplace` by your service name
28-
- Be sure the main [readme.md](./single_api/readme.md) contains a "swagger-to-sdk" section with Python
27+
- Copy the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/single_api/readme.python.md) and replace `servicetoreplace` by your service name
28+
- Be sure the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/single_api/readme.md) contains a "swagger-to-sdk" section with Python
2929

3030
### Multi API readmes
3131

32-
When doing multi-api packages, it means you have shipping several "tags" of the main readme as one package. Autorest is calling this process a "batch" call, and this is the purpose of the "batch" section in [readme.python.md](./multi_api/readme.python.md).
32+
When doing multi-api packages, it means you have shipping several "tags" of the main readme as one package. Autorest is calling this process a "batch" call, and this is the purpose of the "batch" section in [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md).
3333

3434
In order to be sure the correct tags exist, you can use the following script:
3535
```shell
3636
python ./scripts/multi_api_readme_help.py /azure-rest-api-specs/specification/service/resource-manager/
3737
```
3838

3939
This script will analyze the Swaggers available, and suggests on stdout:
40-
- A list of tags for the main [readme.md](./multi_api/readme.md)
41-
- A batch declaration for the [readme.python.md](./multi_api/readme.python.md)
40+
- A list of tags for the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.md)
41+
- A batch declaration for the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md)
4242

4343
This script is not perfect that it *does* require manual review of the output and not a direct copy/paste.
4444

4545
It's important for Python that tags represents only *ONE* unique API version. It's why it's pretty common that Python uses a set of tags that other languages don't use.
4646

4747
Once you know the list of tags you need to generate:
4848

49-
- Copy the [readme.python.md](./multi_api/readme.python.md) and replace `servicetoreplace` by your service name
50-
- Update the batch list of [readme.python.md](./multi_api/readme.python.md)
51-
- Be sure you have one tag section for each batch entry in [readme.python.md](./multi_api/readme.python.md)
52-
- Be sure the main [readme.md](./multi_api/readme.md) contains a "swagger-to-sdk" section with Python with an `afterscripts` section like the one in the template.
49+
- Copy the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md) and replace `servicetoreplace` by your service name
50+
- Update the batch list of [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md)
51+
- Be sure you have one tag section for each batch entry in [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.python.md)
52+
- Be sure the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/dev/mgmt/swagger/multi_api/readme.md) contains a "swagger-to-sdk" section with Python with an `afterscripts` section like the one in the template.
5353

5454
The `afterscripts` will execute a Jinja template to create a client to link together all the batch generated autorest ([example](https://github.com/Azure/azure-sdk-for-python/blob/4a7c67189591b052fe2b5769847ff68f7845386d/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py))
5555

eng/common/scripts/Verify-Links.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function ResolveUri ([System.Uri]$referralUri, [string]$link)
8787
return $null
8888
}
8989

90-
if ($null -ne $ignoreLinks -and $ignoreLinks.Contains($link)) {
90+
if ($null -ne $ignoreLinks -and ($ignoreLinks.Contains($link) -or $ignoreLinks.Contains($linkUri.ToString()))) {
9191
Write-Verbose "Ignoring invalid link $linkUri because it is in the ignore file."
9292
return $null
9393
}

eng/ignore-links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://docs.microsoft.com/python/api/overview/azure/{{package_doc_id}}

eng/pipelines/aggregate-reports.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
vmImage: 'windows-2019'
1616

1717
steps:
18+
- template: ../common/pipelines/templates/steps/verify-links.yml
19+
parameters:
20+
Directory: ""
21+
1822
- template: ./templates/steps/analyze.yml
1923

2024
- task: AzureFileCopy@2

eng/pipelines/templates/jobs/archetype-sdk-client.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
vmImage: 'ubuntu-18.04'
6969

7070
steps:
71+
- template: ../../../common/pipelines/templates/steps/verify-links.yml
72+
parameters:
73+
Directory: "sdk/${{ parameters.ServiceDirectory }}"
74+
7175
- template: ../steps/analyze.yml
7276
parameters:
7377
ServiceDirectory: ${{ parameters.ServiceDirectory }}

eng/scripts/Language-Settings.ps1

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
$Language = "python"
2+
$Lang = "python"
3+
$PackageRepository = "PyPI"
4+
$packagePattern = "*.zip"
5+
$MetadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/python-packages.csv"
6+
7+
function Extract-python-PkgProperties ($pkgPath, $serviceName, $pkgName)
8+
{
9+
$pkgName = $pkgName.Replace('_', '-')
10+
if (Test-Path (Join-Path $pkgPath "setup.py"))
11+
{
12+
$setupLocation = $pkgPath.Replace('\','/')
13+
pushd $RepoRoot
14+
$setupProps = (python -c "import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import parse_setup; obj=parse_setup('$setupLocation'); print('{0},{1}'.format(obj[0], obj[1]));") -split ","
15+
popd
16+
if (($setupProps -ne $null) -and ($setupProps[0] -eq $pkgName))
17+
{
18+
return [PackageProps]::new($setupProps[0], $setupProps[1], $pkgPath, $serviceName)
19+
}
20+
}
21+
return $null
22+
}
23+
24+
# Returns the pypi publish status of a package id and version.
25+
function IsPythonPackageVersionPublished($pkgId, $pkgVersion) {
26+
try
27+
{
28+
$existingVersion = (Invoke-RestMethod -MaximumRetryCount 3 -Method "Get" -uri "https://pypi.org/pypi/$pkgId/$pkgVersion/json").info.version
29+
# if existingVersion exists, then it's already been published
30+
return $True
31+
}
32+
catch
33+
{
34+
$statusCode = $_.Exception.Response.StatusCode.value__
35+
$statusDescription = $_.Exception.Response.StatusDescription
36+
37+
# if this is 404ing, then this pkg has never been published before
38+
if ($statusCode -eq 404)
39+
{
40+
return $False
41+
}
42+
Write-Host "PyPI Invocation failed:"
43+
Write-Host "StatusCode:" $statusCode
44+
Write-Host "StatusDescription:" $statusDescription
45+
exit(1)
46+
}
47+
}
48+
49+
# Parse out package publishing information given a python sdist of ZIP format.
50+
function Parse-python-Package($pkg, $workingDirectory) {
51+
$pkg.Basename -match $SDIST_PACKAGE_REGEX | Out-Null
52+
53+
$pkgId = $matches["package"]
54+
$pkgVersion = $matches["versionstring"]
55+
56+
$workFolder = "$workingDirectory$($pkg.Basename)"
57+
$origFolder = Get-Location
58+
$releaseNotes = ""
59+
$readmeContent = ""
60+
61+
New-Item -ItemType Directory -Force -Path $workFolder
62+
Expand-Archive -Path $pkg -DestinationPath $workFolder
63+
64+
$changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]
65+
if ($changeLogLoc) {
66+
$releaseNotes = Get-ChangeLogEntryAsString -ChangeLogLocation $changeLogLoc -VersionString $pkgVersion
67+
}
68+
69+
$readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md") | Select-Object -Last 1
70+
71+
if ($readmeContentLoc) {
72+
$readmeContent = Get-Content -Raw $readmeContentLoc
73+
}
74+
75+
Remove-Item $workFolder -Force -Recurse -ErrorAction SilentlyContinue
76+
77+
return New-Object PSObject -Property @{
78+
PackageId = $pkgId
79+
PackageVersion = $pkgVersion
80+
Deployable = $forceCreate -or !(IsPythonPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion)
81+
ReleaseNotes = $releaseNotes
82+
ReadmeContent = $readmeContent
83+
}
84+
}
85+
86+
# Stage and Upload Docs to blob Storage
87+
function StageAndUpload-python-Docs()
88+
{
89+
$PublishedDocs = Get-ChildItem "$DocLocation" | Where-Object -FilterScript {$_.Name.EndsWith(".zip")}
90+
91+
foreach ($Item in $PublishedDocs)
92+
{
93+
$PkgName = $Item.BaseName
94+
$ZippedDocumentationPath = Join-Path -Path $DocLocation -ChildPath $Item.Name
95+
$UnzippedDocumentationPath = Join-Path -Path $DocLocation -ChildPath $PkgName
96+
$VersionFileLocation = Join-Path -Path $UnzippedDocumentationPath -ChildPath "version.txt"
97+
98+
Expand-Archive -Force -Path $ZippedDocumentationPath -DestinationPath $UnzippedDocumentationPath
99+
100+
$Version = $(Get-Content $VersionFileLocation).Trim()
101+
102+
Write-Host "Discovered Package Name: $PkgName"
103+
Write-Host "Discovered Package Version: $Version"
104+
Write-Host "Directory for Upload: $UnzippedDocumentationPath"
105+
106+
Upload-Blobs -DocDir $UnzippedDocumentationPath -PkgName $PkgName -DocVersion $Version
107+
}
108+
}

sdk/advisor/azure-mgmt-advisor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is the Microsoft Azure Advisor Client Library.
44
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
5-
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)
5+
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77

88
# Usage

0 commit comments

Comments
 (0)