odc-cli crashes with "'staticmethod' object is not callable" on Python 3.8 and 3.9, which it claims to support
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza con cli/odc-cli:58-68 y los decoradores de los manejadores alrededor de cli/odc-cli:300-302; cli/AGENTS.md indica la versión de Python compatible y la falta de un entorno de pruebas. Comprueba cómo se aplican los decoradores en las clases de comandos y luego verifica setup get-state, auth login e instruments list con Python 3.8, 3.9 y una versión actual. La tarea estará completada cuando esos comandos ya no provoquen el TypeError indicado en los intérpretes compatibles.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 119
- Forks
- 19
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 56
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Los mantenedores suelen responder en 1 día
Todos los issues de DouglasNeuroInformatics/OpenDataCapture
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
answerLoops/answerLoops#345 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
siyuan-note/siyuan#20313 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
LanternOps/breeze#8254 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
gofish-graphics/gofish-graphics#1084 ·
Los mantenedores suelen responder en 1 día