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

Python: 4.7 runtime and Union fixes #489

Merged
merged 600 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
600 commits
Select commit Hold shift + click to select a range
c166ced
missing
lucasmcdonald3 Dec 28, 2023
98fa1ce
some simples
lucasmcdonald3 Dec 28, 2023
1a85aac
sipmles
lucasmcdonald3 Dec 29, 2023
e0b1077
refactor untested
lucasmcdonald3 Dec 29, 2023
4fc56ea
refactor untested
lucasmcdonald3 Dec 29, 2023
d3d29ab
fix
lucasmcdonald3 Jan 2, 2024
fc5df6d
changes
lucasmcdonald3 Jan 2, 2024
b0aaeca
changes
lucasmcdonald3 Jan 2, 2024
8d33264
change
lucasmcdonald3 Jan 9, 2024
d75eb94
fix
lucasmcdonald3 Jan 9, 2024
6f347b0
fix
lucasmcdonald3 Jan 9, 2024
9f47d5f
fix
lucasmcdonald3 Jan 9, 2024
801eaaf
fix
lucasmcdonald3 Jan 9, 2024
fc86290
fix
lucasmcdonald3 Jan 9, 2024
c3ad149
bump verify java version
lucasmcdonald3 Jan 9, 2024
4b9c537
SOME pydoc
lucasmcdonald3 Jan 10, 2024
2117aee
slightly better pydoc
lucasmcdonald3 Jan 10, 2024
1311fc3
docs, typehints, multiple codes fixes
lucasmcdonald3 Jan 10, 2024
0cd72e3
revert errors any
lucasmcdonald3 Jan 10, 2024
da4b7d6
changes
lucasmcdonald3 Jan 12, 2024
8f5f023
use alternate constructor in deps
lucasmcdonald3 Jan 12, 2024
41ff714
gen mpl
lucasmcdonald3 Jan 17, 2024
9168edb
fix override?
lucasmcdonald3 Jan 17, 2024
9ca71ac
fix override?
lucasmcdonald3 Jan 17, 2024
6fba573
fix override?
lucasmcdonald3 Jan 17, 2024
11b64f3
gen services
lucasmcdonald3 Jan 17, 2024
856553e
refs symbols as forward references; remove as/fromdict
lucasmcdonald3 Jan 17, 2024
455c7a1
actual reference typehints
lucasmcdonald3 Jan 17, 2024
c9de9fc
as/from dict on references
lucasmcdonald3 Jan 17, 2024
b239641
cleanup
lucasmcdonald3 Jan 18, 2024
ff9ba38
fix
lucasmcdonald3 Jan 18, 2024
cb2b5f2
cleanup
lucasmcdonald3 Jan 19, 2024
c841864
cleanup
lucasmcdonald3 Jan 19, 2024
3bce489
clenaup, some test
lucasmcdonald3 Jan 19, 2024
0398e15
clenaup, some test
lucasmcdonald3 Jan 19, 2024
ee41dfa
clenaup, some test
lucasmcdonald3 Jan 19, 2024
6891280
clenaup, some test
lucasmcdonald3 Jan 19, 2024
fbb547b
update smithy-python
lucasmcdonald3 Jan 19, 2024
f632f5d
debug mpl
lucasmcdonald3 Jan 23, 2024
692842b
fix deps
lucasmcdonald3 Jan 23, 2024
bfa69ec
docs improvements
lucasmcdonald3 Jan 23, 2024
33a2754
fix up typehints on references
lucasmcdonald3 Jan 23, 2024
7b1d967
cleanup
lucasmcdonald3 Jan 23, 2024
dc2d170
FINALLY fix finding refs
lucasmcdonald3 Jan 23, 2024
1d20318
remove local PythonDafnyRuntime
lucasmcdonald3 Jan 25, 2024
f489cad
changes; refs, errors
lucasmcdonald3 Feb 1, 2024
771d1ad
changes
lucasmcdonald3 Feb 2, 2024
a57dadb
sync upstream
lucasmcdonald3 Feb 23, 2024
8728872
wip
lucasmcdonald3 Mar 4, 2024
c235930
merge
lucasmcdonald3 Mar 4, 2024
75fa068
fixes
lucasmcdonald3 Mar 28, 2024
619d675
fix python mk
lucasmcdonald3 Apr 1, 2024
291fbdf
merge
lucasmcdonald3 Apr 1, 2024
a09898a
Merge branch 'main-1.x' into lucmcdon/python-poc
lucasmcdonald3 Apr 1, 2024
ca2e438
debug merge
lucasmcdonald3 Apr 1, 2024
c1924a9
update smithy-python
lucasmcdonald3 Apr 1, 2024
865dd75
fixes
lucasmcdonald3 Apr 1, 2024
57aacab
doc
lucasmcdonald3 Apr 1, 2024
028321e
doc
lucasmcdonald3 Apr 1, 2024
86beecb
mk
lucasmcdonald3 Apr 1, 2024
00123bf
doc
lucasmcdonald3 Apr 1, 2024
baa153c
doc
lucasmcdonald3 Apr 1, 2024
aca426b
doc
lucasmcdonald3 Apr 1, 2024
086cf0e
doc
lucasmcdonald3 Apr 1, 2024
1eb058b
fixes
lucasmcdonald3 Apr 1, 2024
ea69ed2
fix exception msg
lucasmcdonald3 Apr 2, 2024
2c9d4f5
sdks
lucasmcdonald3 Apr 2, 2024
1e82a3f
fix
lucasmcdonald3 Apr 3, 2024
4bc0584
fix
lucasmcdonald3 Apr 3, 2024
0445306
fix
lucasmcdonald3 Apr 3, 2024
0593eca
fix
lucasmcdonald3 Apr 3, 2024
02c26e3
fix
lucasmcdonald3 Apr 3, 2024
ff57913
fix
lucasmcdonald3 Apr 3, 2024
66836ce
add module
lucasmcdonald3 Apr 16, 2024
efc2281
settings
lucasmcdonald3 Apr 16, 2024
d3fc5c8
rm gitmodules
lucasmcdonald3 Apr 16, 2024
0552eeb
rm
lucasmcdonald3 Apr 16, 2024
ed4ce50
rm
lucasmcdonald3 Apr 16, 2024
c438ce4
change
lucasmcdonald3 Apr 17, 2024
de1e084
commit modules
lucasmcdonald3 Apr 17, 2024
9b0388f
debug
lucasmcdonald3 Apr 17, 2024
e55545f
debug
lucasmcdonald3 Apr 17, 2024
f8c9b1f
wrap dep errors
lucasmcdonald3 Apr 24, 2024
9840d89
wrap dep errors
lucasmcdonald3 Apr 24, 2024
0767125
gen enum shapes
lucasmcdonald3 Apr 24, 2024
06f764b
enum conversion
lucasmcdonald3 Apr 24, 2024
e2b9cea
fix
lucasmcdonald3 Apr 29, 2024
6a9596f
fix
lucasmcdonald3 Apr 29, 2024
d9e0b32
fix
lucasmcdonald3 Apr 30, 2024
8980c96
merge
lucasmcdonald3 Apr 30, 2024
b2e3c8a
fix merge
lucasmcdonald3 Apr 30, 2024
acd1957
update path
lucasmcdonald3 Apr 30, 2024
2ff0001
fix
lucasmcdonald3 Apr 30, 2024
a2ad26a
chore: add SimpleEnumV2 TestModel for Python (#346)
kessplas May 1, 2024
30ee7dd
copyright
lucasmcdonald3 May 7, 2024
e3061b3
WIP modules
lucasmcdonald3 May 10, 2024
54471ad
bool and extern
lucasmcdonald3 May 13, 2024
1a51f0c
ups
lucasmcdonald3 May 14, 2024
cd4fb21
fix
lucasmcdonald3 May 14, 2024
ec5d576
fix externs
lucasmcdonald3 May 14, 2024
7e1af57
import utf8
lucasmcdonald3 May 15, 2024
9a5dd63
fix
lucasmcdonald3 May 15, 2024
b856aab
fix
lucasmcdonald3 May 15, 2024
23a9779
fix
lucasmcdonald3 May 15, 2024
0c31457
fix
lucasmcdonald3 May 15, 2024
9b0286e
fix
lucasmcdonald3 May 15, 2024
67bf9fa
fix
lucasmcdonald3 May 15, 2024
8cce710
fix
lucasmcdonald3 May 15, 2024
80674fd
fix
lucasmcdonald3 May 15, 2024
85fe887
fix
lucasmcdonald3 May 15, 2024
2e2cd9a
fix
lucasmcdonald3 May 15, 2024
b14620f
use sdkid
lucasmcdonald3 May 16, 2024
bace456
fix
lucasmcdonald3 May 16, 2024
5d55637
fix
lucasmcdonald3 May 16, 2024
c6c3fee
change order of namespace_+module
lucasmcdonald3 May 20, 2024
bfc452f
mk
lucasmcdonald3 May 20, 2024
8323307
debug external shim
lucasmcdonald3 May 20, 2024
65a9af0
debug external shim
lucasmcdonald3 May 20, 2024
b014069
debug external shim
lucasmcdonald3 May 21, 2024
9a525ba
debug external shim
lucasmcdonald3 May 21, 2024
241f7e2
Merge branch 'main-1.x' into lucmcdon/python-poc-v2
lucasmcdonald3 May 22, 2024
dc05c6c
fix smithy_to_dafny error
lucasmcdonald3 May 22, 2024
367c192
wip
lucasmcdonald3 May 28, 2024
d5e3823
merge from main
lucasmcdonald3 May 28, 2024
16e1ee2
py dafny nightly
lucasmcdonald3 May 28, 2024
e29bad6
cleanup a bit
lucasmcdonald3 May 29, 2024
e258104
cleanup
lucasmcdonald3 May 29, 2024
10a5df1
common changes
lucasmcdonald3 Jun 11, 2024
1aa5ef7
cleanup
lucasmcdonald3 Jun 12, 2024
b9feab0
test no string enums
lucasmcdonald3 Jun 12, 2024
f57b740
cleanup
lucasmcdonald3 Jun 12, 2024
f7f1df5
note
lucasmcdonald3 Jun 12, 2024
3c4778b
cleanup plugins
lucasmcdonald3 Jun 12, 2024
60512c0
cleanup
lucasmcdonald3 Jun 12, 2024
74c1e82
debug
lucasmcdonald3 Jun 12, 2024
52f0f46
debug
lucasmcdonald3 Jun 12, 2024
a948ed0
debug
lucasmcdonald3 Jun 12, 2024
77cf6fd
fix
lucasmcdonald3 Jun 12, 2024
3ceed52
fix
lucasmcdonald3 Jun 12, 2024
891b522
DEBUG: swap escaping
lucasmcdonald3 Jun 12, 2024
5c8ea1e
DEBUG: no forward reference in unions
lucasmcdonald3 Jun 12, 2024
e43c1d6
fix
lucasmcdonald3 Jun 12, 2024
166ecb8
DEBUG: to
lucasmcdonald3 Jun 12, 2024
19330cd
DEBUG: to
lucasmcdonald3 Jun 12, 2024
bf43f25
DEBUG no None/False/True
lucasmcdonald3 Jun 13, 2024
85374db
update
lucasmcdonald3 Jun 13, 2024
a37e468
m
lucasmcdonald3 Jun 13, 2024
6112941
cleanup
lucasmcdonald3 Jun 13, 2024
bbdd36e
cleanup
lucasmcdonald3 Jun 13, 2024
7150f4f
DEBUG writeReprMembers
lucasmcdonald3 Jun 13, 2024
6ae291a
DEBUG writeReprMembers
lucasmcdonald3 Jun 13, 2024
f2c0884
more cosntraints
lucasmcdonald3 Jun 13, 2024
e6ca95a
more cosntraints
lucasmcdonald3 Jun 13, 2024
c575668
more cosntraints
lucasmcdonald3 Jun 13, 2024
6351cbd
more cosntraints
lucasmcdonald3 Jun 13, 2024
02f3d3e
more cosntraints
lucasmcdonald3 Jun 13, 2024
79470b8
more cosntraints
lucasmcdonald3 Jun 13, 2024
1c5ba5e
nope
lucasmcdonald3 Jun 13, 2024
434339a
cleanup extensions
lucasmcdonald3 Jun 13, 2024
6633264
fixes
lucasmcdonald3 Jun 13, 2024
94d2dad
cleanup shapevisitors awssdk
lucasmcdonald3 Jun 13, 2024
e613ee1
cleanup
lucasmcdonald3 Jun 13, 2024
4e3649d
cleanup extensions
lucasmcdonald3 Jun 13, 2024
cb9f4b5
cleanup
lucasmcdonald3 Jun 13, 2024
dbe6f48
cleanup
lucasmcdonald3 Jun 13, 2024
b9d3cde
mangling
lucasmcdonald3 Jun 14, 2024
0696c27
fix
lucasmcdonald3 Jun 14, 2024
8217184
fail timestamp loud
lucasmcdonald3 Jun 14, 2024
985f4ab
nits
lucasmcdonald3 Jun 17, 2024
fafae2d
fixes
lucasmcdonald3 Jun 17, 2024
0158cb7
fixes
lucasmcdonald3 Jun 17, 2024
4d5b78a
wip
lucasmcdonald3 Jun 20, 2024
e970f69
wip
lucasmcdonald3 Jun 20, 2024
1be13fc
utf8
lucasmcdonald3 Jun 21, 2024
d9c4998
fixes
lucasmcdonald3 Jun 21, 2024
9cc27a2
update
lucasmcdonald3 Jun 21, 2024
8c5d267
update
lucasmcdonald3 Jun 21, 2024
e0df1eb
deps?
lucasmcdonald3 Jun 21, 2024
f34c7b3
kms
lucasmcdonald3 Jun 21, 2024
0cef964
ddb
lucasmcdonald3 Jun 21, 2024
04464ed
cleanup
lucasmcdonald3 Jun 21, 2024
855bffa
cleanup
lucasmcdonald3 Jun 21, 2024
fb092f2
more
lucasmcdonald3 Jun 24, 2024
ee5ab0c
mk
lucasmcdonald3 Jun 25, 2024
7b74793
wrapped externsions
lucasmcdonald3 Jul 22, 2024
f07b096
sdk extensions
lucasmcdonald3 Jul 22, 2024
14302e8
rename
lucasmcdonald3 Jul 22, 2024
901fde5
format
lucasmcdonald3 Jul 22, 2024
e9aed5f
Merge
lucasmcdonald3 Jul 22, 2024
034f625
fix
lucasmcdonald3 Jul 22, 2024
3724eba
more debug
Aug 16, 2023
a689cf0
debug
Aug 18, 2023
250c47d
pretend net
Oct 26, 2023
a3817a2
fix
lucasmcdonald3 Apr 29, 2024
99e8f7e
DEBUG writeReprMembers
lucasmcdonald3 Jun 13, 2024
0fb8754
cleanup extensions
lucasmcdonald3 Jun 13, 2024
49411a9
cleanup
lucasmcdonald3 Jul 22, 2024
2da1795
cleanup, mk clean
lucasmcdonald3 Jul 22, 2024
b5e9bd8
cleanup
lucasmcdonald3 Jul 23, 2024
eb5cbe9
cleanup
lucasmcdonald3 Jul 23, 2024
1a0795b
fix
lucasmcdonald3 Jul 23, 2024
78207fe
changes
lucasmcdonald3 Jul 23, 2024
c1ccc2a
changes
lucasmcdonald3 Jul 23, 2024
86319ce
sync
lucasmcdonald3 Jul 23, 2024
ca0242c
union constraints
lucasmcdonald3 Jul 23, 2024
dc6f94a
update
lucasmcdonald3 Jul 24, 2024
e2ac8fa
merge
lucasmcdonald3 Jul 24, 2024
ab6d174
fix
lucasmcdonald3 Jul 24, 2024
c7369ec
debug
lucasmcdonald3 Jul 24, 2024
16b1775
debug
lucasmcdonald3 Jul 24, 2024
634186a
missing
lucasmcdonald3 Jul 25, 2024
639846d
missing
lucasmcdonald3 Jul 25, 2024
55cb257
Merge branch 'lucmcdon/python-poc-v2' into python-gap
lucasmcdonald3 Jul 25, 2024
cf2edc1
fix stdlib test
lucasmcdonald3 Jul 25, 2024
dfb730b
rm .class files
lucasmcdonald3 Jul 25, 2024
66594ed
muyltiplemodels
lucasmcdonald3 Jul 25, 2024
1199378
Merge branch 'lucmcdon/python-poc-v2' into python-gap
lucasmcdonald3 Jul 25, 2024
d1b15ca
cleanup
lucasmcdonald3 Jul 25, 2024
6619e58
refactor the test extern extendable
lucasmcdonald3 Jul 25, 2024
0efbc10
cleanup
lucasmcdonald3 Jul 25, 2024
8733e98
cleanup
lucasmcdonald3 Jul 25, 2024
632351d
cleanup
lucasmcdonald3 Jul 25, 2024
29c99c7
cleanup
lucasmcdonald3 Jul 25, 2024
f4c7f7b
Merge branch 'lucmcdon/python-poc-v2' into python-gap
lucasmcdonald3 Jul 25, 2024
f39567d
Merge branch 'python-reviewed' into python-gap
lucasmcdonald3 Jul 30, 2024
6ca036e
cleanup
lucasmcdonald3 Jul 30, 2024
29c3fcd
format
lucasmcdonald3 Jul 30, 2024
c6310d0
cleanup
lucasmcdonald3 Jul 30, 2024
53bbbb3
cleanup
lucasmcdonald3 Jul 30, 2024
962dbbf
cleanup
lucasmcdonald3 Jul 30, 2024
2da9f96
merge
lucasmcdonald3 Jul 30, 2024
c397ed0
clean
lucasmcdonald3 Jul 30, 2024
66e2bcc
cleanup
lucasmcdonald3 Aug 1, 2024
e6eb414
fix
lucasmcdonald3 Aug 1, 2024
325ece8
cleanup
lucasmcdonald3 Aug 1, 2024
4646c70
Merge branch 'python-reviewed' into python-gap
lucasmcdonald3 Aug 2, 2024
9de8e17
bump to 4.7
lucasmcdonald3 Aug 2, 2024
bbdb18f
Merge branch 'python-gap' into lucmcdon/python-poc-v2
lucasmcdonald3 Aug 2, 2024
9389f05
forward reference complex shapes
lucasmcdonald3 Aug 2, 2024
2a71b2c
forward reference complex shapes
lucasmcdonald3 Aug 2, 2024
9b6c226
forward reference complex shapes
lucasmcdonald3 Aug 2, 2024
8c9471c
forward
lucasmcdonald3 Aug 2, 2024
b1decde
forward
lucasmcdonald3 Aug 2, 2024
1977dca
Merge branch 'python-reviewed' into python-gap
lucasmcdonald3 Aug 2, 2024
38712a2
Merge branch 'python-gap' into lucmcdon/python-poc-v2
lucasmcdonald3 Aug 2, 2024
8413cf1
debug union
lucasmcdonald3 Aug 6, 2024
9f4c1b9
debug union
lucasmcdonald3 Aug 6, 2024
02c87be
debug union
lucasmcdonald3 Aug 6, 2024
ac52df4
debug union
lucasmcdonald3 Aug 6, 2024
a028268
clean
lucasmcdonald3 Aug 6, 2024
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
2 changes: 1 addition & 1 deletion TestModels/Aggregate/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = ["**/smithygenerated/**/*.py", "**/internaldafny/generated/*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

Expand Down
2 changes: 1 addition & 1 deletion TestModels/Constraints/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Constructor/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = ["**/smithygenerated/**/*.py", "**/internaldafny/generated/*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

Expand Down
2 changes: 1 addition & 1 deletion TestModels/Dependencies/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ simple-resources = { path = "../../../Resource/runtimes/python", develop = false
simple-errors = { path = "../../../Errors/runtimes/python", develop = false}
simple-extendable-resources = { path = "../../../Extendable/runtimes/python", develop = false}
simple-constraints = { path = "../../../Constraints/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Errors/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Extendable/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Extern/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/LocalService/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/MultipleModels/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Refinement/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Resource/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python = "^3.11.0"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Union/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python = "^3.11.0"
smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}

standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/aws-sdks/ddb/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boto3 = "^1.28.38"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
2 changes: 1 addition & 1 deletion TestModels/aws-sdks/kms/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boto3 = "^1.28.38"
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}
DafnyRuntimePython = "^4.4.0"
DafnyRuntimePython = "^4.7.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import software.amazon.smithy.model.traits.DocumentationTrait;
import software.amazon.smithy.utils.StringUtils;

import static java.lang.String.format;

/**
* Renders unions.
*/
Expand Down Expand Up @@ -55,6 +57,17 @@ protected void writeInitMethodConstraintsChecksForMember(MemberShape member, Str
// Stub method that can be overridden by other codegens.
}

protected void writeInitMethodForMember(MemberShape member, Symbol memberSymbol, Shape targetShape, Symbol targetSymbol) {
String formatString = format("def __init__(self, value: %s):", getTargetFormat(member));
writer.openBlock(formatString,
"",
targetSymbol,
() -> {
writeInitMethodConstraintsChecksForMember(member, memberSymbol.getName());
writer.write("self.value = value");
});
}

@Override
public void run() {
var parentName = symbolProvider.toSymbol(shape).getName();
Expand All @@ -73,10 +86,8 @@ public void run() {
member.getMemberTrait(model, DocumentationTrait.class).ifPresent(trait -> {
writer.writeDocs(trait.getValue());
});
writer.openBlock("def __init__(self, value: $T):", "", targetSymbol, () -> {
writeInitMethodConstraintsChecksForMember(member, memberSymbol.getName());
writer.write("self.value = value");
});

writeInitMethodForMember(member, memberSymbol, target, targetSymbol);

writer.openBlock("def as_dict(self) -> Dict[str, Any]:", "", () -> {
if (target.isStructureShape() || target.isUnionShape()) {
Expand Down Expand Up @@ -161,6 +172,17 @@ def __repr__(self) -> str:
writeGlobalFromDict();
}

private String getTargetFormat(MemberShape member) {
Shape target = model.expectShape(member.getTarget());
// Recursive shapes may be referenced before they're defined even with
// a topological sort. So forward references need to be used when
// referencing them.
if (recursiveShapes.contains(target)) {
return "'$T'";
}
return "$T";
}

private void writeGlobalFromDict() {
var parentSymbol = symbolProvider.toSymbol(shape);
var fromDictSymbol = parentSymbol.expectProperty("fromDict", Symbol.class);
Expand Down

This file was deleted.

Loading