Skip to content

[WIP] Python DBESDK #1794

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

Draft
wants to merge 108 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
48e3204
primitives name
lucasmcdonald3 Aug 21, 2024
2bbf457
oop
lucasmcdonald3 Aug 21, 2024
0d4482a
Merge branch 'main' into primitives-name
lucasmcdonald3 Aug 21, 2024
4369a3c
snap
lucasmcdonald3 Aug 21, 2024
dac6f94
Merge branch 'main' into primitives-name
lucasmcdonald3 Aug 23, 2024
b895643
remove unnecessary asserts
ajewellamz Aug 22, 2024
81d8b26
m
ajewellamz Aug 22, 2024
4825712
m
ajewellamz Aug 22, 2024
f48a550
chore: Test with MPL main head
lucasmcdonald3 Aug 22, 2024
d21fbed
wip
lucasmcdonald3 Aug 28, 2024
2bfd3e3
merge
lucasmcdonald3 Aug 28, 2024
a4f4121
wip
lucasmcdonald3 Aug 28, 2024
1e147ae
wip python example
lucasmcdonald3 Sep 24, 2024
189af17
m
lucasmcdonald3 Oct 29, 2024
8f3604d
wip
lucasmcdonald3 Jan 6, 2025
66d573d
m
lucasmcdonald3 Jan 6, 2025
b6c8142
m
lucasmcdonald3 Jan 6, 2025
3bbe241
m
lucasmcdonald3 Jan 6, 2025
8026da0
m
lucasmcdonald3 Jan 7, 2025
39dd9e6
merge
lucasmcdonald3 Jan 7, 2025
9bbb645
?
lucasmcdonald3 Jan 10, 2025
2136eb4
wip
lucasmcdonald3 Jan 15, 2025
c832c49
wip
lucasmcdonald3 Jan 17, 2025
915ba28
m
lucasmcdonald3 Jan 17, 2025
0d54190
m
lucasmcdonald3 Jan 17, 2025
d9e2a4f
m
lucasmcdonald3 Jan 17, 2025
a2207db
Merge branch 'main' into singleton-keyvectors
lucasmcdonald3 Jan 17, 2025
90e2ede
m
lucasmcdonald3 Jan 17, 2025
a591e7f
ubuntu-not-latest
lucasmcdonald3 Jan 17, 2025
75325b0
m
lucasmcdonald3 Jan 17, 2025
b538d13
Merge branch 'main' into singleton-keyvectors
lucasmcdonald3 Jan 17, 2025
393c25e
cleanup
lucasmcdonald3 Jan 17, 2025
30aa212
merge
lucasmcdonald3 Jan 21, 2025
0f4f37a
m
lucasmcdonald3 Jan 21, 2025
736b2fe
m
lucasmcdonald3 Jan 21, 2025
2e39286
Merge branch 'wrapped-item-encryptor' into python-poc
lucasmcdonald3 Jan 21, 2025
652299c
m
lucasmcdonald3 Jan 21, 2025
ccef01c
Merge branch 'wrapped-item-encryptor' into python-poc
lucasmcdonald3 Jan 21, 2025
1eff5a7
m
lucasmcdonald3 Jan 22, 2025
a2bd9bb
m
lucasmcdonald3 Jan 31, 2025
81be9b6
m
lucasmcdonald3 Jan 31, 2025
0ef759b
m
lucasmcdonald3 Jan 31, 2025
0e41bed
m
lucasmcdonald3 Jan 31, 2025
4cdfd7f
m
lucasmcdonald3 Jan 31, 2025
4ba1345
m
lucasmcdonald3 Feb 7, 2025
05ea742
m
lucasmcdonald3 Feb 7, 2025
321284c
m
lucasmcdonald3 Feb 7, 2025
0892864
m
lucasmcdonald3 Feb 11, 2025
00c77cd
m
lucasmcdonald3 Feb 11, 2025
11c7a2b
m
lucasmcdonald3 Feb 11, 2025
058bd78
wip
lucasmcdonald3 Mar 3, 2025
a113cc4
paginator
Mar 4, 2025
daeed8d
wip
Mar 10, 2025
4383614
wip
Mar 10, 2025
ace02a2
client coverage
Mar 12, 2025
a9fabd7
wip
Mar 13, 2025
07a079a
wip
Mar 20, 2025
1fc0f77
wip, docs, tests
Mar 21, 2025
c2d54bb
wip
Mar 24, 2025
256c64b
m
Apr 3, 2025
2ed1a0e
m
Apr 7, 2025
fc72b5d
m
Apr 7, 2025
9ab80c5
m
Apr 9, 2025
12ded89
m
Apr 9, 2025
f3ae7a1
m
Apr 9, 2025
2ce6807
m
Apr 9, 2025
d3721d8
m
Apr 9, 2025
2b86238
m
Apr 9, 2025
541403b
m
Apr 9, 2025
e2c7c58
m
Apr 9, 2025
bd2e20c
m
Apr 9, 2025
a01b271
m
Apr 9, 2025
655d6d7
m
Apr 10, 2025
683dd64
m
Apr 10, 2025
d848722
m
Apr 10, 2025
86d0e65
m
Apr 10, 2025
8029445
m
Apr 10, 2025
3c80154
m
Apr 10, 2025
5e51f2c
m
Apr 10, 2025
34dae4c
m
Apr 10, 2025
357fea0
m
Apr 10, 2025
a516329
m
Apr 10, 2025
f17ddbe
m
Apr 10, 2025
2c836f0
m
Apr 10, 2025
21e4ce7
m
Apr 11, 2025
0101b05
m
Apr 11, 2025
3df8032
m
Apr 11, 2025
fbcee55
m
Apr 11, 2025
4b42e45
m
Apr 11, 2025
60b3835
m
Apr 11, 2025
2aec2c3
m
Apr 11, 2025
9a9a0b1
m
Apr 11, 2025
e352a01
m
Apr 11, 2025
7264795
m
Apr 14, 2025
6c5b215
m
Apr 15, 2025
a951d87
m
Apr 15, 2025
0606b80
m
Apr 15, 2025
5d0b615
m
Apr 15, 2025
4008095
m
Apr 16, 2025
354b806
local dafnyruntimepython
Apr 16, 2025
2387899
only config
Apr 16, 2025
c8c88bc
m
Apr 16, 2025
25d3f05
m
Apr 17, 2025
f194796
m
Apr 17, 2025
a5adf68
m
Apr 17, 2025
b502cd8
m
Apr 17, 2025
f5f5c1c
m
Apr 17, 2025
52f7c65
m
Apr 17, 2025
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
94 changes: 94 additions & 0 deletions .github/workflows/ci_examples_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This workflow performs tests in Python.
name: Python Examples

on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testPython:
strategy:
matrix:
python-version: [3.11]
os: [macos-13]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
role-session-name: DDBEC-Dafny-Python-Tests

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

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup Python ${{ matrix.python-version }} for running tests
run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Setup Dafny
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: DynamoDbEncryption
diff-generated-code: false
update-and-regenerate-mpl: true

- name: Build and locally deploy dependencies for examples
shell: bash
working-directory: ./DynamoDbEncryption
run: |
make transpile_python

- name: Test DynamoDbEncryption Examples
working-directory: ./Examples/runtimes/python
run: |
# Run simple examples
tox -e dynamodbencryption
# Run migration examples
# tox -e migration
130 changes: 130 additions & 0 deletions .github/workflows/ci_test_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# This workflow runs only Dafny-transpiled Python tests.
name: test python

on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testPython:
strategy:
fail-fast: false
matrix:
library: [DynamoDbEncryption]
python-version: ["3.11"]
os: [
# macos-13,
ubuntu-22.04,
# Dafny-transpiled Python tests use a PYTHONPATH hack that doesn't work on Windows.
# Windows is tested with non-Dafny-transpiled Python tests.
# windows-latest
]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:

- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup Python ${{ matrix.python-version }} for running tests
run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Setup Dafny
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false
update-and-regenerate-mpl: true

- name: Download Dependencies
working-directory: ./${{ matrix.library }}
run: make setup_python

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
role-session-name: DDBEC-Dafny-Net-Tests

- 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 transpile_python CORES=$CORES

- name: Test ${{ matrix.library }} Dafny-transpiled Python tests
# Dafny-transpiled Python tests use a PYTHONPATH hack that doesn't work on Windows.
# Windows is tested with non-Dafny-transpiled Python tests.
if: ${{ matrix.os != 'windows-latest' }}
working-directory: ./${{ matrix.library }}/runtimes/python
shell: bash
run: |
tox -e dafnytests

- name: Test ${{ matrix.library }} Python unit tests
working-directory: ./${{ matrix.library }}/runtimes/python
shell: bash
run: |
tox -e unit

- name: Test ${{ matrix.library }} Python integration tests
working-directory: ./${{ matrix.library }}/runtimes/python
shell: bash
run: |
tox -e integ

- name: Test ${{ matrix.library }} Python coverage
working-directory: ./${{ matrix.library }}/runtimes/python
shell: bash
run: |
tox -e encrypted-interface-coverage
tox -e client-to-resource-conversions-coverage
tox -e resource-to-client-conversions-coverage

102 changes: 102 additions & 0 deletions .github/workflows/ci_test_vector_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# This workflow performs test vectors in Python.
name: Library Python Test Vectors

on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testPython:
strategy:
fail-fast: false
matrix:
library: [TestVectors]
python-version: [3.11, 3.12, 3.13]
os: [ubuntu-22.04]
interface: [client, resource, table]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- name: Setup DynamoDB Local
uses: rrainn/[email protected]
with:
port: 8000
cors: "*"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
role-session-name: DDBEC-Dafny-Python-Tests

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

- name: Setup Dafny
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false
update-and-regenerate-mpl: true

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup Python ${{ matrix.python-version }} for running tests
run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Build Python TestVectors 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 transpile_python CORES=$CORES

- name: Test Python TestVectors with ${{matrix.interface}} interface
working-directory: ${{matrix.library}}
run: |
make test_python_${{matrix.interface}}_interface
10 changes: 10 additions & 0 deletions .github/workflows/daily_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ jobs:
uses: ./.github/workflows/library_rust_tests.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-python:
needs: getVersion
uses: ./.github/workflows/ci_test_python.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-python-examples:
needs: getVersion
uses: ./.github/workflows/ci_examples_python.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-net-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_net.yml
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ jobs:
with:
dafny: ${{ inputs.dafny }}
regenerate-code: ${{ inputs.regenerate-code }}
manual-ci-python:
uses: ./.github/workflows/ci_test_python.yml
with:
dafny: ${{ inputs.dafny }}
regenerate-code: ${{ inputs.regenerate-code }}
manual-ci-python-examples:
uses: ./.github/workflows/ci_examples_python.yml
with:
dafny: ${{ inputs.dafny }}
regenerate-code: ${{ inputs.regenerate-code }}
manual-ci-net-test-vectors:
uses: ./.github/workflows/ci_test_vector_net.yml
with:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/mpl-head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ jobs:
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
mpl-head-ci-python:
needs: getVersion
uses: ./.github/workflows/ci_test_python.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
mpl-head-ci-python-examples:
needs: getVersion
uses: ./.github/workflows/ci_examples_python.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
mpl-head-ci-net-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_net.yml
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
with:
dafny: "nightly-latest"
regenerate-code: true
dafny-nightly-python:
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/ci_test_python.yml
with:
dafny: "nightly-latest"
regenerate-code: true
dafny-nightly-test-vectors-net:
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/ci_test_vector_net.yml
Expand Down
Loading
Loading