Incorrect types in for `Invocation.action`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 63/100
Research direction
Start with the Invocation and ActionManager implementations, especially get_invocation(), action, and action_ref(), then reproduce the issue by checking invocation.action.name with MyPy. Done means the public invocation.action.name usage passes MyPy and works at runtime without requiring the internal-looking action_ref().
Written by the indexing model from the issue text.
Description
Describe the bug
In the OpenFlexure microscope server we use the ActionManager of the server to determine the calling action for an invocation when recording log information. We get the invocation with get_invocation(). Using this Invocation object we can do invocation.action.name to get the action name. But MyPy throws and error unless you call invocation.action().name; this makes MyPy happy but throws an error at runtime. The issues seems to be because the action is a descriptor.
To get around this we directly invocation.action_ref().name which even though there is no leading underscore feels like accessing an internal.
To Reproduce
- On an
Invocationobject add the lineinvocation.action.name - Run MyPy
Expected behaviour
MyPy passes as the code is fine
Actual behaviour
MyPy throws and error unless you do invocation.action().name. This errors at runtime.
System:
- OS: Kuuntu 24.04 (verified also on docker image python:3.11)
- Python version: 3.11
- Version: 0.3.0
- Dominant language
- Python
- Stars
- 9
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from labthings/labthings-fastapi
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
labthings/labthings-fastapi#405 ·
-
drop-python-version
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
labthings/labthings-fastapi#354 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
labthings/labthings-fastapi#312 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
labthings/labthings-fastapi#404 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
labthings/labthings-fastapi#401 ·
All issues in labthings/labthings-fastapi
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Openarea: ci bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·