Skip to content

Commit 0ead7b3

Browse files
committed
Updates for project structure.
1 parent f117f33 commit 0ead7b3

8 files changed

Lines changed: 77 additions & 56 deletions

File tree

.doc_gen/metadata/sesv2_metadata.yaml

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sesv2_CreateContactList:
3939
Python:
4040
versions:
4141
- sdk_version: 3
42-
github: python/example_code/sesv2
42+
github: python/example_code/sesv2/newsletter_scenario
4343
excerpts:
4444
- description:
4545
genai: most
@@ -89,7 +89,7 @@ sesv2_CreateContact:
8989
Python:
9090
versions:
9191
- sdk_version: 3
92-
github: python/example_code/sesv2
92+
github: python/example_code/sesv2/newsletter_scenario
9393
excerpts:
9494
- description:
9595
genai: most
@@ -104,7 +104,7 @@ sesv2_GetEmailIdentity:
104104
Python:
105105
versions:
106106
- sdk_version: 3
107-
github: python/example_code/sesv2
107+
github: python/example_code/sesv2/attachments_scenario
108108
excerpts:
109109
- description:
110110
snippet_tags:
@@ -172,7 +172,7 @@ sesv2_ListContacts:
172172
Python:
173173
versions:
174174
- sdk_version: 3
175-
github: python/example_code/sesv2
175+
github: python/example_code/sesv2/newsletter_scenario
176176
excerpts:
177177
- description:
178178
genai: most
@@ -243,7 +243,14 @@ sesv2_SendEmail:
243243
Python:
244244
versions:
245245
- sdk_version: 3
246-
github: python/example_code/sesv2
246+
github: python/example_code/sesv2/attachments_scenario
247+
excerpts:
248+
- description: Sends a message with optional attachments.
249+
snippet_tags:
250+
- python.example_code.sesv2.SESv2Wrapper.decl
251+
- python.example_code.sesv2.SendEmail
252+
- sdk_version: 3
253+
github: python/example_code/sesv2/newsletter_scenario
247254
excerpts:
248255
- description: Sends a message to all members of the contact list.
249256
genai: most
@@ -257,10 +264,6 @@ sesv2_SendEmail:
257264
- python.example_code.sesv2.SESv2Workflow.main
258265
- python.example_code.sesv2.SESv2Workflow.decl
259266
- python.example_code.sesv2.SendEmail.template
260-
- description: Sends a message with optional attachments.
261-
snippet_tags:
262-
- python.example_code.sesv2.SESv2Wrapper.decl
263-
- python.example_code.sesv2.SendEmail
264267
services:
265268
sesv2: {SendEmail}
266269
sesv2_CreateEmailIdentity:
@@ -295,17 +298,20 @@ sesv2_CreateEmailIdentity:
295298
Python:
296299
versions:
297300
- sdk_version: 3
298-
github: python/example_code/sesv2
301+
github: python/example_code/sesv2/attachments_scenario
299302
excerpts:
300303
- description:
301-
genai: most
302304
snippet_tags:
303-
- python.example_code.sesv2.SESv2Workflow.main
304-
- python.example_code.sesv2.SESv2Workflow.decl
305+
- python.example_code.sesv2.SESv2Wrapper.decl
305306
- python.example_code.sesv2.CreateEmailIdentity
307+
- sdk_version: 3
308+
github: python/example_code/sesv2/newsletter_scenario
309+
excerpts:
306310
- description:
311+
genai: most
307312
snippet_tags:
308-
- python.example_code.sesv2.SESv2Wrapper.decl
313+
- python.example_code.sesv2.SESv2Workflow.main
314+
- python.example_code.sesv2.SESv2Workflow.decl
309315
- python.example_code.sesv2.CreateEmailIdentity
310316
Rust:
311317
versions:
@@ -350,17 +356,20 @@ sesv2_CreateEmailTemplate:
350356
Python:
351357
versions:
352358
- sdk_version: 3
353-
github: python/example_code/sesv2
359+
github: python/example_code/sesv2/attachments_scenario
354360
excerpts:
355361
- description:
356-
genai: most
357362
snippet_tags:
358-
- python.example_code.sesv2.SESv2Workflow.main
359-
- python.example_code.sesv2.SESv2Workflow.decl
363+
- python.example_code.sesv2.SESv2Wrapper.decl
360364
- python.example_code.sesv2.CreateEmailTemplate
365+
- sdk_version: 3
366+
github: python/example_code/sesv2/newsletter_scenario
367+
excerpts:
361368
- description:
369+
genai: most
362370
snippet_tags:
363-
- python.example_code.sesv2.SESv2Wrapper.decl
371+
- python.example_code.sesv2.SESv2Workflow.main
372+
- python.example_code.sesv2.SESv2Workflow.decl
364373
- python.example_code.sesv2.CreateEmailTemplate
365374
Rust:
366375
versions:
@@ -405,7 +414,7 @@ sesv2_DeleteContactList:
405414
Python:
406415
versions:
407416
- sdk_version: 3
408-
github: python/example_code/sesv2
417+
github: python/example_code/sesv2/newsletter_scenario
409418
excerpts:
410419
- description:
411420
genai: most
@@ -456,17 +465,20 @@ sesv2_DeleteEmailIdentity:
456465
Python:
457466
versions:
458467
- sdk_version: 3
459-
github: python/example_code/sesv2
468+
github: python/example_code/sesv2/attachments_scenario
460469
excerpts:
461470
- description:
462-
genai: most
463471
snippet_tags:
464-
- python.example_code.sesv2.SESv2Workflow.main
465-
- python.example_code.sesv2.SESv2Workflow.decl
472+
- python.example_code.sesv2.SESv2Wrapper.decl
466473
- python.example_code.sesv2.DeleteEmailIdentity
474+
- sdk_version: 3
475+
github: python/example_code/sesv2/newsletter_scenario
476+
excerpts:
467477
- description:
478+
genai: most
468479
snippet_tags:
469-
- python.example_code.sesv2.SESv2Wrapper.decl
480+
- python.example_code.sesv2.SESv2Workflow.main
481+
- python.example_code.sesv2.SESv2Workflow.decl
470482
- python.example_code.sesv2.DeleteEmailIdentity
471483
Rust:
472484
versions:
@@ -511,17 +523,20 @@ sesv2_DeleteEmailTemplate:
511523
Python:
512524
versions:
513525
- sdk_version: 3
514-
github: python/example_code/sesv2
526+
github: python/example_code/sesv2/attachments_scenario
515527
excerpts:
516528
- description:
517-
genai: most
518529
snippet_tags:
519-
- python.example_code.sesv2.SESv2Workflow.main
520-
- python.example_code.sesv2.SESv2Workflow.decl
530+
- python.example_code.sesv2.SESv2Wrapper.decl
521531
- python.example_code.sesv2.DeleteEmailTemplate
532+
- sdk_version: 3
533+
github: python/example_code/sesv2/newsletter_scenario
534+
excerpts:
522535
- description:
536+
genai: most
523537
snippet_tags:
524-
- python.example_code.sesv2.SESv2Wrapper.decl
538+
- python.example_code.sesv2.SESv2Workflow.main
539+
- python.example_code.sesv2.SESv2Workflow.decl
525540
- python.example_code.sesv2.DeleteEmailTemplate
526541
Rust:
527542
versions:
@@ -573,7 +588,7 @@ sesv2_NewsletterWorkflow:
573588
Python:
574589
versions:
575590
- sdk_version: 3
576-
github: python/example_code/sesv2
591+
github: python/example_code/sesv2/newsletter_scenario
577592
excerpts:
578593
- description:
579594
genai: most
@@ -620,7 +635,7 @@ sesv2_Hello:
620635
Python:
621636
versions:
622637
- sdk_version: 3
623-
github: python/example_code/sesv2
638+
github: python/example_code/sesv2/attachments_scenario
624639
excerpts:
625640
- description:
626641
snippet_tags:
@@ -636,7 +651,7 @@ sesv2_SendBulkEmail:
636651
Python:
637652
versions:
638653
- sdk_version: 3
639-
github: python/example_code/sesv2
654+
github: python/example_code/sesv2/attachments_scenario
640655
excerpts:
641656
- description:
642657
snippet_tags:
@@ -660,13 +675,13 @@ sesv2_Scenario_EmailAttachments:
660675
Python:
661676
versions:
662677
- sdk_version: 3
663-
github: python/example_code/sesv2
678+
github: python/example_code/sesv2/attachments_scenario
664679
excerpts:
665-
- description: Create an SESv2 wrapper class to manage operations.
666-
snippet_tags:
667-
- python.example_code.sesv2.SESv2Wrapper.class
668680
- description: Run an interactive scenario demonstrating email attachments.
669681
snippet_tags:
670682
- python.example_code.sesv2.Scenario_EmailAttachments
683+
- description: Create an SESv2 wrapper class to manage operations.
684+
snippet_tags:
685+
- python.example_code.sesv2.SESv2Wrapper.class
671686
services:
672687
sesv2: {SendEmail, SendBulkEmail, CreateEmailIdentity, CreateEmailTemplate, GetEmailIdentity, DeleteEmailTemplate, DeleteEmailIdentity}

python/example_code/sesv2/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,36 @@ python -m pip install -r requirements.txt
3636

3737
### Get started
3838

39-
- [Hello Amazon SES v2 API](sesv2_hello.py#L18) (`ListEmailIdentities`)
39+
- [Hello Amazon SES v2 API](attachments_scenario/sesv2_hello.py#L18) (`ListEmailIdentities`)
4040

4141

4242
### Single actions
4343

4444
Code excerpts that show you how to call individual service functions.
4545

46-
- [CreateContact](newsletter.py#L155)
47-
- [CreateContactList](newsletter.py#L105)
48-
- [CreateEmailIdentity](sesv2_wrapper.py#L73)
49-
- [CreateEmailTemplate](sesv2_wrapper.py#L109)
50-
- [DeleteContactList](newsletter.py#L258)
51-
- [DeleteEmailIdentity](sesv2_wrapper.py#L321)
52-
- [DeleteEmailTemplate](sesv2_wrapper.py#L291)
53-
- [GetEmailIdentity](sesv2_wrapper.py#L42)
54-
- [ListContacts](newsletter.py#L198)
55-
- [SendEmail](newsletter.py#L164)
46+
- [CreateContact](newsletter_scenario/newsletter.py#L155)
47+
- [CreateContactList](newsletter_scenario/newsletter.py#L105)
48+
- [CreateEmailIdentity](newsletter_scenario/newsletter.py#L92)
49+
- [CreateEmailTemplate](newsletter_scenario/newsletter.py#L118)
50+
- [DeleteContactList](newsletter_scenario/newsletter.py#L258)
51+
- [DeleteEmailIdentity](newsletter_scenario/newsletter.py#L286)
52+
- [DeleteEmailTemplate](newsletter_scenario/newsletter.py#L271)
53+
- [GetEmailIdentity](attachments_scenario/sesv2_wrapper.py#L42)
54+
- [ListContacts](newsletter_scenario/newsletter.py#L198)
55+
- [SendEmail](attachments_scenario/sesv2_wrapper.py#L155)
5656

5757
### Scenarios
5858

5959
Code examples that show you how to accomplish a specific task by calling multiple
6060
functions within the same service.
6161

62-
- [Email Attachments Scenario](sesv2_wrapper.py)
63-
- [Newsletter scenario](newsletter.py)
62+
- [Email Attachments Scenario](attachments_scenario/scenario_sesv2_email_attachments.py)
63+
- [Newsletter scenario](newsletter_scenario/newsletter.py)
6464

6565
### Actions
6666
_Actions_ are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
6767

68-
- [SendBulkEmail](sesv2_wrapper.py#L227)
68+
- [SendBulkEmail](attachments_scenario/sesv2_wrapper.py#L227)
6969

7070

7171
<!--custom.examples.start-->
@@ -91,7 +91,7 @@ To run the Newsletter example, copy the files from workflows/sesv2_weekly_mailer
9191
This example shows you how to get started using Amazon SES v2 API.
9292

9393
```
94-
python sesv2_hello.py
94+
python attachments_scenario/sesv2_hello.py
9595
```
9696

9797

@@ -112,7 +112,7 @@ This example shows you how to send emails with attachments using Amazon SES v2 A
112112
Start the example by running the following at a command prompt:
113113

114114
```
115-
python sesv2_wrapper.py
115+
python attachments_scenario/scenario_sesv2_email_attachments.py
116116
```
117117

118118

@@ -130,7 +130,7 @@ This example shows you how to run the Amazon SES v2 API newsletter scenario.
130130
Start the example by running the following at a command prompt:
131131

132132
```
133-
python newsletter.py
133+
python newsletter_scenario/newsletter.py
134134
```
135135

136136

python/example_code/sesv2/scenario_sesv2_email_attachments.py renamed to python/example_code/sesv2/attachments_scenario/scenario_sesv2_email_attachments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from sesv2_wrapper import SESv2Wrapper
2424

2525
# Add relative path to include demo_tools in this code example without need for setup.
26-
sys.path.append("../..")
26+
sys.path.append("../../..")
2727
import demo_tools.question as q # noqa
2828

2929
logger = logging.getLogger(__name__)

python/example_code/sesv2/sesv2_hello.py renamed to python/example_code/sesv2/attachments_scenario/sesv2_hello.py

File renamed without changes.
File renamed without changes.

python/example_code/sesv2/test_sesv2_email_attachments.py renamed to python/example_code/sesv2/attachments_scenario/test/test_sesv2_email_attachments.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"""
1010

1111
import os
12+
import sys
13+
14+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
1215

1316
import boto3
1417
import pytest
@@ -200,7 +203,7 @@ def test_sesv2_wrapper_send_bulk_email_with_attachment():
200203
@pytest.mark.integ
201204
def test_sesv2_hello(capsys):
202205
"""Test the Hello SESv2 example."""
203-
from sesv2_hello import hello_sesv2
206+
from sesv2_hello import hello_sesv2 # noqa: resolved via sys.path
204207

205208
try:
206209
hello_sesv2(boto3.client("sesv2"))
File renamed without changes.

python/example_code/sesv2/newsletter_test.py renamed to python/example_code/sesv2/newsletter_scenario/test/newsletter_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import json
5+
import os
56
import sys
67
from botocore.exceptions import ClientError
78
from io import StringIO
89
import pytest
910
from unittest.mock import patch
1011

12+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
13+
1114
from newsletter import (
1215
SESv2Workflow,
1316
get_subaddress_variants,

0 commit comments

Comments
 (0)