Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depend on http-client-python #2855

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .chronus/changes/depend_on_typespec-2024-8-25-19-12-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: feature
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Depend completely on `@typespec/http-client-python`
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@ node_modules/
# Generated test folders
test/services/*/_generated
**/autorest.python/generator
**/autorest.python/scripts/eng
**/autorest.python/eng/scripts
**/typespec-python/generator
**/typespec-python/eng/scripts
24 changes: 12 additions & 12 deletions eng/pipelines/ci-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ steps:
displayName: List installed packages
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run lint --command eslint --skipWarning ${{ parameters.skipWarning }}
displayName: Eslint
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}
# - script: pnpm run lint --command eslint --skipWarning ${{ parameters.skipWarning }}
# displayName: Eslint
# workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run lint --command pylint
displayName: Pylint
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}
# - script: pnpm run lint --command pylint
# displayName: Pylint
# workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run lint --command mypy
displayName: Mypy
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}
# - script: pnpm run lint --command mypy
# displayName: Mypy
# workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run lint --command pyright
displayName: Pyright
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}
# - script: pnpm run lint --command pyright
# displayName: Pyright
# workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run format
displayName: Black
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@
"homepage": "https://github.com/Azure/autorest.python#readme",
"devDependencies": {
"@actions/github": "6.0.0",
"@azure-tools/cadl-ranch": "~0.14.5",
"@azure-tools/cadl-ranch": "~0.14.6",
"@chronus/chronus": "^0.12.1",
"@chronus/github": "^0.4.3",
"@eslint/js": "^9.10.0",
"@chronus/github": "^0.4.4",
"@eslint/js": "^9.11.1",
"@typespec/prettier-plugin-typespec": "~0.60.0",
"autorest": "~3.7.1",
"cross-env": "^7.0.3",
"eslint": "^9.10.0",
"eslint": "^9.11.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-unicorn": "^55.0.0",
"typescript-eslint": "^8.5.0",
"prettier": "~3.3.3",
"syncpack": "^13.0.0",
"typescript": "~5.6.2"
"typescript": "~5.6.2",
"typescript-eslint": "^8.7.0"
},
"syncpack": {
"dependencyTypes": [
Expand Down
14 changes: 7 additions & 7 deletions packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"build": "tsx ./scripts/copy-generator.ts --force",
"install": "tsx ./scripts/copy-generator.ts && node ./scripts/run-python3.js ./scripts/install.py",
"debug": "node ./scripts/run-python3.js ./scripts/start.py --debug",
"test": "tsx ./scripts/eng/run-tests.ts --validFolders azure/legacy azure/version-tolerant vanilla/legacy vanilla/version-tolerant dpg/version-tolerant",
"lint": "tsx ./scripts/eng/lint.ts --folderName autorest --skipEslint true",
"format": "tsx ./scripts/eng/format.ts"
"test": "tsx ./eng/scripts/ci/run-tests.ts --validFolders azure/legacy azure/version-tolerant vanilla/legacy vanilla/version-tolerant dpg/version-tolerant",
"lint": "tsx ./eng/scripts/ci/lint.ts --folderName autorest",
"format": "tsx ./eng/scripts/ci/format.ts --pythonPath ./node_modules/@typespec/http-client-python/venv"
},
"main": "index.js",
"repository": {
Expand All @@ -34,10 +34,10 @@
"tsx": "4.17.0"
},
"devDependencies": {
"@microsoft.azure/autorest.testserver": "^3.3.46",
"typescript": "~5.1.3",
"@azure-tools/typespec-python": "workspace:^",
"chalk": "5.3.0"
"@microsoft.azure/autorest.testserver": "^3.3.50",
"@typespec/http-client-python": "0.1.0",
"chalk": "5.3.0",
"typescript": "~5.1.6"
},
"files": [
"autorest/**/*.py",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ._version import VERSION


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.

Note that all parameters used to create this instance are saved as instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .._version import VERSION


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.

Note that all parameters used to create this instance are saved as instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand All @@ -7,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
Expand All @@ -30,7 +29,7 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand All @@ -53,14 +52,14 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head200(self, **kwargs: Any) -> None:
"""Return 200 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -94,14 +93,14 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
return cls(pipeline_response, None, {}) # type: ignore

@distributed_trace_async
async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head204(self, **kwargs: Any) -> None:
"""Return 204 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -135,14 +134,14 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
return cls(pipeline_response, None, {}) # type: ignore

@distributed_trace_async
async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head404(self, **kwargs: Any) -> None:
"""Return 404 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand All @@ -7,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
Expand All @@ -26,7 +25,7 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -80,7 +79,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -121,7 +120,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -162,7 +161,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ._version import VERSION


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.

Note that all parameters used to create this instance are saved as instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .._version import VERSION


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.

Note that all parameters used to create this instance are saved as instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand All @@ -7,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
Expand All @@ -30,7 +29,7 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand All @@ -53,14 +52,14 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head200(self, **kwargs: Any) -> None:
"""Return 200 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -94,14 +93,14 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
return cls(pipeline_response, None, {}) # type: ignore

@distributed_trace_async
async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head204(self, **kwargs: Any) -> None:
"""Return 204 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -135,14 +134,14 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
return cls(pipeline_response, None, {}) # type: ignore

@distributed_trace_async
async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def head404(self, **kwargs: Any) -> None:
"""Return 404 status code if successful.

:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Loading
Loading