Skip to content
Merged
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
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .chronus/changes/copilot-fix-3187-2025-7-28-11-20-7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: deprecation
packages:
- "@autorest/python"
---

Deprecate multiapi
7 changes: 7 additions & 0 deletions .chronus/changes/copilot-fix-3187-2025-7-28-15-20-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: dependencies
packages:
- "@azure-tools/typespec-python"
---

Bump dep on `http-client-python`
4 changes: 0 additions & 4 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ words:
- mros
- mspaint
- msrc
- multiapi
- multiapiclient
- multiapinoasync
- multiapisecurity
- mutli
- myenv
- myoption
Expand Down
17 changes: 0 additions & 17 deletions docs/client/initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,8 @@ client. Say your custom credential is called `MyCredential`, and the policy that
client would look something like `client = PetsClient(credential=MyCredential(), authentication_policy=MyAuthenticationPolicy())`, though this of course varies
based on inputs.

## Multi API Client

Initializing your Multi API client is very similar to initializing a normal client. The only difference is there's an added optional
parameter `api_version`. With this parameter, you can specify the API version you want your client to have. If not specified, the multi
API client uses the default API version.

Using the Multi API client we generated in our [multi API generation][multiapi_generation], our example client uses default API version
`v2`. If we would like our client at runtime to have API version `v1`, we would initialize our client like:

```python
from azure.identity import DefaultAzureCredential
from azure.pets import PetsClient

client = PetsClient(credential=DefaultAzureCredential(), api_version="v1")
```

<!-- LINKS -->

[multiapi_generation]: https://github.com/Azure/autorest.python/blob/main/docs/generate/multiapi.md
[azure_core_library]: https://pypi.org/project/azure-core/
[msrest_library]: https://pypi.org/project/msrest/
[azure_mgmt_core_library]: https://pypi.org/project/azure-mgmt-core/
Expand Down
21 changes: 0 additions & 21 deletions docs/client/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,3 @@ from azure.pets.models import DogTypes

my_dog_type = DogTypes.DALMATIAN
```

## Multi API

There is also a `models` module in a multi API client. There, you can access the latest version of each models.

If you want to access a specific API version's models, you can do so through the [`models()`][models_ex] class method we expose on the multi API client.
It accepts optional parameter `api_version`. If specified, it will retrieve the models from that API version. Otherwise, retrieves models from the
default API version the code was generated with. We've included a code snippet showing you how to access models in both situations.

```python
from azure.multiapi.sample import MultiapiServiceClient
from azure.identity import DefaultAzureCredential

client = MultiapiServiceClient(credential=DefaultAzureCredential())

default_api_version_models = client.models()
v3_models = client.models(api_version='3.0.0')
```

<!-- LINKS -->
[models_ex]: https://github.com/Azure/autorest.python/blob/main/docs/packages/autorest.python/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py#L91
76 changes: 0 additions & 76 deletions docs/generate/multiapi.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/generate/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

Most of the information you'll need to generate a Python client can be found in the general docs [here][general]. In these docs, we go over a couple Python-specific scenarios.

* [Generating Multi API code][multiapi]
* [Generating with Directives][directives]

<!-- LINKS -->
[general]: https://github.com/Azure/autorest/tree/master/docs/generate/readme.md
[multiapi]: https://github.com/Azure/autorest.python/blob/main/docs/generate/multiapi.md
[directives]: https://github.com/Azure/autorest.python/blob/main/docs/generate/directives.md
8 changes: 0 additions & 8 deletions eng/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ jobs:
- template: generated-code-checks-template.yml
parameters:
folderName: "dpg/version-tolerant"
- script: tox run -e ci
displayName: 'Execute "multiapi" Tests - Python $(PythonVersion)'
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/autorest.python/test/multiapi

- script: tox run -e apiview
displayName: 'Validate multiapi APIView - Python $(PythonVersion)'
condition: and(succeededOrFailed(), eq(variables['PythonVersion'], '3.11'))
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/autorest.python/test/multiapi

- ${{ if eq(ne(variables['Build.Reason'], 'PullRequest'), 'True') }}:
- script: |
Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run_check(name, call_back, log_info):
"-t",
"--test-folder",
dest="test_folder",
help="The test folder we're in. Can be 'azure', 'multiapi', or 'vanilla'",
help="The test folder we're in. Can be 'azure' or 'vanilla'",
required=True,
)
parser.add_argument(
Expand Down
29 changes: 2 additions & 27 deletions packages/autorest.python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio

#### Python code gen

```yaml !$(multiapiscript) && !$(multiclientscript)
```yaml !$(multiclientscript)
# default values for version tolerant and black
black: true
```
Expand All @@ -39,7 +39,7 @@ modelerfour:
flatten-payloads: true
```

```yaml !$(multiapiscript) && !$(multiclientscript)
```yaml !$(multiclientscript)
pass-thru:
- model-deduplicator
- subset-reducer
Expand Down Expand Up @@ -99,25 +99,6 @@ scope-codegen/emitter:
output-artifact: python-files
```

# Multiapi script pipeline

```yaml $(multiapiscript)
pipeline:
python/multiapiscript:
scope: multiapiscript
output-artifact: python-files

python/multiapiscript/emitter:
input: multiapiscript
scope: scope-multiapiscript/emitter

scope-multiapiscript/emitter:
input-artifact: python-files
output-uri-expr: $key

output-artifact: python-files
```

# Black script pipeline

```yaml $(black)
Expand Down Expand Up @@ -173,12 +154,6 @@ help-content:
- key: basic-setup-py
description: Whether to generate a build script for setuptools to package your SDK. Defaults to `false`, generally not suggested if you are going to wrap the generated code
type: bool
- key: multiapi
description: Whether to generate a multiapi client.
type: bool
- key: default-api
description: In the case of `--multiapi`, you can override the default service API version with this flag. If not specified, we use the latest GA service version as the default API.
type: string
- key: no-namespace-folders
description: Specify if you don't want pkgutil-style namespace folders. Defaults to `false`.
type: bool
Expand Down
1 change: 0 additions & 1 deletion packages/autorest.python/autorest/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def get_options(self) -> Dict[str, Any]:
"package-version": self._autorestapi.get_value("package-version"),
"client-side-validation": self._autorestapi.get_boolean_value("client-side-validation"),
"tracing": self._autorestapi.get_boolean_value("trace"),
"multiapi": self._autorestapi.get_boolean_value("multiapi", False),
"polymorphic-examples": self._autorestapi.get_value("polymorphic-examples"),
"models-mode": self._autorestapi.get_value("models-mode"),
"builders-visibility": self._autorestapi.get_value("builders-visibility"),
Expand Down
3 changes: 0 additions & 3 deletions packages/autorest.python/autorest/jsonrpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def GetPluginNames():
"preprocess",
"m4reformatter",
"black",
"multiapiscript",
"multiclientscript",
]

Expand All @@ -53,8 +52,6 @@ def Process(plugin_name: str, session_id: str) -> bool:
from ..codegen import CodeGeneratorAutorest as PluginToLoad # type: ignore
elif plugin_name == "black":
from ..black import BlackScriptPluginAutorest as PluginToLoad # type: ignore
elif plugin_name == "multiapiscript":
from ..multiapi import MultiApiScriptPluginAutorest as PluginToLoad # type: ignore
elif plugin_name == "multiclientscript":
from ..multiclient import MultiClientPluginAutorest as PluginToLoad # type: ignore
else:
Expand Down
Loading
Loading