Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Feature]: Thread-safe Multi-Instance API Client with Configuration Isolation

オープン
#388 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
api, payments

調査の方向性

まず、トップレベルでエクスポートされているオブジェクト、個々の API ハンドラーサブモジュール、HTTP クライアントのエントリーポイントをマッピングし、singleton の状態と設定がどこに保持されているかを把握します。ListTerminalsProtocol の workaround と既存のアノテーションを確認します。独立した設定が同時に機能し、静的解析ツールがクライアント API を理解できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Feature needs response
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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Adyen/adyen-python-api-library のほかの issue

Adyen/adyen-python-api-library の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。