Skip to content

chore: Change MPL branch, remove PYTHONPATH workarounds #683

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

Merged
merged 23 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
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
6 changes: 1 addition & 5 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ jobs:
matrix:
os:
- ubuntu-latest
# Windows fails due to "No module named 'Wrappers'"
# This SHOULD be fixed once Dafny generates fully-qualified import statements
# (i.e. doo files, per-package module names)
# Disable for now
# - windows-latest
- windows-latest
- macos-12
python:
- 3.8
Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_discovery_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
For more information on how to use KMS Discovery keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -49,11 +48,6 @@
from aws_encryption_sdk import CommitmentPolicy
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_discovery_multi_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
For more information on how to use KMS Discovery keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -45,11 +44,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
For more information on how to use KMS keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -29,11 +28,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_mrk_discovery_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
For more information on how to use KMS Discovery keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -50,11 +49,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_mrk_discovery_multi_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
For more information on how to use KMS Discovery keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -52,11 +51,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_mrk_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
For more info on KMS MRK (multi-region keys), see the KMS documentation:
https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -33,11 +32,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_mrk_multi_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
For more info on KMS MRK (multi-region keys), see the KMS documentation:
https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -39,11 +38,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_multi_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
For more information on how to use Multi keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-multi-keyring.html
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -48,11 +47,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/aws_kms_rsa_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# For more information on how to use KMS keyrings, see
# https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -27,11 +26,6 @@
from aws_encryption_sdk import CommitmentPolicy
from aws_encryption_sdk.identifiers import AlgorithmSuite

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
10 changes: 6 additions & 4 deletions examples/src/branch_key_id_supplier_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ def get_branch_key_id(
"""Returns branch key ID from the tenant ID in input's encryption context."""
encryption_context: Dict[str, str] = param.encryption_context

if b"tenant" not in encryption_context:
print(f"{encryption_context=}")

if "tenant" not in encryption_context:
raise ValueError("EncryptionContext invalid, does not contain expected tenant key value pair.")

tenant_key_id: str = encryption_context.get(b"tenant")
tenant_key_id: str = encryption_context.get("tenant")
branch_key_id: str

if tenant_key_id == b"TenantA":
if tenant_key_id == "TenantA":
branch_key_id = self.branch_key_id_for_tenant_A
elif tenant_key_id == b"TenantB":
elif tenant_key_id == "TenantB":
branch_key_id = self.branch_key_id_for_tenant_B
else:
raise ValueError(f"Item does not contain valid tenant ID: {tenant_key_id=}")
Expand Down
6 changes: 0 additions & 6 deletions examples/src/file_streaming_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"""
import filecmp
import secrets
import sys

from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
Expand All @@ -36,11 +35,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)


def encrypt_and_decrypt_with_keyring(
plaintext_filename: str,
Expand Down
6 changes: 0 additions & 6 deletions examples/src/hierarchical_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
This example also requires using a KMS Key. You need the following access on this key: -
GenerateDataKeyWithoutPlaintext - Decrypt
"""
import sys

import boto3
# Ignore missing MPL for pylint, but the MPL is required for this example
Expand All @@ -55,11 +54,6 @@

from .branch_key_id_supplier_example import ExampleBranchKeyIdSupplier

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
module_root_dir = '/'.join(__file__.split("/")[:-1])

sys.path.append(module_root_dir)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
1 change: 0 additions & 1 deletion examples/src/legacy/module_.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
For more information on setting your commitment policy, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#commitment-policy
"""
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -32,11 +31,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
1 change: 0 additions & 1 deletion examples/src/module_.py

This file was deleted.

6 changes: 0 additions & 6 deletions examples/src/multi_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-multi-keyring.html
"""
import secrets
import sys

import boto3
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
Expand All @@ -54,11 +53,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/raw_aes_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-keyring.html
"""
import secrets
import sys

from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
Expand All @@ -34,11 +33,6 @@
import aws_encryption_sdk
from aws_encryption_sdk import CommitmentPolicy

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/raw_rsa_keyring_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
For more information on how to use Raw RSA keyrings, see
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-rsa-keyring.html
"""
import sys

from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
Expand All @@ -48,11 +47,6 @@
from aws_encryption_sdk import CommitmentPolicy
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/required_encryption_context_cmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
on encrypt such that they will not be stored on the message, but WILL be included in the header signature.
On decrypt, the client MUST supply the key/value pair(s) that were not stored to successfully decrypt the message.
"""
import sys

import boto3
# Ignore missing MPL for pylint, but the MPL is required for this example
Expand All @@ -25,11 +24,6 @@
from aws_encryption_sdk import CommitmentPolicy
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks
module_root_dir = '/'.join(__file__.split("/")[:-1])

sys.path.append(module_root_dir)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
6 changes: 0 additions & 6 deletions examples/src/set_encryption_algorithm_suite_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-keyring.html
"""
import secrets
import sys

from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
Expand All @@ -51,11 +50,6 @@
from aws_encryption_sdk import CommitmentPolicy
from aws_encryption_sdk.identifiers import AlgorithmSuite

# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])

sys.path.append(MODULE_ROOT_DIR)

EXAMPLE_DATA: bytes = b"Hello World"


Expand Down
2 changes: 1 addition & 1 deletion performance_tests/requirements_mpl.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aws-cryptographic-material-providers @ git+https://github.com/aws/aws-cryptographic-material-providers-library.git@lucmcdon/python-mpl#subdirectory=AwsCryptographicMaterialProviders/runtimes/python
aws-cryptographic-material-providers @ git+https://github.com/aws/aws-cryptographic-material-providers-library.git@lucmcdon/python-mpl-v2#subdirectory=AwsCryptographicMaterialProviders/runtimes/python
2 changes: 1 addition & 1 deletion requirements_mpl.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aws-cryptographic-material-providers @ git+https://github.com/aws/aws-cryptographic-material-providers-library.git@lucmcdon/python-mpl#subdirectory=AwsCryptographicMaterialProviders/runtimes/python
aws-cryptographic-material-providers @ git+https://github.com/aws/aws-cryptographic-material-providers-library.git@lucmcdon/python-mpl-v2#subdirectory=AwsCryptographicMaterialProviders/runtimes/python
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_requirements():
extras_require={
"MPL": ["aws-cryptographic-material-providers @" \
"git+https://github.com/aws/aws-cryptographic-material-providers-library.git@" \
"lucmcdon/python-mpl#subdirectory=AwsCryptographicMaterialProviders/runtimes/python"],
"lucmcdon/python-mpl-v2#subdirectory=AwsCryptographicMaterialProviders/runtimes/python"],
},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
Loading
Loading