Skip to content

Commit 24504bc

Browse files
authored
add pyproject toml (#3131)
1 parent 8878a2a commit 24504bc

382 files changed

Lines changed: 16776 additions & 10120 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: feature
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
Add pyproject.toml generation by default

cspell.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ words:
115115
- securityaadswagger
116116
- securityaadswaggercredentialflag
117117
- securityaadswaggerversiontolerant
118+
- setuppy
118119
- siameeee
119120
- spheredpg
120121
- subclient

packages/autorest.python/autorest/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,25 @@ def __init__(self, *, output_folder: Union[str, Path], autorestapi: AutorestAPI)
2222
super().__init__(output_folder=output_folder)
2323
self._autorestapi = autorestapi
2424

25+
def get_output_folder(self) -> Path:
26+
# Get the output folder from AutoRest configuration to resolve against the correct base and
27+
# convert URI to file system path by removing file:// prefix if present
28+
return Path(self._autorestapi.get_value("outputFolderUri").lstrip("file:"))
29+
2530
def read_file(self, path: Union[str, Path]) -> str:
2631
return self._autorestapi.read_file(path)
2732

2833
def write_file(self, filename: Union[str, Path], file_content: str) -> None:
2934
return self._autorestapi.write_file(filename, file_content)
3035

36+
def remove_file(self, filename: Union[str, Path]) -> None:
37+
try:
38+
file_path = self.get_output_folder() / Path(filename)
39+
if file_path.is_file():
40+
file_path.unlink()
41+
except (FileNotFoundError, OSError):
42+
pass
43+
3144
def list_file(self) -> List[str]:
3245
return self._autorestapi.list_inputs()
3346

packages/autorest.python/autorest/codegen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def get_options(self) -> Dict[str, Any]:
6464
"no-async": self._autorestapi.get_boolean_value("no-async"),
6565
"no-namespace-folders": self._autorestapi.get_boolean_value("no-namespace-folders"),
6666
"basic-setup-py": self._autorestapi.get_boolean_value("basic-setup-py"),
67+
"keep-setup-py": self._autorestapi.get_boolean_value("keep-setup-py"),
6768
"package-name": self._autorestapi.get_value("package-name"),
6869
"package-version": self._autorestapi.get_value("package-version"),
6970
"client-side-validation": self._autorestapi.get_boolean_value("client-side-validation"),

packages/autorest.python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "~0.14.2",
32+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTE2NTM4MS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.14.1.tgz",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "~4.19.1"

packages/autorest.python/samples/specification/azure-mgmt-test/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package-version: 1.0.0b1
1414
clear-output-folder: true
1515
version-tolerant: false
1616
package-mode: azure-mgmt
17+
keep-setup-py: true
1718
```
1819
1920
``` yaml $(python)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
7+
8+
[build-system]
9+
requires = ["setuptools>=61.0.0", "wheel"] # Requires 61.0.0 for dynamic version
10+
build-backend = "setuptools.build_meta"
11+
12+
[project]
13+
name = "azure-packagemode-batch"
14+
authors = [
15+
{ name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" },
16+
]
17+
description = "Microsoft Corporation Azure Package Mode Batch Mgmt Plane Client Library for Python"
18+
license = {text = "MIT License"}
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
29+
"License :: OSI Approved :: MIT License",
30+
]
31+
requires-python = ">=3.9"
32+
keywords = ["azure", "azure sdk"]
33+
34+
dependencies = [
35+
"msrest>=0.7.1",
36+
"azure-core>=1.35.0",
37+
"typing-extensions>=4.6.0",
38+
]
39+
dynamic = [
40+
"version", "readme"
41+
]
42+
43+
[project.urls]
44+
repository = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk"
45+
46+
[tool.setuptools.dynamic]
47+
version = {attr = "azure.packagemode.batch._version.VERSION"}
48+
readme = {file = ["README.md"], content-type = "text/markdown"}
49+
50+
[tool.setuptools.packages.find]
51+
exclude = [
52+
"tests*",
53+
"samples*",
54+
"azure",
55+
"azure.packagemode",
56+
]
57+
58+
[tool.setuptools.package-data]
59+
pytyped = ["py.typed"]

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/setup.py

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
7+
8+
[build-system]
9+
requires = ["setuptools>=61.0.0", "wheel"] # Requires 61.0.0 for dynamic version
10+
build-backend = "setuptools.build_meta"
11+
12+
[project]
13+
name = "azure-packagemode-dataplane"
14+
authors = [
15+
{ name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" },
16+
]
17+
description = "Microsoft Corporation Azure Package Mode Data Plane Client Library for Python"
18+
license = {text = "MIT License"}
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
29+
"License :: OSI Approved :: MIT License",
30+
]
31+
requires-python = ">=3.9"
32+
keywords = ["azure", "azure sdk"]
33+
34+
dependencies = [
35+
"msrest>=0.7.1",
36+
"azure-core>=1.35.0",
37+
"typing-extensions>=4.6.0",
38+
]
39+
dynamic = [
40+
"version", "readme"
41+
]
42+
43+
[project.urls]
44+
repository = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk"
45+
46+
[tool.setuptools.dynamic]
47+
version = {attr = "azure.packagemode.dataplane._version.VERSION"}
48+
readme = {file = ["README.md"], content-type = "text/markdown"}
49+
50+
[tool.setuptools.packages.find]
51+
exclude = [
52+
"tests*",
53+
"samples*",
54+
"azure",
55+
"azure.packagemode",
56+
]
57+
58+
[tool.setuptools.package-data]
59+
pytyped = ["py.typed"]

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/setup.py

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)