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

chore: Build ESDK-Dafny into Python, test native ESDK-Python in TestVectors CI #720

Open
wants to merge 50 commits into
base: mainline
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d2baee1
progress
josecorella Dec 3, 2024
7574c61
wip
lucasmcdonald3 Dec 12, 2024
893b4f9
python
lucasmcdonald3 Dec 12, 2024
7b52e4b
m
lucasmcdonald3 Dec 13, 2024
6a33fb3
m
lucasmcdonald3 Dec 13, 2024
65fe119
m
lucasmcdonald3 Dec 13, 2024
6805e2c
m
lucasmcdonald3 Dec 13, 2024
9db601a
m
lucasmcdonald3 Dec 13, 2024
cbc9e7d
m
lucasmcdonald3 Dec 13, 2024
470c8a7
m
lucasmcdonald3 Dec 13, 2024
bceac3b
m
lucasmcdonald3 Dec 13, 2024
bdc7446
m
lucasmcdonald3 Dec 13, 2024
b86db44
m
lucasmcdonald3 Dec 13, 2024
6978b07
m
lucasmcdonald3 Dec 13, 2024
30ae621
m
lucasmcdonald3 Dec 13, 2024
c691298
expected to pass with failfast
lucasmcdonald3 Dec 13, 2024
110c6d9
expected to fail with failfast
lucasmcdonald3 Dec 13, 2024
31a842a
normal
lucasmcdonald3 Dec 13, 2024
3b2e22c
m
josecorella Feb 14, 2025
7c5e28e
m
josecorella Feb 14, 2025
233f993
godbless reflog
josecorella Feb 14, 2025
40844b2
m
josecorella Feb 14, 2025
c80fe8e
m
josecorella Feb 14, 2025
72909f8
m
josecorella Feb 14, 2025
4a2c274
m
josecorella Feb 14, 2025
523905a
sigh
josecorella Feb 14, 2025
da30e6f
m
josecorella Feb 14, 2025
3207987
m
josecorella Feb 14, 2025
be3bc20
m
josecorella Feb 14, 2025
8af4ddd
m
josecorella Feb 14, 2025
cfa2aa7
m
josecorella Feb 14, 2025
25c95ee
chore(TestVectors): Replace Dafny ESDK-Python with native ESDK-Python…
lucasmcdonald3 Feb 14, 2025
817e3f2
m
lucasmcdonald3 Feb 14, 2025
e6a30d6
m
lucasmcdonald3 Feb 14, 2025
9f4b2fc
m
lucasmcdonald3 Feb 14, 2025
43b5297
m
lucasmcdonald3 Feb 14, 2025
a87409a
m
lucasmcdonald3 Feb 17, 2025
f0d5898
m
lucasmcdonald3 Feb 17, 2025
ff43673
m
lucasmcdonald3 Feb 17, 2025
83b50ee
clean
lucasmcdonald3 Feb 17, 2025
a1d864b
m
lucasmcdonald3 Feb 17, 2025
6dcf5ec
m
lucasmcdonald3 Feb 17, 2025
6b70388
mpl main
lucasmcdonald3 Feb 17, 2025
25053a5
m
lucasmcdonald3 Feb 17, 2025
b473d70
m
lucasmcdonald3 Feb 17, 2025
dadb633
m
lucasmcdonald3 Feb 17, 2025
6d67977
m
lucasmcdonald3 Feb 17, 2025
822e30e
m
lucasmcdonald3 Feb 17, 2025
bbb1c56
m
lucasmcdonald3 Feb 17, 2025
2ca85fa
m
lucasmcdonald3 Feb 18, 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
47 changes: 43 additions & 4 deletions .github/workflows/library_interop_test_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ jobs:
ubuntu-22.04,
macos-13,
]
language: [java, net, rust, go]
language: [java, net, rust, go, python]
# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read

steps:
- name: Support longpaths on Git checkout
run: |
Expand Down Expand Up @@ -67,6 +66,17 @@ jobs:
distribution: "corretto"
java-version: 17

- name: Setup Python for running tests
if: matrix.language == 'python'
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 Rust Toolchain for GitHub CI
if: matrix.language == 'rust'
uses: actions-rust-lang/[email protected]
Expand Down Expand Up @@ -144,6 +154,15 @@ jobs:
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_rust CORES=$CORES

- name: Build ${{ matrix.library }} implementation in Python
if: matrix.language == 'python'
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: Build ${{ matrix.library }} implementation in Go
if: matrix.language == 'go'
shell: bash
Expand Down Expand Up @@ -187,6 +206,7 @@ jobs:
testInteroperablity:
needs: generateEncryptVectors
strategy:
fail-fast: false
matrix:
library: [TestVectors]
os: [
Expand All @@ -195,8 +215,8 @@ jobs:
ubuntu-22.04,
macos-13,
]
encrypting_language: [java, net, rust, go]
decrypting_language: [java, net, rust, go]
encrypting_language: [java, net, rust, go, python]
decrypting_language: [java, net, rust, go, python]
# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -238,6 +258,17 @@ jobs:
distribution: "corretto"
java-version: 17

- name: Setup Python for running tests
if: matrix.decrypting_language == 'python'
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 Rust Toolchain for GitHub CI
if: matrix.decrypting_language == 'rust'
uses: actions-rust-lang/[email protected]
Expand Down Expand Up @@ -332,6 +363,14 @@ jobs:
run: |
make purge_polymorph_code

- name: Build ${{ matrix.library }} implementation in Python
if: matrix.decrypting_language == 'python'
shell: bash
working-directory: ./${{ matrix.library }}
run: |
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_python CORES=$CORES

- name: Download Encrypt Manifest Artifact
uses: actions/download-artifact@v4
with:
Expand Down
17 changes: 17 additions & 0 deletions AwsEncryptionSDK/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,20 @@ restore_directories:
echo "Directory $$dir not found"; \
fi \
done

PYTHON_MODULE_NAME=aws_encryption_sdk_dafny

TRANSLATION_RECORD_PYTHON := \
--translation-record ../mpl/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr \
--translation-record ../mpl/ComAmazonawsKms/runtimes/python/src/aws_cryptography_internal_kms/internaldafny/generated/dafny_src-py.dtr \
--translation-record ../mpl/ComAmazonawsDynamodb/runtimes/python/src/aws_cryptography_internal_dynamodb/internaldafny/generated/dafny_src-py.dtr \
--translation-record ../mpl/AwsCryptographyPrimitives/runtimes/python/src/aws_cryptography_primitives/internaldafny/generated/dafny_src-py.dtr \
--translation-record ../mpl/AwsCryptographicMaterialProviders/runtimes/python/src/aws_cryptographic_material_providers/internaldafny/generated/dafny_src-py.dtr

PYTHON_DEPENDENCY_MODULE_NAMES := \
--dependency-library-name=aws.cryptography.primitives=aws_cryptography_primitives \
--dependency-library-name=com.amazonaws.kms=aws_cryptography_internal_kms \
--dependency-library-name=com.amazonaws.dynamodb=aws_cryptography_internal_dynamodb \
--dependency-library-name=aws.cryptography.materialProviders=aws_cryptographic_material_providers \
--dependency-library-name=aws.cryptography.keyStore=aws_cryptographic_material_providers \
--dependency-library-name=smithy.api=aws_cryptographic_material_providers
10 changes: 10 additions & 0 deletions AwsEncryptionSDK/runtimes/java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Important: Do not use this code. This package is AWS-internal.

This is NOT the released version of the AWS Encryption SDK for Java.

You can access the AWS Encryption SDK for Java at:

- Github: https://github.com/aws/aws-encryption-sdk-java
- Maven: https://mvnrepository.com/artifact/com.amazonaws/aws-encryption-sdk-java

This is an in-development rewrite of the AWS Encryption SDK for Java and should not be used until development is complete.
16 changes: 16 additions & 0 deletions AwsEncryptionSDK/runtimes/python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Python build artifacts
__pycache__
**/__pycache__
*.pyc
src/**.egg-info/
build
poetry.lock
**/poetry.lock
dist

# Dafny-generated Python
**/internaldafny/generated/*.py

# Python test artifacts
.tox
.pytest_cache
10 changes: 10 additions & 0 deletions AwsEncryptionSDK/runtimes/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Important: Do not use this code. This package is AWS-internal.

This is NOT the released version of the AWS Encryption SDK for Python.

You can access the AWS Encryption SDK for Python at:

- Github: https://github.com/aws/aws-encryption-sdk-python
- PyPI: https://pypi.org/project/aws-encryption-sdk/

This is an in-development rewrite of the AWS Encryption SDK for Python and should not be used until development is complete.
36 changes: 36 additions & 0 deletions AwsEncryptionSDK/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[tool.poetry]
# Note: We should not release this library with this name.
# We should release this library under the name `aws-encryption-sdk`.
# But this repo's TestVectors test the released, native version of the ESDK,
# which has this name.
# The names conflict, and issues arise from this.
# When we are ready to release the Dafny-Python ESDK, we should rename this,
# but figure out if/how we can still test the native ESDK in this repo.
name = "aws-encryption-sdk-dafny"
version = "0.1.0"
description = ""
authors = ["AWS Crypto Tools <[email protected]>"]
# Note: We should not release this library with this package name.
# We should release this library with the package name `aws_encryption_sdk`.
# But this repo's TestVectors test the released, native version of the ESDK,
# which has this name.
# The names conflict, and issues arise from this.
# When we are ready to release the Dafny-Python ESDK, we should rename this,
# but figure out if/how we can still test the native ESDK in this repo.
packages = [
{ include = "aws_encryption_sdk_dafny", from = "src" }
]
# Include generated internaldafny files in package distributions,
# even though they are not included in version control
include = ["**/internaldafny/generated/*.py"]

[tool.poetry.dependencies]
python = "^3.11.0"
aws-cryptographic-material-providers = { path = "../../../mpl/AwsCryptographicMaterialProviders/runtimes/python", develop = false}

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"

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

# Initialize generated Dafny
from .internaldafny.generated import module_
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
file_format_version = "1.0"
dafny_version = "4.9.0.0"
[options_by_module.AwsCryptographyEncryptionSdkTypes]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.AbstractAwsCryptographyEncryptionSdkOperations]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.AbstractAwsCryptographyEncryptionSdkService]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.SerializableTypes]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.SerializeFunctions]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.EncryptionContext]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.HeaderTypes]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.SharedHeaderFunctions]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.EncryptedDataKeys]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.V1HeaderBody]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.V2HeaderBody]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.HeaderAuth]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.Header]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.Frames]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.MessageBody]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.KeyDerivation]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.EncryptDecryptHelpers]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.AwsEncryptionSdkOperations]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
[options_by_module.ESDK]
legacy-module-names = false
python-module-name = "aws_encryption_sdk_dafny.internaldafny.generated"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
Loading
Loading