Skip to content

Commit d4414af

Browse files
authored
Merge pull request #125 from clerk/speakeasy-sdk-regen-1747144886
chore: 🐝 Update SDK - Generate 2.2.0
2 parents 2261833 + 02ed227 commit d4414af

File tree

9 files changed

+122
-81
lines changed

9 files changed

+122
-81
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**/__pycache__/
12
**/.speakeasy/temp/
23
**/.speakeasy/logs/
34
.speakeasy/reports

.speakeasy/gen.lock

Lines changed: 15 additions & 15 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ generation:
1616
oAuth2ClientCredentialsEnabled: true
1717
oAuth2PasswordEnabled: false
1818
python:
19-
version: 2.1.0
19+
version: 2.2.0
2020
additionalDependencies:
2121
dev:
2222
pytest: ^8.3.3

.speakeasy/workflow.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.542.3
1+
speakeasyVersion: 1.544.0
22
sources:
33
clerk-openapi:
44
sourceNamespace: clerk-openapi
5-
sourceRevisionDigest: sha256:b04b66d6cf242e4b34536e792b8cf9fe2241bf8c772d48a5c332cfbd2450cf30
5+
sourceRevisionDigest: sha256:de9c2e88aec282e2babce91d125306ce397fd12d4cb85f9d12f9cd7cdba60f69
66
sourceBlobDigest: sha256:d64d439a324819076eb2941bddebe10c544f5d276cd95788970d49c8f643bcf1
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1744935656
9+
- speakeasy-sdk-regen-1747144886
1010
- "2024-10-01"
1111
targets:
1212
clerk-sdk-python:
1313
source: clerk-openapi
1414
sourceNamespace: clerk-openapi
15-
sourceRevisionDigest: sha256:b04b66d6cf242e4b34536e792b8cf9fe2241bf8c772d48a5c332cfbd2450cf30
15+
sourceRevisionDigest: sha256:de9c2e88aec282e2babce91d125306ce397fd12d4cb85f9d12f9cd7cdba60f69
1616
sourceBlobDigest: sha256:d64d439a324819076eb2941bddebe10c544f5d276cd95788970d49c8f643bcf1
1717
codeSamplesNamespace: clerk-openapi-python-code-samples
18-
codeSamplesRevisionDigest: sha256:b0fbbc5d5ff733c77b578b8859510557fdb669a43976e256d33bd32732cf1e15
18+
codeSamplesRevisionDigest: sha256:ea80d8442e2d861fe6e5910b6a862b325e94fc1058dd73aee41eb2007a1a525f
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,14 @@ Based on:
298298
### Generated
299299
- [python v2.1.0] .
300300
### Releases
301-
- [PyPI v2.1.0] https://pypi.org/project/clerk-backend-api/2.1.0 - .
301+
- [PyPI v2.1.0] https://pypi.org/project/clerk-backend-api/2.1.0 - .
302+
303+
## 2025-05-13 14:01:09
304+
### Changes
305+
Based on:
306+
- OpenAPI Doc
307+
- Speakeasy CLI 1.544.0 (2.599.0) https://github.com/speakeasy-api/speakeasy
308+
### Generated
309+
- [python v2.2.0] .
310+
### Releases
311+
- [PyPI v2.2.0] https://pypi.org/project/clerk-backend-api/2.2.0 - .

poetry.lock

Lines changed: 47 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[project]
22
name = "clerk-backend-api"
3-
version = "2.1.0"
3+
version = "2.2.0"
44
description = "Python Client SDK for clerk.dev"
55
authors = [{ name = "Clerk" },]
6-
readme = "README.md"
7-
requires-python = ">=3.9"
6+
readme = "README-PYPI.md"
7+
requires-python = ">=3.9.2"
88
dependencies = [
9-
"cryptography (>=43.0.1,<44.0.0)",
9+
"cryptography (>=44.0.1,<45.0.0)",
1010
"httpx >=0.28.1",
1111
"pydantic >=2.11.2",
1212
"pyjwt (>=2.9.0,<3.0.0)",

src/clerk_backend_api/_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import importlib.metadata
44

55
__title__: str = "clerk-backend-api"
6-
__version__: str = "2.1.0"
6+
__version__: str = "2.2.0"
77
__openapi_doc_version__: str = "2024-10-01"
8-
__gen_version__: str = "2.597.9"
9-
__user_agent__: str = "speakeasy-sdk/python 2.1.0 2.597.9 2024-10-01 clerk-backend-api"
8+
__gen_version__: str = "2.599.0"
9+
__user_agent__: str = "speakeasy-sdk/python 2.2.0 2.599.0 2024-10-01 clerk-backend-api"
1010

1111
try:
1212
if __package__ is not None:

src/clerk_backend_api/httpclient.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# pyright: reportReturnType = false
44
import asyncio
5-
from concurrent.futures import ThreadPoolExecutor
65
from typing_extensions import Protocol, runtime_checkable
76
import httpx
87
from typing import Any, Optional, Union
@@ -116,21 +115,42 @@ def close_clients(
116115
pass
117116

118117
if async_client is not None and not async_client_supplied:
119-
is_async = False
118+
# First, try the simplest approach - use asyncio.run()
119+
# This works when we're not in an async context
120120
try:
121-
asyncio.get_running_loop()
122-
is_async = True
123-
except RuntimeError:
124-
pass
125-
126-
try:
127-
# If this function is called in an async loop then start another
128-
# loop in a separate thread to close the async http client.
129-
if is_async:
130-
with ThreadPoolExecutor(max_workers=1) as executor:
131-
future = executor.submit(asyncio.run, async_client.aclose())
132-
future.result()
121+
asyncio.run(async_client.aclose())
122+
except RuntimeError as e:
123+
# If we get "RuntimeError: This event loop is already running",
124+
# it means we're in an async context
125+
if "already running" in str(e):
126+
try:
127+
# We're in an async context, so get the running loop
128+
loop = asyncio.get_running_loop()
129+
# Create a task but don't wait for it
130+
loop.create_task(async_client.aclose())
131+
except Exception:
132+
# If we can't get the loop or create a task, just ignore
133+
# The GC will eventually clean up the resources
134+
pass
135+
# If we get "RuntimeError: There is no current event loop in thread",
136+
# we're not in an async context, but asyncio.run() failed for some reason
137+
# In this case, we can try to create a new event loop explicitly
138+
elif "no current event loop" in str(e):
139+
try:
140+
# Create a new event loop and run the coroutine
141+
loop = asyncio.new_event_loop()
142+
asyncio.set_event_loop(loop)
143+
try:
144+
loop.run_until_complete(async_client.aclose())
145+
finally:
146+
loop.close()
147+
asyncio.set_event_loop(None)
148+
except Exception:
149+
# If this also fails, just ignore
150+
pass
151+
# For any other RuntimeError, just ignore
133152
else:
134-
asyncio.run(async_client.aclose())
153+
pass
135154
except Exception:
155+
# For any other exception, just ignore
136156
pass

0 commit comments

Comments
 (0)