Skip to content

Commit a8a8833

Browse files
authored
chore(release): 1.63.2 (#3689)
2 parents 185bb34 + b680fd8 commit a8a8833

File tree

14 files changed

+1082
-965
lines changed

14 files changed

+1082
-965
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
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.
44

5+
## [1.63.2](https://github.com/aws/jsii/compare/v1.63.1...v1.63.2) (2022-07-29)
6+
7+
8+
### Bug Fixes
9+
10+
* **pyhon:** under-qualified types used by dynamic type checking ([#3688](https://github.com/aws/jsii/issues/3688)) ([833a717](https://github.com/aws/jsii/commit/833a71781c9e4fee1522d75e53d3de76b93439f5))
11+
512
## [1.63.1](https://github.com/aws/jsii/compare/v1.63.0...v1.63.1) (2022-07-26)
613

714

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"rejectCycles": true
1111
}
1212
},
13-
"version": "1.63.1"
13+
"version": "1.63.2"
1414
}

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"@jest/types": "^28.1.3",
1919
"@types/jest": "^28.1.6",
2020
"@types/node": "^14.18.22",
21-
"@typescript-eslint/eslint-plugin": "^5.30.7",
22-
"@typescript-eslint/parser": "^5.30.7",
21+
"@typescript-eslint/eslint-plugin": "^5.31.0",
22+
"@typescript-eslint/parser": "^5.31.0",
2323
"all-contributors-cli": "^6.20.0",
2424
"eslint": "^8.20.0",
2525
"eslint-config-prettier": "^8.5.0",
@@ -31,7 +31,7 @@
3131
"jest-circus": "^28.1.3",
3232
"jest-config": "^28.1.3",
3333
"jest-expect-message": "^1.0.2",
34-
"lerna": "^5.1.8",
34+
"lerna": "^5.3.0",
3535
"prettier": "^2.7.1",
3636
"standard-version": "^9.5.0",
3737
"ts-node": "^10.9.1",

packages/@jsii/benchmarks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"fs-extra": "^10.1.0",
99
"jsii": "^0.0.0",
10-
"npm": "^8.14.0",
10+
"npm": "^8.15.0",
1111
"tar": "^6.1.11",
1212
"typescript": "~3.9.10",
1313
"yargs": "^16.2.0"

packages/@jsii/python-runtime/tests/test_runtime_type_checking.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
import re
33

4+
from scope.jsii_calc_lib.custom_submodule_name import NestingClass
45
import jsii_calc
56

67

@@ -114,3 +115,7 @@ def test_setter_to_union(self):
114115
),
115116
):
116117
subject.union_property = jsii_calc.StringEnum.B # type:ignore
118+
119+
def test_nested_struct(self):
120+
# None of these should throw...
121+
NestingClass.NestedStruct(name="Queen B")

packages/@jsii/runtime/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"jsii-build-tools": "^0.0.0",
4545
"jsii-calc": "^3.20.120",
4646
"source-map-loader": "^4.0.0",
47-
"webpack": "^5.73.0",
47+
"webpack": "^5.74.0",
4848
"webpack-cli": "^4.10.0"
4949
}
5050
}

packages/jsii-diff/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@jsii/spec": "^0.0.0",
3838
"fs-extra": "^10.1.0",
3939
"jsii-reflect": "^0.0.0",
40-
"log4js": "^6.6.0",
40+
"log4js": "^6.6.1",
4141
"yargs": "^16.2.0"
4242
},
4343
"devDependencies": {

packages/jsii-pacmak/lib/targets/python.ts

+13-15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
PythonImports,
2525
mergePythonImports,
2626
toPackageName,
27+
toPythonFullName,
2728
} from './python/type-name';
2829
import { die, toPythonIdentifier } from './python/util';
2930
import { toPythonVersionRange, toReleaseVersion } from './version-utils';
@@ -466,7 +467,6 @@ abstract class BaseMethod implements PythonBase {
466467
private readonly returns: spec.OptionalValue | undefined,
467468
public readonly docs: spec.Docs | undefined,
468469
public readonly isStatic: boolean,
469-
private readonly pythonParent: PythonType,
470470
opts: BaseMethodOpts,
471471
) {
472472
this.abstract = !!opts.abstract;
@@ -674,7 +674,9 @@ abstract class BaseMethod implements PythonBase {
674674
emitParameterTypeChecks(
675675
code,
676676
pythonParams.slice(1),
677-
`${this.pythonParent.pythonName}.${this.pythonName}`,
677+
`${toPythonFullName(this.parent.fqn, context.assembly)}.${
678+
this.pythonName
679+
}`,
678680
);
679681
}
680682
this.emitBody(
@@ -867,7 +869,6 @@ abstract class BaseProperty implements PythonBase {
867869
private readonly jsName: string,
868870
private readonly type: spec.OptionalValue,
869871
public readonly docs: spec.Docs | undefined,
870-
private readonly pythonParent: PythonType,
871872
opts: BasePropertyOpts,
872873
) {
873874
const { abstract = false, immutable = false, isStatic = false } = opts;
@@ -952,9 +953,10 @@ abstract class BaseProperty implements PythonBase {
952953
// In order to get a property accessor, we must resort to getting the
953954
// attribute on the type, instead of the value (where the getter would
954955
// be implicitly invoked for us...)
955-
`getattr(${this.pythonParent.pythonName}, ${JSON.stringify(
956-
this.pythonName,
957-
)}).fset`,
956+
`getattr(${toPythonFullName(
957+
this.parent.fqn,
958+
context.assembly,
959+
)}, ${JSON.stringify(this.pythonName)}).fset`,
958960
);
959961
code.line(
960962
`jsii.${this.jsiiSetMethod}(${this.implicitParameter}, "${this.jsName}", value)`,
@@ -1141,7 +1143,11 @@ class Struct extends BasePythonClassType {
11411143
code.line(`${member.pythonName} = ${typeName}(**${member.pythonName})`);
11421144
code.closeBlock();
11431145
}
1144-
emitParameterTypeChecks(code, kwargs, `${this.pythonName}.__init__`);
1146+
emitParameterTypeChecks(
1147+
code,
1148+
kwargs,
1149+
`${toPythonFullName(this.spec.fqn, context.assembly)}.__init__`,
1150+
);
11451151

11461152
// Required properties, those will always be put into the dict
11471153
assignDictionary(
@@ -2605,7 +2611,6 @@ class PythonGenerator extends Generator {
26052611
undefined,
26062612
cls.initializer.docs,
26072613
false, // Never static
2608-
klass,
26092614
{ liftedProp: this.getliftedProp(cls.initializer), parent: cls },
26102615
),
26112616
);
@@ -2628,7 +2633,6 @@ class PythonGenerator extends Generator {
26282633
method.returns,
26292634
method.docs,
26302635
true, // Always static
2631-
klass,
26322636
{
26332637
abstract: method.abstract,
26342638
liftedProp: this.getliftedProp(method),
@@ -2647,7 +2651,6 @@ class PythonGenerator extends Generator {
26472651
prop.name,
26482652
prop,
26492653
prop.docs,
2650-
klass,
26512654
{
26522655
abstract: prop.abstract,
26532656
immutable: prop.immutable,
@@ -2673,7 +2676,6 @@ class PythonGenerator extends Generator {
26732676
method.returns,
26742677
method.docs,
26752678
!!method.static,
2676-
klass,
26772679
{
26782680
abstract: method.abstract,
26792681
liftedProp: this.getliftedProp(method),
@@ -2691,7 +2693,6 @@ class PythonGenerator extends Generator {
26912693
method.returns,
26922694
method.docs,
26932695
!!method.static,
2694-
klass,
26952696
{
26962697
abstract: method.abstract,
26972698
liftedProp: this.getliftedProp(method),
@@ -2711,7 +2712,6 @@ class PythonGenerator extends Generator {
27112712
prop.name,
27122713
prop,
27132714
prop.docs,
2714-
klass,
27152715
{
27162716
abstract: prop.abstract,
27172717
immutable: prop.immutable,
@@ -2773,7 +2773,6 @@ class PythonGenerator extends Generator {
27732773
method.returns,
27742774
method.docs,
27752775
!!method.static,
2776-
klass,
27772776
{ liftedProp: this.getliftedProp(method), parent: ifc },
27782777
),
27792778
);
@@ -2793,7 +2792,6 @@ class PythonGenerator extends Generator {
27932792
prop.name,
27942793
prop,
27952794
prop.docs,
2796-
klass,
27972795
{ immutable: prop.immutable, isStatic: prop.static, parent: ifc },
27982796
);
27992797
}

packages/jsii-pacmak/lib/targets/python/type-name.ts

+14
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,20 @@ export function toPythonFqn(fqn: string, rootAssm: Assembly) {
403403
return { assemblyName, packageName, pythonFqn: fqnParts.join('.') };
404404
}
405405

406+
/**
407+
* Computes the nesting-qualified name of a type.
408+
*
409+
* @param fqn the fully qualified jsii name of the type.
410+
* @param rootAssm the root assembly for the project.
411+
*
412+
* @returns the nesting-qualified python type name (the name of the class,
413+
* qualified with all nesting parent classes).
414+
*/
415+
export function toPythonFullName(fqn: string, rootAssm: Assembly): string {
416+
const { packageName, pythonFqn } = toPythonFqn(fqn, rootAssm);
417+
return pythonFqn.slice(packageName.length + 1);
418+
}
419+
406420
/**
407421
* Computes the python relative import path from `fromModule` to `toModule`.
408422
*

packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.js.snap

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-rosetta/jest.config.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createRequire } from 'node:module';
2-
import { overriddenConfig } from '../../jest.config.mjs';
2+
import { default as defaultConfig, overriddenConfig } from '../../jest.config.mjs';
33

44
export default overriddenConfig({
55
setupFiles: [createRequire(import.meta.url).resolve('./jestsetup.js')],
6+
testTimeout: process.env.CI === 'true' ? 30_000 : defaultConfig.testTimeout,
67
});

packages/jsii/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"chalk": "^4",
4242
"fast-deep-equal": "^3.1.3",
4343
"fs-extra": "^10.1.0",
44-
"log4js": "^6.6.0",
44+
"log4js": "^6.6.1",
4545
"semver": "^7.3.7",
4646
"semver-intersect": "^1.4.0",
4747
"sort-json": "^2.0.1",

0 commit comments

Comments
 (0)