Skip to content

Commit 5fb7173

Browse files
authored
Merge release sinch-sdk-python v2.0.0 (#138)
1 parent 7210e4f commit 5fb7173

840 files changed

Lines changed: 31959 additions & 9810 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
wait_for_server() {
4+
local url=$1
5+
echo "Waiting for $url to be ready..."
6+
7+
MAX_RETRIES="${MAX_RETRIES:-30}"
8+
SLEEP_SECONDS="${SLEEP_SECONDS:-2}"
9+
10+
for ((i = 1; i <= MAX_RETRIES; i++)); do
11+
if curl -sSf "$url" > /dev/null; then
12+
echo "$url is ready!"
13+
return 0
14+
fi
15+
echo "Attempt $i/$MAX_RETRIES: Still waiting for $url..."
16+
sleep "$SLEEP_SECONDS"
17+
done
18+
19+
echo "Error: $url was not available after $((MAX_RETRIES * SLEEP_SECONDS)) seconds"
20+
exit 1
21+
}
22+
23+
# Wait for auth mock servers
24+
wait_for_server "http://localhost:3011/health"
25+
# Wait for numbers mock servers
26+
wait_for_server "http://localhost:3013/health"
27+
28+
echo "All mock servers are ready!"

.github/workflows/ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Test Python SDK
2+
on: [ push ]
3+
4+
env:
5+
AUTH_ORIGIN: ${{ secrets.AUTH_ORIGIN }}
6+
CONVERSATION_ORIGIN: ${{ secrets.CONVERSATION_ORIGIN }}
7+
DISABLE_SSL: ${{ secrets.DISABLE_SSL }}
8+
KEY_ID: ${{ secrets.KEY_ID }}
9+
KEY_SECRET: ${{ secrets.KEY_SECRET }}
10+
NUMBERS_ORIGIN: ${{ secrets.NUMBERS_ORIGIN }}
11+
PROJECT_ID: ${{ secrets.PROJECT_ID }}
12+
SERVICE_PLAN_ID: ${{ secrets.SERVICE_PLAN_ID }}
13+
SMS_ORIGIN: ${{ secrets.SMS_ORIGIN }}
14+
TEMPLATES_ORIGIN: ${{ secrets.TEMPLATES_ORIGIN }}
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -e .
34+
pip install -r requirements-dev.txt
35+
36+
- name: Compile all examples
37+
run: |
38+
for file in $(find examples -name "*.py"); do
39+
echo "Compiling $file..."
40+
python -m py_compile "$file" || exit 1
41+
done
42+
echo "All examples compiled successfully."
43+
44+
- name: Check snippet coverage
45+
run: |
46+
pip install python-dotenv
47+
python scripts/check_snippet_coverage.py
48+
49+
- name: Lint and format check with Ruff
50+
run: |
51+
ruff check sinch/domains/numbers --statistics
52+
ruff format sinch/domains/numbers --check --diff
53+
ruff check sinch/domains/sms --statistics
54+
ruff format sinch/domains/sms --check --diff
55+
ruff check sinch/domains/number_lookup --statistics
56+
ruff format sinch/domains/number_lookup --check --diff
57+
ruff check sinch/domains/conversation --statistics
58+
ruff format sinch/domains/conversation --check --diff
59+
60+
- name: Test with Pytest
61+
run: |
62+
coverage run --source=. -m pytest
63+
64+
- name: Coverage Test Report
65+
run: |
66+
python -m coverage report --skip-empty
67+
68+
- name: Checkout sinch-sdk-mockserver repository
69+
uses: actions/checkout@v4
70+
with:
71+
repository: sinch/sinch-sdk-mockserver
72+
token: ${{ secrets.PAT_CI }}
73+
fetch-depth: 0
74+
path: sinch-sdk-mockserver
75+
76+
- name: Start mock servers with Docker Compose
77+
run: |
78+
cd sinch-sdk-mockserver
79+
docker compose up -d
80+
81+
- name: Copy feature files
82+
run: |
83+
cp sinch-sdk-mockserver/features/numbers/available-regions.feature ./tests/e2e/numbers/features/
84+
cp sinch-sdk-mockserver/features/numbers/callback-configuration.feature ./tests/e2e/numbers/features/
85+
cp sinch-sdk-mockserver/features/numbers/numbers.feature ./tests/e2e/numbers/features/
86+
cp sinch-sdk-mockserver/features/numbers/webhooks.feature ./tests/e2e/numbers/features/
87+
cp sinch-sdk-mockserver/features/sms/delivery-reports.feature ./tests/e2e/sms/features/
88+
cp sinch-sdk-mockserver/features/sms/delivery-reports_servicePlanId.feature ./tests/e2e/sms/features/
89+
cp sinch-sdk-mockserver/features/sms/batches.feature ./tests/e2e/sms/features/
90+
cp sinch-sdk-mockserver/features/sms/batches_servicePlanId.feature ./tests/e2e/sms/features/
91+
cp sinch-sdk-mockserver/features/sms/webhooks.feature ./tests/e2e/sms/features/
92+
cp sinch-sdk-mockserver/features/number-lookup/lookups.feature ./tests/e2e/number-lookup/features/
93+
cp sinch-sdk-mockserver/features/conversation/messages.feature ./tests/e2e/conversation/features/
94+
cp sinch-sdk-mockserver/features/conversation/webhooks-events.feature ./tests/e2e/conversation/features/
95+
96+
- name: Wait for mock server
97+
run: .github/scripts/wait-for-mockserver.sh
98+
shell: bash
99+
100+
- name: Run e2e tests sync
101+
run: |
102+
python -m behave tests/e2e/numbers/features
103+
python -m behave tests/e2e/sms/features
104+
python -m behave tests/e2e/conversation/features
105+
python -m behave tests/e2e/number-lookup/features

.github/workflows/run-tests.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pip-delete-this-directory.txt
3939
# Unit test / coverage reports
4040
htmlcov/
4141
.tox/
42+
tox.ini
4243
.nox/
4344
.coverage
4445
.coverage.*
@@ -51,6 +52,9 @@ coverage.xml
5152
.pytest_cache/
5253
cover/
5354

55+
# E2E features
56+
*.feature
57+
5458
# Translations
5559
*.mo
5660
*.pot
@@ -129,4 +133,12 @@ cython_debug/
129133
.idea/
130134

131135
# Poetry
132-
poetry.lock
136+
poetry.lock
137+
138+
# .DS_Store files
139+
.DS_Store
140+
141+
qodana.yaml
142+
143+
# AI stuff
144+
.claude

CHANGELOG.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Changelog
2+
3+
All notable changes to the **Sinch Python SDK** are documented in this file.
4+
5+
> **Tag legend**
6+
> - `[feature]` — new capability
7+
> - `[fix]` — bug fix
8+
> - `[deprecation notice]` — will be removed in a future release
9+
> - `[dependency]` — third-party library update
10+
> - `[doc]` — documentation only
11+
> - `[test]` — test coverage
12+
> - `[refactor]` — internal restructuring
13+
> - `[releasing]` — release infrastructure
14+
> - `[design]` — API design change
15+
> - `[tech]` — technical improvement
16+
17+
---
18+
19+
## v2.0.0 – 2026-03-31
20+
21+
### Breaking Changes
22+
23+
- see [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md#200)
24+
25+
### SDK
26+
27+
- **[design]** Requires explicit `sms_region` and `conversation_region` on `SinchClient` before using SMS and Conversation APIs (no silent US/EU defaults); runtime failure if unset (#49, #110).
28+
- **[design]** The v1 asynchronous client and httpx-based async stack were removed; only synchronous `SinchClient` is supported (#55).
29+
- **[feature]** Automatic pagination via a shared `Paginator` pattern for paged list APIs (#46, #54).
30+
- **[doc]** README and configuration tests clarify which credentials apply to each API (#48).
31+
32+
### Conversation
33+
34+
- **[feature]** Messages API refresh: convenience send methods (`send_text_message()`, `send_card_message()`, `send_carousel_message()`, `send_choice_message()`, `send_contact_info_message()`, `send_list_message()`, `send_location_message()`, `send_media_message()`, `send_template_message()`), `list()` as a paginator, `update()`, `event_destination_target` (wires `callback_url`), and a `sinch_client.conversation.sinch_events(...)` helper for inbound event handling (#109#120).
35+
- **[feature]** Conversation Sinch Events (webhooks) support (#122, #131, #132, #133).
36+
- **[design]** Conversation webhook REST client removed; handle inbound traffic via Sinch Events (see [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md)) (#131, #132, #133).
37+
38+
### Numbers
39+
40+
- **[feature]** Flatter API (`rent`, `list`, `event_destinations`, and related entry points), `event_destination_target`, and a Numbers Sinch Events helper (#44, #53, #57, #58, #59, #62).
41+
- **[feature]** Available Regions endpoint (#56).
42+
- **[feature]** Webhook helper validates the signing secret in `validate_signature_header()` (#61).
43+
- **[tech]** Numbers Events payloads are passed through without client-side pre-processing (#63).
44+
45+
### Number Lookup
46+
47+
- **[feature]** Number Lookup v1 (lookup API, models, snippets, and E2E coverage) (#99, #101, #104).
48+
49+
### SMS
50+
51+
- **[design]** SMS client configuration and authentication paths refactored for project vs service-plan credentials, including delivery-report flows (#90).
52+
- **[feature]** SMS delivery reports models and pagination (#87). `groups` and `inbounds` are planned for a future release (see migration guide).
53+
- **[feature]** SMS Sinch Events (webhooks) support (#103).
54+
- **[doc]** SMS migration guide and Sinch events quickstart material (#107, #108).
55+
56+
### Verification
57+
58+
- **[design]** Verification V1 APIs are removed (#124). V2 Verification support is planned in a future release (see [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md)).
59+
60+
### Voice
61+
62+
- **[design]** Voice V1 APIs are removed (#124). V2 Voice support is planned in a future release (see [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md)).
63+
64+
### Others
65+
66+
- **[dependency]** Pydantic v2 (`pydantic = ">=2.0.0"`).
67+
- **[releasing]** Ruff linter adoption (#84) and CI workflow updates (#121).
68+
- **[doc]** Snippets and Getting Started live under `examples/` (#95, #98, #105, #106, #115, #118, #125, #127).
69+
- **[doc]** Docstring updates across Numbers, SMS, and Conversation (#64, #65, #67, #96, #97).
70+
- **[refactor]** Model, type, and class renames (#60, #70, #82).
71+
- **[tech]** Conversation, Numbers, and SMS models and endpoints resynchronized with OpenAPI specification (#68, #75, #123, #128, #129, #134, #135).
72+
- **[test]** E2E test infrastructure and refactoring (#45, #66, #102); SMS batches test coverage (#91, #93, #94).
73+
74+
---
75+
76+
## v1.1.4 – 2025-10-23
77+
78+
### SDK
79+
80+
- **[feature]** Python 3.13 and 3.14 support (#86, #89).
81+
- **[releasing]** CI updates (#86, #89).
82+
83+
---
84+
85+
## v1.1.3 – 2025-09-11
86+
87+
### Voice
88+
89+
- **[fix]** DTMF conference fix (#79).
90+
91+
---
92+
93+
## v1.1.2 – 2025-06-18
94+
95+
### Test
96+
97+
- **[test]** End-to-end tests disabled.
98+
- **[test]** Tests and CI improvements (#41, #42, #43, #74).
99+
100+
### SDK
101+
102+
- **[fix]** Async authentication fixes (#41, #42, #43, #74).
103+
104+
### Chore
105+
106+
- **[doc]** README link updates.
107+
- **[releasing]** CI and release-related updates.
108+
109+
---
110+
111+
## v1.1.1 – 2024-12-19
112+
113+
### SDK
114+
115+
- **[fix]** Remove aiohttp leftovers (#40).
116+
117+
---
118+
119+
## v1.1.0 – 2024-12-19
120+
121+
### Chore
122+
123+
- **[releasing]** CI strategy updates (#34, #36, #29, #17).
124+
125+
### Verification
126+
127+
- **[feature]** Backwards-compatible Verification API update.
128+
129+
### SDK
130+
131+
- **[feature]** PyPI publishing and httpx/async HTTP stack.
132+
133+
### SMS
134+
135+
- **[feature]** SMS service plan API.
136+
137+
---
138+
139+
## v1.0.0 – 2024-05-20
140+
141+
### SDK
142+
143+
- **[feature]** Verification API (#26, #27, #28).
144+
- **[feature]** Voice API (#26, #27, #28).
145+
146+
### Chore
147+
148+
- **[doc]** General availability README updates (#26, #27, #28).

0 commit comments

Comments
 (0)