Skip to content

Commit ca7e159

Browse files
chore: Change MPL branch, remove PYTHONPATH workarounds (#683)
1 parent fceb2b0 commit ca7e159

28 files changed

+24
-126
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ jobs:
2525
matrix:
2626
os:
2727
- ubuntu-latest
28-
# Windows fails due to "No module named 'Wrappers'"
29-
# This SHOULD be fixed once Dafny generates fully-qualified import statements
30-
# (i.e. doo files, per-package module names)
31-
# Disable for now
32-
# - windows-latest
28+
- windows-latest
3329
- macos-12
3430
python:
3531
- 3.8

examples/src/aws_kms_discovery_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
For more information on how to use KMS Discovery keyrings, see
3333
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
3434
"""
35-
import sys
3635

3736
import boto3
3837
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -49,11 +48,6 @@
4948
from aws_encryption_sdk import CommitmentPolicy
5049
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError
5150

52-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
53-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
54-
55-
sys.path.append(MODULE_ROOT_DIR)
56-
5751
EXAMPLE_DATA: bytes = b"Hello World"
5852

5953

examples/src/aws_kms_discovery_multi_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
For more information on how to use KMS Discovery keyrings, see
3030
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
3131
"""
32-
import sys
3332

3433
import boto3
3534
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -45,11 +44,6 @@
4544
import aws_encryption_sdk
4645
from aws_encryption_sdk import CommitmentPolicy
4746

48-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
49-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
50-
51-
sys.path.append(MODULE_ROOT_DIR)
52-
5347
EXAMPLE_DATA: bytes = b"Hello World"
5448

5549

examples/src/aws_kms_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
For more information on how to use KMS keyrings, see
1818
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html
1919
"""
20-
import sys
2120

2221
import boto3
2322
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -29,11 +28,6 @@
2928
import aws_encryption_sdk
3029
from aws_encryption_sdk import CommitmentPolicy
3130

32-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
33-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
34-
35-
sys.path.append(MODULE_ROOT_DIR)
36-
3731
EXAMPLE_DATA: bytes = b"Hello World"
3832

3933

examples/src/aws_kms_mrk_discovery_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
For more information on how to use KMS Discovery keyrings, see
3535
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
3636
"""
37-
import sys
3837

3938
import boto3
4039
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -50,11 +49,6 @@
5049
import aws_encryption_sdk
5150
from aws_encryption_sdk import CommitmentPolicy
5251

53-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
54-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
55-
56-
sys.path.append(MODULE_ROOT_DIR)
57-
5852
EXAMPLE_DATA: bytes = b"Hello World"
5953

6054

examples/src/aws_kms_mrk_discovery_multi_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
For more information on how to use KMS Discovery keyrings, see
3737
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html#kms-keyring-discovery
3838
"""
39-
import sys
4039

4140
import boto3
4241
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -52,11 +51,6 @@
5251
import aws_encryption_sdk
5352
from aws_encryption_sdk import CommitmentPolicy
5453

55-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
56-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
57-
58-
sys.path.append(MODULE_ROOT_DIR)
59-
6054
EXAMPLE_DATA: bytes = b"Hello World"
6155

6256

examples/src/aws_kms_mrk_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
For more info on KMS MRK (multi-region keys), see the KMS documentation:
2222
https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html
2323
"""
24-
import sys
2524

2625
import boto3
2726
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -33,11 +32,6 @@
3332
import aws_encryption_sdk
3433
from aws_encryption_sdk import CommitmentPolicy
3534

36-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
37-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
38-
39-
sys.path.append(MODULE_ROOT_DIR)
40-
4135
EXAMPLE_DATA: bytes = b"Hello World"
4236

4337

examples/src/aws_kms_mrk_multi_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
For more info on KMS MRK (multi-region keys), see the KMS documentation:
2828
https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html
2929
"""
30-
import sys
3130

3231
import boto3
3332
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -39,11 +38,6 @@
3938
import aws_encryption_sdk
4039
from aws_encryption_sdk import CommitmentPolicy
4140

42-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
43-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
44-
45-
sys.path.append(MODULE_ROOT_DIR)
46-
4741
EXAMPLE_DATA: bytes = b"Hello World"
4842

4943

examples/src/aws_kms_multi_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
For more information on how to use Multi keyrings, see
3737
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-multi-keyring.html
3838
"""
39-
import sys
4039

4140
import boto3
4241
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -48,11 +47,6 @@
4847
import aws_encryption_sdk
4948
from aws_encryption_sdk import CommitmentPolicy
5049

51-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
52-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
53-
54-
sys.path.append(MODULE_ROOT_DIR)
55-
5650
EXAMPLE_DATA: bytes = b"Hello World"
5751

5852

examples/src/aws_kms_rsa_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# For more information on how to use KMS keyrings, see
1515
# https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-keyring.html
1616
"""
17-
import sys
1817

1918
import boto3
2019
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -27,11 +26,6 @@
2726
from aws_encryption_sdk import CommitmentPolicy
2827
from aws_encryption_sdk.identifiers import AlgorithmSuite
2928

30-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
31-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
32-
33-
sys.path.append(MODULE_ROOT_DIR)
34-
3529
EXAMPLE_DATA: bytes = b"Hello World"
3630

3731

examples/src/branch_key_id_supplier_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def get_branch_key_id(
2525
"""Returns branch key ID from the tenant ID in input's encryption context."""
2626
encryption_context: Dict[str, str] = param.encryption_context
2727

28-
if b"tenant" not in encryption_context:
28+
if "tenant" not in encryption_context:
2929
raise ValueError("EncryptionContext invalid, does not contain expected tenant key value pair.")
3030

31-
tenant_key_id: str = encryption_context.get(b"tenant")
31+
tenant_key_id: str = encryption_context.get("tenant")
3232
branch_key_id: str
3333

34-
if tenant_key_id == b"TenantA":
34+
if tenant_key_id == "TenantA":
3535
branch_key_id = self.branch_key_id_for_tenant_A
36-
elif tenant_key_id == b"TenantB":
36+
elif tenant_key_id == "TenantB":
3737
branch_key_id = self.branch_key_id_for_tenant_B
3838
else:
3939
raise ValueError(f"Item does not contain valid tenant ID: {tenant_key_id=}")

examples/src/default_cryptographic_materials_manager_example.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
For more information on Cryptographic Material Managers, see
1919
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#crypt-materials-manager
2020
"""
21-
import sys
22-
2321
import boto3
2422
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
2523
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
@@ -33,11 +31,6 @@
3331
import aws_encryption_sdk
3432
from aws_encryption_sdk import CommitmentPolicy
3533

36-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
37-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
38-
39-
sys.path.append(MODULE_ROOT_DIR)
40-
4134
EXAMPLE_DATA: bytes = b"Hello World"
4235

4336

examples/src/file_streaming_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"""
2626
import filecmp
2727
import secrets
28-
import sys
2928

3029
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
3130
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
@@ -36,11 +35,6 @@
3635
import aws_encryption_sdk
3736
from aws_encryption_sdk import CommitmentPolicy
3837

39-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
40-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
41-
42-
sys.path.append(MODULE_ROOT_DIR)
43-
4438

4539
def encrypt_and_decrypt_with_keyring(
4640
plaintext_filename: str,

examples/src/hierarchical_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
This example also requires using a KMS Key. You need the following access on this key: -
3232
GenerateDataKeyWithoutPlaintext - Decrypt
3333
"""
34-
import sys
3534

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

5655
from .branch_key_id_supplier_example import ExampleBranchKeyIdSupplier
5756

58-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
59-
module_root_dir = '/'.join(__file__.split("/")[:-1])
60-
61-
sys.path.append(module_root_dir)
62-
6357
EXAMPLE_DATA: bytes = b"Hello World"
6458

6559

examples/src/legacy/module_.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/src/migration/migration_set_commitment_policy_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
For more information on setting your commitment policy, see
2121
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#commitment-policy
2222
"""
23-
import sys
2423

2524
import boto3
2625
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -32,11 +31,6 @@
3231
import aws_encryption_sdk
3332
from aws_encryption_sdk import CommitmentPolicy
3433

35-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
36-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
37-
38-
sys.path.append(MODULE_ROOT_DIR)
39-
4034
EXAMPLE_DATA: bytes = b"Hello World"
4135

4236

examples/src/module_.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/src/multi_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-multi-keyring.html
3838
"""
3939
import secrets
40-
import sys
4140

4241
import boto3
4342
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
@@ -54,11 +53,6 @@
5453
import aws_encryption_sdk
5554
from aws_encryption_sdk import CommitmentPolicy
5655

57-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
58-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
59-
60-
sys.path.append(MODULE_ROOT_DIR)
61-
6256
EXAMPLE_DATA: bytes = b"Hello World"
6357

6458

examples/src/raw_aes_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-keyring.html
2424
"""
2525
import secrets
26-
import sys
2726

2827
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
2928
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
@@ -34,11 +33,6 @@
3433
import aws_encryption_sdk
3534
from aws_encryption_sdk import CommitmentPolicy
3635

37-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
38-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
39-
40-
sys.path.append(MODULE_ROOT_DIR)
41-
4236
EXAMPLE_DATA: bytes = b"Hello World"
4337

4438

examples/src/raw_rsa_keyring_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
For more information on how to use Raw RSA keyrings, see
3434
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-rsa-keyring.html
3535
"""
36-
import sys
3736

3837
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
3938
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
@@ -48,11 +47,6 @@
4847
from aws_encryption_sdk import CommitmentPolicy
4948
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError
5049

51-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
52-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
53-
54-
sys.path.append(MODULE_ROOT_DIR)
55-
5650
EXAMPLE_DATA: bytes = b"Hello World"
5751

5852

examples/src/required_encryption_context_cmm.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
on encrypt such that they will not be stored on the message, but WILL be included in the header signature.
77
On decrypt, the client MUST supply the key/value pair(s) that were not stored to successfully decrypt the message.
88
"""
9-
import sys
109

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

28-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks
29-
module_root_dir = '/'.join(__file__.split("/")[:-1])
30-
31-
sys.path.append(module_root_dir)
32-
3327
EXAMPLE_DATA: bytes = b"Hello World"
3428

3529

examples/src/set_encryption_algorithm_suite_example.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-keyring.html
4040
"""
4141
import secrets
42-
import sys
4342

4443
from aws_cryptographic_materialproviders.mpl import AwsCryptographicMaterialProviders
4544
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
@@ -51,11 +50,6 @@
5150
from aws_encryption_sdk import CommitmentPolicy
5251
from aws_encryption_sdk.identifiers import AlgorithmSuite
5352

54-
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
55-
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
56-
57-
sys.path.append(MODULE_ROOT_DIR)
58-
5953
EXAMPLE_DATA: bytes = b"Hello World"
6054

6155

0 commit comments

Comments
 (0)