Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .chronus/changes/nextversion-2025-11-30-10-16-46.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: internal
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

internal dependency bump
9 changes: 9 additions & 0 deletions .chronus/changes/python-bump-tcgc-2026-0-12-15-52-59.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
changeKind: dependencies
packages:
- typespec-vs
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Bump tcgc dep to `0.63.4`
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Fix linting errors caused by too many vars, next-mypy issues
4 changes: 2 additions & 2 deletions packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTcxNzE3OS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.23.1.tgz",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTc0NDYyNy9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.23.1.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand All @@ -47,4 +47,4 @@
"requirements.txt",
"generator/"
]
}
}
14 changes: 7 additions & 7 deletions packages/typespec-python/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# shall keep aligned with dev_requirements.txt of @typspec/http-client-python
pyright==1.1.391
pylint==3.2.7
tox==4.23.2
mypy==1.13.0
pyright==1.1.407
pylint==4.0.4
tox==4.16.0
mypy==1.19.1
colorama==0.4.6
debugpy==1.8.12
pytest==8.3.4
debugpy==1.8.2
pytest==8.3.2
coverage==7.6.1
black==24.8.0
ptvsd==4.3.2
types-PyYAML==6.0.12.20241230
types-PyYAML==6.0.12.8

# additional dependency needed for development
setuptools
6 changes: 3 additions & 3 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
"@azure-tools/typespec-azure-resource-manager": ">=0.63.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.63.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.63.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.63.1 <1.0.0"
"@azure-tools/typespec-client-generator-core": ">=0.63.4 <1.0.0"
},
"dependencies": {
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTcxNzE3OS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.23.1.tgz",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTc0NDYyNy9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.23.1.tgz",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand Down Expand Up @@ -103,4 +103,4 @@
"chalk": "5.3.0",
"@types/fs-extra": "11.0.4"
}
}
}
2 changes: 1 addition & 1 deletion packages/typespec-python/scripts/eng/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enable=useless-suppression
# too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods.
# too-many-lines: Due to code generation many files end up with too many lines.
# Let's black deal with bad-continuation
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin,unknown-option-value,file-needs-copyright-header
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin,unknown-option-value,file-needs-copyright-header,too-many-positional-arguments

[FORMAT]
max-line-length=120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

TZ_UTC = timezone.utc
_T = typing.TypeVar("_T")
_NONE_TYPE = type(None)


def _timedelta_as_isostr(td: timedelta) -> str:
Expand Down Expand Up @@ -217,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
test_utc = date_obj.utctimetuple()
if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
raise OverflowError("Hit max or min date")
return date_obj
return date_obj # type: ignore[no-any-return]


def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime:
Expand Down Expand Up @@ -271,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time:
"""
if isinstance(attr, time):
return attr
return isodate.parse_time(attr)
return isodate.parse_time(attr) # type: ignore[no-any-return]


def _deserialize_bytes(attr):
Expand Down Expand Up @@ -877,16 +878,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down Expand Up @@ -1271,7 +1272,7 @@ def _get_wrapped_element(
_get_element(v, exclude_readonly, meta, wrapped_element)
else:
wrapped_element.text = _get_primitive_type_value(v)
return wrapped_element
return wrapped_element # type: ignore[no-any-return]


def _get_primitive_type_value(v) -> str:
Expand All @@ -1284,7 +1285,9 @@ def _get_primitive_type_value(v) -> str:
return str(v)


def _create_xml_element(tag, prefix=None, ns=None):
def _create_xml_element(
tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None
) -> ET.Element:
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

TZ_UTC = timezone.utc
_T = typing.TypeVar("_T")
_NONE_TYPE = type(None)


def _timedelta_as_isostr(td: timedelta) -> str:
Expand Down Expand Up @@ -217,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
test_utc = date_obj.utctimetuple()
if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
raise OverflowError("Hit max or min date")
return date_obj
return date_obj # type: ignore[no-any-return]


def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime:
Expand Down Expand Up @@ -271,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time:
"""
if isinstance(attr, time):
return attr
return isodate.parse_time(attr)
return isodate.parse_time(attr) # type: ignore[no-any-return]


def _deserialize_bytes(attr):
Expand Down Expand Up @@ -877,16 +878,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down Expand Up @@ -1271,7 +1272,7 @@ def _get_wrapped_element(
_get_element(v, exclude_readonly, meta, wrapped_element)
else:
wrapped_element.text = _get_primitive_type_value(v)
return wrapped_element
return wrapped_element # type: ignore[no-any-return]


def _get_primitive_type_value(v) -> str:
Expand All @@ -1284,7 +1285,9 @@ def _get_primitive_type_value(v) -> str:
return str(v)


def _create_xml_element(tag, prefix=None, ns=None):
def _create_xml_element(
tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None
) -> ET.Element:
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

TZ_UTC = timezone.utc
_T = typing.TypeVar("_T")
_NONE_TYPE = type(None)


def _timedelta_as_isostr(td: timedelta) -> str:
Expand Down Expand Up @@ -217,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
test_utc = date_obj.utctimetuple()
if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
raise OverflowError("Hit max or min date")
return date_obj
return date_obj # type: ignore[no-any-return]


def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime:
Expand Down Expand Up @@ -271,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time:
"""
if isinstance(attr, time):
return attr
return isodate.parse_time(attr)
return isodate.parse_time(attr) # type: ignore[no-any-return]


def _deserialize_bytes(attr):
Expand Down Expand Up @@ -877,16 +878,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down Expand Up @@ -1271,7 +1272,7 @@ def _get_wrapped_element(
_get_element(v, exclude_readonly, meta, wrapped_element)
else:
wrapped_element.text = _get_primitive_type_value(v)
return wrapped_element
return wrapped_element # type: ignore[no-any-return]


def _get_primitive_type_value(v) -> str:
Expand All @@ -1284,7 +1285,9 @@ def _get_primitive_type_value(v) -> str:
return str(v)


def _create_xml_element(tag, prefix=None, ns=None):
def _create_xml_element(
tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None
) -> ET.Element:
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

TZ_UTC = timezone.utc
_T = typing.TypeVar("_T")
_NONE_TYPE = type(None)


def _timedelta_as_isostr(td: timedelta) -> str:
Expand Down Expand Up @@ -217,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime:
test_utc = date_obj.utctimetuple()
if test_utc.tm_year > 9999 or test_utc.tm_year < 1:
raise OverflowError("Hit max or min date")
return date_obj
return date_obj # type: ignore[no-any-return]


def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime:
Expand Down Expand Up @@ -271,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time:
"""
if isinstance(attr, time):
return attr
return isodate.parse_time(attr)
return isodate.parse_time(attr) # type: ignore[no-any-return]


def _deserialize_bytes(attr):
Expand Down Expand Up @@ -877,16 +878,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down Expand Up @@ -1271,7 +1272,7 @@ def _get_wrapped_element(
_get_element(v, exclude_readonly, meta, wrapped_element)
else:
wrapped_element.text = _get_primitive_type_value(v)
return wrapped_element
return wrapped_element # type: ignore[no-any-return]


def _get_primitive_type_value(v) -> str:
Expand All @@ -1284,7 +1285,9 @@ def _get_primitive_type_value(v) -> str:
return str(v)


def _create_xml_element(tag, prefix=None, ns=None):
def _create_xml_element(
tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None
) -> ET.Element:
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
Expand Down
Loading
Loading