odc-cli crashes with "'staticmethod' object is not callable" on Python 3.8 and 3.9, which it claims to support
メンテナーはふだん 2 日以内に返信
関連するプルリクエストがすでにマージされています。
- #1841 @Sanilas-ai による — マージ済み
評価
調査の方向性
まず cli/odc-cli:58-68 と cli/odc-cli:300-302 周辺のハンドラーデコレーターを確認してください。cli/AGENTS.md には、サポート対象の Python バージョンとテストハーネスがないことが記載されています。コマンドクラス全体でデコレーターがどのように適用されているかを確認し、Python 3.8、3.9、および現行リリースで setup get-state、auth login、instruments list を検証してください。サポート対象のインタープリターで、これらのコマンドが報告された TypeError を発生させなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
On Python 3.8 and 3.9, odc-cli crashes with TypeError: 'staticmethod' object is not callable on every command that talks to the API. Each command handler is declared as @require_url (and often @require_token) stacked on @staticmethod. The decorators are applied in order, so require_url receives the staticmethod object itself, and its wrapper later calls fn(*args, **kwargs) on that object. A staticmethod object only became callable in Python 3.10 (bpo-43682). The script states that it targets Python 3.8: cli/AGENTS.md says so, and the file only hard-exits below 3.8. On the interpreters an administrator is most likely to have on a server or laptop, including macOS's /usr/bin/python3 (3.9.6), Debian 11 (3.9) and Ubuntu 20.04 (3.8), nothing works except config and the local auth logout and auth status. That includes auth login, setup, subjects, instrument-records and instruments.
Where
cli/odc-cli:58-68:
def require_url(fn: Callable[..., Any]) -> Callable[..., Any]:
def wrapper(*args: Any, **kwargs: Any) -> None:
# ...
fn(*args, **kwargs)
return wrapper
cli/odc-cli:300-302 (the same pattern is on every handler in AuthCommands, InstrumentRecordsCommands, SubjectCommands, InstrumentsCommands and SetupCommands):
class AuthCommands:
@require_url
@staticmethod
def login(username: str, password: str) -> None:
Reproduce
- With Python 3.9 (for example macOS
/usr/bin/python3), runpython3 cli/odc-cli config set-url http://127.0.0.1:5500. - Run
python3 cli/odc-cli setup get-state.
Actual:
File "cli/odc-cli", line 68, in wrapper
fn(*args, **kwargs)
TypeError: 'staticmethod' object is not callable
Expected: the request is sent, as it is on Python 3.10 and later, where the same command prints the setup state or a network-error JSON.
Tests
cli/ has no test harness and nothing in CI runs it (cli/AGENTS.md). Verify the fix by running setup get-state, auth login and instruments list under Python 3.8, 3.9 and the current release, for example with uv run --python 3.8 cli/odc-cli setup get-state.
Suggested fix
Put @staticmethod outermost: write @staticmethod above @require_url and @require_token, so the auth decorators wrap the plain function. Alternatively, keep the order and unwrap inside the decorators with fn = fn.__func__ if isinstance(fn, staticmethod) else fn.
- 主要言語
- TypeScript
- スター
- 119
- フォーク
- 19
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DouglasNeuroInformatics/OpenDataCapture のほかの issue
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
メンテナーはふだん 2 日以内に返信
-
Interactive With JSPsych example submits a DataCollection its own schema rejects対応中かも @Sanilas-ai が 3 日前に担当しました。 オープンArea: Playground Bug Difficulty: Low Good First Issue Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
DouglasNeuroInformatics/OpenDataCapture#1833 ·
メンテナーはふだん 2 日以内に返信
-
Area: Instruments Bug Difficulty: Low Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DouglasNeuroInformatics/OpenDataCapture#1824 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Area: Shared Bug Difficulty: Low Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DouglasNeuroInformatics/OpenDataCapture#1813 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Multiple instructions show as one comma-joined paragraph ("questions., Conditional")対応中かも @Sanilas-ai が 3 日前に担当しました。 オープンArea: Shared Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DouglasNeuroInformatics/OpenDataCapture#1812 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
DouglasNeuroInformatics/OpenDataCapture の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
pingdotgg/t3code#30228 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vfarcic/dot-agent-deck#2079 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信