labthings / labthings/labthings-fastapi
An action with `NDArray` return type doesn't work over HTTP
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
An action with NDArray return type doesn't work over HTTP. It throws a the following error
pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'numpy.ndarray'>
ArrayModel can be used, but then it is typehinted incorrectly when called on the server
To Reproduce
See unit test added in #230
Expected behaviour
It serialises just as ArrayModel would.
System:
- OS: Kubuntu 24.04
- Python version. 3.11
- Version. 0.0.13
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.
Research direction
Start with the unit test added in #230 and trace the HTTP response serialization path for an action returning NDArray. The work is done when the test passes and NDArray responses serialize over HTTP in the same way as ArrayModel responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, numpy, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100