[Feature]: Thread-safe Multi-Instance API Client with Configuration Isolation
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
まず、トップレベルでエクスポートされているオブジェクト、個々の API ハンドラーサブモジュール、HTTP クライアントのエントリーポイントをマッピングし、singleton の状態と設定がどこに保持されているかを把握します。ListTerminalsProtocol の workaround と既存のアノテーションを確認します。独立した設定が同時に機能し、静的解析ツールがクライアント API を理解できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Feature summary
Multi‑instance, thread‑safe API client with better typing
Problem statement
Background
The current Python client uses a singleton pattern for each API handler and the HTTP client. In multithreaded environments (e.g., UWSGI) this leads to thread‑safety issues and makes it impossible to use different credentials/settings for separate services (e.g., ECOM vs. POS).
A workaround is already in place: importing individual API parts from submodules and instantiating a separate HTTP client for each use‑case. However, the library’s interface still encourages the global singleton, which is not safe.
Proposed improvements
| Area | Desired change |
|---|---|
| Instance isolation | Remove the singleton pattern and allow callers to create multiple independent client instances. Each instance should accept its own configuration (API endpoint, authentication keys, HTTP client, etc.). |
| Documentation | Clearly document that the top‑level exported objects are global singletons and discourage their use in multi‑tenant or concurrent workflows. Provide examples of per‑instance creation. |
| Thread safety | Ensure no shared mutable state lives inside the client or its handler objects, so concurrent requests with different configs are safe. |
| Type hints | Improve static typing: • Functions that currently return AdyenResult | None | Unknown actually raise inside helper functions. Either raise the exception directly or return a clear Union with explicit error types. • Provide type stubs / .pyi files or refined type annotations so tools like basedpyright and mypy can understand the API signatures. • Example: Replace the ad‑hoc ListTerminalsProtocol workaround with a real protocol exposed in the library. |
My comments (for reference)
- The library is generated via an API generator, so a complete rewrite is not realistic.
- Instantiating small objects in Python has negligible memory overhead—no performance penalty.
- I am available for hire, on a consulting basis.
Proposed solution
Goal: Get a library that supports multiple concurrent clients with distinct configurations while providing robust typing for static analysis tools. This solves the thread‑safety problem and makes the ECOM/POS multi‑tenant use‑case straightforward.
Alternatives considered
No response
Additional context
No response
- 主要言語
- Python
- スター
- 68
- フォーク
- 51
- 平均マージ
- 2時間 3分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Adyen/adyen-python-api-library のほかの issue
-
[Bug] api_*_version override has no effect on PAL-based service URLs対応中かも @cobanfurkanx が 10 日前に担当しました。 オープンBug do not stale
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Feature
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Adyen/adyen-python-api-library#487 · コメント 1 件 · リアクション 1 件 ·
-
[Test] Add baseUrl environment tests to all service test files対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdo not stale Test
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
chore: consolidate package metadata into pyproject.toml (PEP 621)対応中かも @erdemtuna が 192 日前に担当しました。 オープンdo not stale
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
[Bug]: Unknown properties return None対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdo not stale
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
Adyen/adyen-python-api-library#397 · コメント 2 件 ·
Adyen/adyen-python-api-library の issue をすべて見る
似ている issue
-
bot-triaged module: LrScheduler module: optimizer triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
documentation glm5 llm-model
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vllm-project/vllm-ascend#19062 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
acl-org/acl-anthology#10496 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Issue Type: Bug Report
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
celery/celery#10875 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SasanLabs/VulnerableApp#836 ·
メンテナーはふだん 1 日以内に返信