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 POC #282

Closed
wants to merge 445 commits into from
Closed
Show file tree
Hide file tree
Changes from 180 commits
Commits
Show all changes
445 commits
Select commit Hold shift + click to select a range
a4bbd4d
comment
Sep 29, 2023
22eb959
wrap configs
Sep 29, 2023
884706f
utf8
Oct 2, 2023
3fd241a
fix stdlib
Oct 2, 2023
cb030b2
clarify
Oct 2, 2023
3a13661
fix
Oct 2, 2023
23ae9f3
catch more exceptions
Oct 3, 2023
795c148
changes
Oct 3, 2023
5c5b04a
refactor
Oct 4, 2023
ca6acb0
fix
Oct 4, 2023
d105232
fix
Oct 4, 2023
7bec002
clean externs
Oct 4, 2023
8e49dcb
fix
Oct 4, 2023
a5d1a6d
update gitignore
Oct 4, 2023
41e7e81
fix
Oct 4, 2023
34ea223
todos
Oct 5, 2023
bc67cd4
Merge branch 'main-1.x' into lucmcdon/python-poc
lucasmcdonald3 Oct 5, 2023
a361478
fix
Oct 5, 2023
959bb0a
Merge branch 'lucmcdon/python-poc' of github.com:smithy-lang/smithy-d…
Oct 5, 2023
99a2074
beta codegen for recursive structures via explicit conversion functions
Oct 9, 2023
847a792
fixed circular dependency on dafny_to_smithy
Oct 10, 2023
2c29c19
non-service codegen
Oct 10, 2023
471bea1
fix unions
Oct 10, 2023
ca0bb2b
dependencies
Oct 10, 2023
92c638b
refactor
Oct 10, 2023
871cfe0
fix
Oct 10, 2023
867d999
fix
Oct 10, 2023
bc34466
refactors
Oct 10, 2023
1b0bc2b
fix deps
Oct 11, 2023
51d1fa7
cleanup for conversions PR
Oct 11, 2023
1433680
refactor for cli integration pr
Oct 11, 2023
412b416
fix
Oct 11, 2023
808ced5
fixes
Oct 11, 2023
d195d89
refactor cli
Oct 12, 2023
48626a0
makefile
Oct 12, 2023
160ac0f
temp makefile
Oct 12, 2023
c4f22de
fix
Oct 12, 2023
c470ddb
fix?
Oct 12, 2023
77f4e16
cleanup
Oct 12, 2023
d7c7520
cleanup
Oct 12, 2023
331a534
??
Oct 12, 2023
bf87655
fix?
Oct 12, 2023
791ef2c
fix
Oct 12, 2023
43e9067
?
Oct 13, 2023
4226669
Merge branch 'temp' into lucmcdon/python-poc
Oct 13, 2023
b9bb983
...
Oct 13, 2023
e19b2a2
debug
Oct 13, 2023
7117525
?
Oct 13, 2023
a337b13
changes
Oct 13, 2023
d374fd4
changes
Oct 13, 2023
1876a61
fix net
Oct 13, 2023
f27a49f
cleanup
Oct 13, 2023
0a8d226
add types for completeness since these are benerated
Feb 17, 2023
6a0312a
foo
Sep 26, 2023
8a254c5
Merge branch 'main-1.x' of github.com:lucasmcdonald3/smithy-dafny int…
Oct 13, 2023
f9f5b5a
Merge branch 'main-1.x' into lucmcdon/python-poc
Oct 13, 2023
cb619a8
refactor
Oct 13, 2023
34cb179
fix
Oct 13, 2023
358496e
fix
Oct 13, 2023
60e73f6
fix
Oct 13, 2023
ec10c29
clean comment
Oct 13, 2023
cb99d88
changes
Oct 13, 2023
09fc556
update submodule
Oct 13, 2023
98d4f48
Merge branch 'lucmcdon/python-poc' into lucmcdon/python-kms
Oct 13, 2023
e6337da
with the new setup
Oct 13, 2023
58083f7
checkpoint
Oct 16, 2023
45465ef
check
Oct 17, 2023
de602c6
checkpoint
Oct 17, 2023
8d5fc09
checkpoint
Oct 18, 2023
60a98d8
sdks ok
Oct 18, 2023
86b2685
localservices back
Oct 18, 2023
eee69a6
changes
Oct 19, 2023
8d05edd
progress
Oct 20, 2023
93d2fce
refactor
Oct 20, 2023
6d41d44
kms pass again
Oct 20, 2023
daadf0f
changes
Oct 20, 2023
53a69ee
cleanup
Oct 23, 2023
a09bf5b
contraint pass again
Oct 25, 2023
c3bff79
constraints gen and pass
Oct 25, 2023
e945b8d
rm
Oct 25, 2023
663d510
dependencies
Oct 25, 2023
767ba3f
ddb
Oct 25, 2023
00d23a1
run sdks on gha
Oct 25, 2023
203308f
update submodule
Oct 26, 2023
47e44e9
fix
Oct 26, 2023
f3d21d9
fix
Oct 26, 2023
6dba062
fix
Oct 26, 2023
87aea4a
fix
Oct 26, 2023
9f775d9
fix refinement
Oct 26, 2023
dd2d0be
help aws
Oct 26, 2023
294fa95
pretend net
Oct 26, 2023
449abf0
tox MUST pass env varx
Oct 26, 2023
2a856c7
fix union
Oct 26, 2023
c91e3a6
fix extendable
Oct 26, 2023
bc3f71a
fix enum
Oct 26, 2023
4d376b8
fix deps
Oct 26, 2023
46e4b01
testtest
Oct 26, 2023
eb3cf75
debug
Oct 30, 2023
2ef71f0
debug
Oct 30, 2023
300032a
debug
Oct 30, 2023
a76a365
changes
Oct 30, 2023
8581680
fix
Oct 30, 2023
790adaa
fix
Oct 30, 2023
57b65f2
cleanup
Oct 30, 2023
0075c74
cleanup
Oct 30, 2023
edac414
cleanup
Oct 30, 2023
fec3c4b
testmodels cleanup
Oct 31, 2023
af8261f
refactor
Oct 31, 2023
71cd9aa
finish errors todos
Oct 31, 2023
01bc1dd
cleanup for overwrites
Oct 31, 2023
abbf4e2
update submodule
Oct 31, 2023
b600f2f
add resource reference shapes as resources to model
Nov 7, 2023
d978a91
mpl progress
Nov 16, 2023
6a816f9
sync
Nov 16, 2023
56eaee2
work on gen for mpl
Nov 30, 2023
5a5ebec
wip
Dec 4, 2023
dbf8b33
add missing file
Dec 4, 2023
b2fa87a
generating testvectors
lucasmcdonald3 Dec 8, 2023
4d9e418
wip, errors
lucasmcdonald3 Dec 11, 2023
85a0a97
generating passing the mpl tests
lucasmcdonald3 Dec 22, 2023
14880d0
cleanup
lucasmcdonald3 Dec 22, 2023
930ab50
progress
lucasmcdonald3 Dec 22, 2023
d153d24
fix constructor
lucasmcdonald3 Dec 22, 2023
af5a05f
Merge branch 'main-1.x' into lucmcdon/python-poc
lucasmcdonald3 Dec 22, 2023
c170266
changes
lucasmcdonald3 Dec 22, 2023
d76c268
fix"
lucasmcdonald3 Dec 22, 2023
2188f47
changes
lucasmcdonald3 Dec 22, 2023
81f71ee
missing... file?
lucasmcdonald3 Dec 22, 2023
97e180e
changes
lucasmcdonald3 Dec 22, 2023
467b8e4
changes
lucasmcdonald3 Dec 22, 2023
2be673a
changes
lucasmcdonald3 Dec 22, 2023
8107384
cleanup
lucasmcdonald3 Dec 22, 2023
97be79e
migrate more
lucasmcdonald3 Dec 23, 2023
131a7ef
missing'
lucasmcdonald3 Dec 23, 2023
164dd43
m
lucasmcdonald3 Dec 23, 2023
d619c8d
m
lucasmcdonald3 Dec 23, 2023
4a67e9b
union
lucasmcdonald3 Dec 24, 2023
9348145
extendable
lucasmcdonald3 Dec 24, 2023
79763c8
more
lucasmcdonald3 Dec 25, 2023
c705b79
add missing
lucasmcdonald3 Dec 25, 2023
0e7521b
remove wrapped smithygenerated dir
lucasmcdonald3 Dec 25, 2023
f5a591f
fix deps?
lucasmcdonald3 Dec 27, 2023
d61d685
missing'
lucasmcdonald3 Dec 27, 2023
43711c7
fix ref?
lucasmcdonald3 Dec 27, 2023
88a8106
fixes
lucasmcdonald3 Dec 27, 2023
6c91dd0
fix ref?
lucasmcdonald3 Dec 27, 2023
f8850c1
fix sks
lucasmcdonald3 Dec 27, 2023
1d689e8
ls
lucasmcdonald3 Dec 27, 2023
de53492
ls
lucasmcdonald3 Dec 27, 2023
39f4ace
gha
lucasmcdonald3 Dec 27, 2023
e4597a3
fix
lucasmcdonald3 Dec 27, 2023
e0d5502
fix
lucasmcdonald3 Dec 27, 2023
6a97852
?
lucasmcdonald3 Dec 27, 2023
6068db2
wipmultiple
lucasmcdonald3 Dec 27, 2023
3727791
MM
lucasmcdonald3 Dec 28, 2023
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)
justplaz May 1, 2024
30ee7dd
copyright
lucasmcdonald3 May 7, 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
5 changes: 4 additions & 1 deletion .github/workflows/smithy-dafny-conversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '8'
java-version: '17'
texastony marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup Dafny
uses: dafny-lang/[email protected]
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/smithy-polymorph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
distribution: 'corretto'
Expand All @@ -35,6 +38,14 @@ jobs:
arguments: :smithy-dafny-codegen:publishToMavenLocal
build-root-directory: codegen

# Required for building Smithy-Dafny
# TODO: This step can and should be removed once Smithy-Python is on Maven central
- name: Locally cache smithy-python-codegen
uses: gradle/gradle-build-action@v2
with:
arguments: :smithy-python-codegen:publishToMavenLocal
build-root-directory: submodules/smithy-python/codegen

- name: Sanity-check SQS test model via plugin
uses: gradle/gradle-build-action@v2
with:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test_models_dafny_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ jobs:
run: |
git config --global core.longpaths true

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: Setup Dafny
uses: dafny-lang/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_models_java_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ jobs:
role-session-name: JavaTests

- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Dafny
uses: dafny-lang/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_models_net_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jobs:
role-session-name: NetTests

- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Dafny
uses: dafny-lang/[email protected]
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/test_models_python_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# This workflow performs tests in Python.
name: Library Python tests

on:
pull_request:
push:
branches:
- main-1.x
workflow_dispatch:
# Manual trigger for this workflow, either the normal version
# or the nightly build that uses the latest Dafny prerelease
# (accordingly to the "nightly" parameter).
inputs:
nightly:
description: 'Run the nightly build'
required: false
type: boolean
schedule:
# Nightly build against Dafny's nightly prereleases,
# for early warning of verification issues or regressions.
# Timing chosen to be adequately after Dafny's own nightly build,
# but this might need to be tweaked:
# https://github.com/dafny-lang/dafny/blob/master/.github/workflows/deep-tests.yml#L16
- cron: "30 16 * * *"

jobs:
testPython:
# Don't run the nightly build on forks
if: github.event_name != 'schedule' || github.repository_owner == 'smithy-lang'
strategy:
matrix:
library: [
# TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on
TestModels/Aggregate,
# TestModels/AggregateReferences,
TestModels/Constraints,
TestModels/Constructor,
TestModels/Dependencies,
TestModels/Errors,
TestModels/Extendable,
TestModels/Extern,
TestModels/LocalService,
TestModels/Refinement,
TestModels/Resource,
# TestModels/SimpleTypes/BigDecimal,
# TestModels/SimpleTypes/BigInteger,
TestModels/SimpleTypes/SimpleBlob,
TestModels/SimpleTypes/SimpleBoolean,
# TestModels/SimpleTypes/SimpleByte,
TestModels/SimpleTypes/SimpleDouble,
TestModels/SimpleTypes/SimpleEnum,
# TestModels/SimpleTypes/SimpleEnumV2,
# TestModels/SimpleTypes/SimpleFloat,
TestModels/SimpleTypes/SimpleInteger,
TestModels/SimpleTypes/SimpleLong,
# TestModels/SimpleTypes/SimpleShort,
TestModels/SimpleTypes/SimpleString,
# TestModels/SimpleTypes/SimpleTimestamp,
TestModels/Union,
# TestModels/aws-sdks/ddb,
# TestModels/aws-sdks/kms,
]
runs-on: "ubuntu-latest"
permissions:
id-token: write
contents: read
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-PolymorphTestModels-Role-us-west-2
role-session-name: PythonTests

- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: 'nightly-latest'

- name: Setup Python for running tests
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64
- run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Setup Java 17 for codegen
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: Generate Polymorph Dafny and Python code
shell: bash
working-directory: ./${{ matrix.library }}
run: |
make polymorph_dafny
make polymorph_python

- name: Compile ${{ matrix.library }} implementation
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
CORES=$(node -e 'console.log(os.cpus().length)')
make build_python CORES=$CORES

- name: Test ${{ matrix.library }}
working-directory: ./${{ matrix.library }}
shell: bash
run: |
make test_python
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
/.idea
/.history
/.smithy.lsp.log

*.pyc
*/**/.idea
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/smithy-python"]
path = submodules/smithy-python
url = [email protected]:lucasmcdonald3/smithy-python.git
15 changes: 15 additions & 0 deletions TestModels/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
**/runtimes/java/src/main/dafny-generated/
**/runtimes/java/src/test/dafny-generated/

# Dafny Generated Python
**/runtimes/python/src/**/internal_generated_dafny/*.py
**/runtimes/python/test/internal_generated_dafny/*.py

# Polymorph Generated Dafny
**/Model/*Types.dfy
**/Model/*TypesWrapped.dfy
Expand All @@ -20,10 +24,21 @@
# Polymorph Generated Java
**/runtimes/java/src/main/smithy-generated/

# Polymorph Generated Python
**/runtimes/python/src/**/smithygenerated/

# .NET Artifacts
**/bin
**/obj

# Python Artifacts
**/runtimes/python/src/**.egg-info/
**/runtimes/python/.pytest_cache
**/runtimes/python/.tox
**/runtimes/python/build
**/runtimes/python/poetry.lock
**/runtimes/python/**/poetry.lock

# JetBrains
**/.idea/
**/Folder.DotSettings.user
Expand Down
26 changes: 26 additions & 0 deletions TestModels/Aggregate/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tool.poetry]
name = "simple-aggregate"
version = "0.1.0"
description = ""
authors = ["AWS <[email protected]>"]
packages = [
{ include = "simple_aggregate", from = "src" }
]
# Include all of the following .gitignored files in package distributions,
# even though it is not included in version control
include = ["**/smithygenerated/*.py", "**/internal_generated_dafny/*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"
simple-aggregate-internaldafny = { path = "src/simple_aggregate/internal_generated_dafny", develop = false}
# TODO: Depend on PyPi once Smithy-Python publishes their Python package there
smithy-python = { path = "../../../../submodules/smithy-python/python-packages/smithy-python", develop = false}
standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false}

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
simple-aggregate-test-internaldafny = { path = "test/internal_generated_dafny", develop = false}

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

import simple_aggregate_internaldafny_wrapped
from simple_aggregate.smithygenerated.client import SimpleAggregate
from simple_aggregate.smithygenerated.shim import SimpleAggregateShim
import Wrappers

@staticmethod
def WrappedSimpleAggregate(config):
wrapped_config = config
impl = SimpleAggregate(wrapped_config)
wrapped_client = SimpleAggregateShim(impl)
return Wrappers.Result_Success(wrapped_client)

simple_aggregate_internaldafny_wrapped.default__.WrappedSimpleAggregate = WrappedSimpleAggregate
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "simple-aggregate-internaldafny"
version = "0.1.0"
description = ""
authors = ["AWS <[email protected]>"]
packages = [
# Globally install all internaldafny modules
# such that a module X can be imported with `import X`
# from anywhere in the Python runtime that installs this module
{ include = "*.py" },
]
# Include all of the following .gitignored files in package distributions,
# even though it is not included in version control
include = ["*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
texastony marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Wrapper file for executing Dafny tests from pytest.
This allows us to import modules required by Dafny-generated tests
before executing Dafny-generated tests.
pytest will find and execute the `test_dafny` method below,
which will execute the `test.py` file in the `dafny` directory.
"""

import glob
from os.path import isfile, join
import importlib

# Import modules required for Dafny-generated tests.
# This is not generated; these must be manually added.

from simple_aggregate.extern import wrapped_simple_aggregate

# End import modules required for Dafny-generated tests

def test_dafny():
dafny_modules = glob.glob(join("/".join(__file__.split("/")[:-2]) + "/internal_generated_dafny/", "*.py"), recursive=True)
for f in dafny_modules:
if isfile(f) and f.endswith('test.py'):
fname = str(f).split("/")[-1].split(".")[0]
spec = importlib.util.spec_from_file_location(fname, f)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "simple-aggregate-test-internaldafny"
version = "0.1.0"
description = ""
authors = ["AWS <[email protected]>"]
packages = [
# Globally install all internaldafny modules
# such that a module X can be imported with `import X`
# from anywhere in the Python runtime that installs this module
{ include = "*.py" },
]
# Include all of the following .gitignored files in package distributions,
# even though it is not included in version control
include = ["*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
13 changes: 13 additions & 0 deletions TestModels/Aggregate/runtimes/python/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
isolated_build = True
envlist =
py{311}

[testenv]
skip_install = true
allowlist_externals = poetry
commands_pre =
poetry lock
poetry install
commands =
poetry run pytest test/ --import-mode importlib
11 changes: 11 additions & 0 deletions TestModels/Aggregate/smithy-build.json
texastony marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "1.0",
"plugins": {
"dafny-client-codegen": {
"service": "simple.aggregate#SimpleAggregate",
"module": "simple_aggregate",
"moduleVersion": "0.0.1",
"protocol": "aws.polymorph#localService"
}
}
}
Loading
Loading