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

bump cadl-ranch #2851

Merged
merged 6 commits into from
Sep 24, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/upgrade_cadl_ranch-2024-8-23-16-40-22.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: dependencies
packages:
- "@azure-tools/typespec-python"
---

bump cadl-ranch
4 changes: 2 additions & 2 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"devDependencies": {
"@azure-tools/typespec-azure-resource-manager": "~0.46.0",
"@azure-tools/typespec-autorest": "~0.46.0",
"@azure-tools/cadl-ranch-expect": "~0.15.3",
"@azure-tools/cadl-ranch-specs": "~0.37.1",
"@azure-tools/cadl-ranch-expect": "~0.15.4",
"@azure-tools/cadl-ranch-specs": "~0.37.2",
"@types/js-yaml": "~4.0.5",
"@types/node": "~22.5.4",
"@types/yargs": "~17.0.33",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0b1 (1970-01-01)

- Initial version
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include *.md
include LICENSE
include type/model/templated/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include type/__init__.py
include type/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@


# Type Model Templated client library for Python
<!-- write necessary description of service -->

## Getting started

### Install the package

```bash
python -m pip install type-model-templated
```

#### Prequisites

- Python 3.8 or later is required to use this package.
- You need an [Azure subscription][azure_sub] to use this package.
- An existing Type Model Templated instance.

## Contributing

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.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
additional questions or comments.

<!-- LINKS -->
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
[azure_identity_pip]: https://pypi.org/project/azure-identity/
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
[pip]: https://pypi.org/project/pip/
[azure_sub]: https://azure.microsoft.com/free/

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"CrossLanguagePackageId": "Type.Model.Templated",
"CrossLanguageDefinitionId": {
"type.model.templated.models.Float32Type": "Type.Model.Templated.NumericType",
"type.model.templated.models.Float32ValuesType": "Type.Model.Templated.Float32ValuesType",
"type.model.templated.models.Int32Type": "Type.Model.Templated.NumericType",
"type.model.templated.models.Int32ValuesType": "Type.Model.Templated.Int32ValuesType",
"type.model.templated.TemplatedClient.numeric_type": "Type.Model.Templated.numericType",
"type.model.templated.TemplatedClient.float32_type": "Type.Model.Templated.float32Type",
"type.model.templated.TemplatedClient.int32_type": "Type.Model.Templated.int32Type"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)

load_dotenv()


# For security, please avoid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
templated_subscription_id = os.environ.get("TEMPLATED_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
templated_tenant_id = os.environ.get("TEMPLATED_TENANT_ID", "00000000-0000-0000-0000-000000000000")
templated_client_id = os.environ.get("TEMPLATED_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
templated_client_secret = os.environ.get("TEMPLATED_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=templated_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=templated_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=templated_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=templated_client_secret, value="00000000-0000-0000-0000-000000000000")

add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import TemplatedClientTestBase, TemplatedPreparer


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestTemplated(TemplatedClientTestBase):
@TemplatedPreparer()
@recorded_by_proxy
def test_numeric_type(self, templated_endpoint):
client = self.create_client(endpoint=templated_endpoint)
response = client.numeric_type(
input={"value": 0, "values": [0]},
)

# please add some check logic here by yourself
# ...

@TemplatedPreparer()
@recorded_by_proxy
def test_float32_type(self, templated_endpoint):
client = self.create_client(endpoint=templated_endpoint)
response = client.float32_type(
input={"kind": "Float32Values", "value": 0.0, "values": [0.0]},
)

# please add some check logic here by yourself
# ...

@TemplatedPreparer()
@recorded_by_proxy
def test_int32_type(self, templated_endpoint):
client = self.create_client(endpoint=templated_endpoint)
response = client.int32_type(
input={"kind": "Int32Values", "value": 0, "values": [0]},
)

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import TemplatedPreparer
from testpreparer_async import TemplatedClientTestBaseAsync


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestTemplatedAsync(TemplatedClientTestBaseAsync):
@TemplatedPreparer()
@recorded_by_proxy_async
async def test_numeric_type(self, templated_endpoint):
client = self.create_async_client(endpoint=templated_endpoint)
response = await client.numeric_type(
input={"value": 0, "values": [0]},
)

# please add some check logic here by yourself
# ...

@TemplatedPreparer()
@recorded_by_proxy_async
async def test_float32_type(self, templated_endpoint):
client = self.create_async_client(endpoint=templated_endpoint)
response = await client.float32_type(
input={"kind": "Float32Values", "value": 0.0, "values": [0.0]},
)

# please add some check logic here by yourself
# ...

@TemplatedPreparer()
@recorded_by_proxy_async
async def test_int32_type(self, templated_endpoint):
client = self.create_async_client(endpoint=templated_endpoint)
response = await client.int32_type(
input={"kind": "Int32Values", "value": 0, "values": [0]},
)

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
from type.model.templated import TemplatedClient


class TemplatedClientTestBase(AzureRecordedTestCase):

def create_client(self, endpoint):
credential = self.get_credential(TemplatedClient)
return self.create_client_from_credential(
TemplatedClient,
credential=credential,
endpoint=endpoint,
)


TemplatedPreparer = functools.partial(
PowerShellPreparer, "templated", templated_endpoint="https://fake_templated_endpoint.com"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase
from type.model.templated.aio import TemplatedClient


class TemplatedClientTestBaseAsync(AzureRecordedTestCase):

def create_async_client(self, endpoint):
credential = self.get_credential(TemplatedClient, is_async=True)
return self.create_client_from_credential(
TemplatedClient,
credential=credential,
endpoint=endpoint,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# coding: utf-8

import os
import re
from setuptools import setup, find_packages


PACKAGE_NAME = "type-model-templated"
PACKAGE_PPRINT_NAME = "Type Model Templated"

# a-b-c => a/b/c
package_folder_path = PACKAGE_NAME.replace("-", "/")

# Version extraction inspired from 'requests'
with open(os.path.join(package_folder_path, "_version.py"), "r") as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError("Cannot find version information")


setup(
name=PACKAGE_NAME,
version=version,
description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME),
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
license="MIT License",
author="Microsoft Corporation",
author_email="azpysdkhelp@microsoft.com",
url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk",
keywords="azure, azure sdk",
classifiers=[
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
packages=find_packages(
exclude=[
"tests",
# Exclude packages that will be covered by PEP420 or nspkg
"type",
"type.model",
]
),
include_package_data=True,
package_data={
"type.model.templated": ["py.typed"],
},
install_requires=[
"isodate>=0.6.1",
"azure-core>=1.30.0",
"typing-extensions>=4.6.0",
],
python_requires=">=3.8",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Loading
Loading