Skip to content

Commit

Permalink
chore(release): 1.103.1 (#4630)
Browse files Browse the repository at this point in the history
See [CHANGELOG](https://github.com/aws/jsii/blob/patch/v1.103.1/CHANGELOG.md)

(Re-roll of #4628 which I messed up)

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
mergify[bot] authored Aug 30, 2024
2 parents 3b9adc4 + 69c40cb commit bef2dea
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.103.1](https://github.com/aws/jsii/compare/v1.103.0...v1.103.1) (2024-08-30)


### Bug Fixes

* **python:** user defined `__jsii_proxy_class` attributes are not preserved ([#4625](https://github.com/aws/jsii/issues/4625)) ([d3ec911](https://github.com/aws/jsii/commit/d3ec911a5d531e088524d2479e1ee831da0bc2ff))

## [1.103.0](https://github.com/aws/jsii/compare/v1.102.0...v1.103.0) (2024-08-27)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"rejectCycles": true
}
},
"version": "1.103.0",
"version": "1.103.1",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
2 changes: 1 addition & 1 deletion packages/@jsii/python-runtime/src/jsii/_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def implements(*interfaces: Type[Any]) -> Callable[[T], T]:
def deco(cls):
cls.__jsii_type__ = getattr(cls, "__jsii_type__", None)
cls.__jsii_ifaces__ = getattr(cls, "__jsii_ifaces__", []) + list(interfaces)
cls.__jsii_proxy_class__ = lambda: getattr(cls, "__jsii_proxy_class__", None)
cls.__jsii_proxy_class__ = getattr(cls, "__jsii_proxy_class__", lambda: None)

# https://github.com/agronholm/typeguard/issues/479
cls.__protocol_attrs__ = getattr(cls, "__protocol_attrs__", [])
Expand Down
31 changes: 31 additions & 0 deletions packages/@jsii/python-runtime/tests/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ def test_inheritance_maintained(self):

assert base_names == ["DerivedStruct", "MyFirstStruct"]


class TestImplementsInterface:

def test_jsii_proxy_class_defaults_to_none(self) -> None:
@jsii.implements(IBaz)
class MyBaz:
pass

klass = getattr(MyBaz, "__jsii_proxy_class__")()
assert klass == None

def test_jsii_proxy_class_preserves_user_defined_attribute(self) -> None:

class _MyBazProxy:
def baz_method(self) -> str:
return "_MyBazProxy"

@jsii.implements(IBaz)
class MyBaz:

@staticmethod
def __jsii_proxy_class__():
return _MyBazProxy

def baz_method(self) -> str:
return "MyBaz"

klass = getattr(MyBaz, "__jsii_proxy_class__")()
instance = klass()
assert instance.baz_method() == "_MyBazProxy"

def test_implements_interface(self) -> None:
"""Checks that jsii-generated classes correctly implement the relevant jsii-generated interfaces."""

Expand Down

0 comments on commit bef2dea

Please sign in to comment.