labthings / labthings/labthings-fastapi

Code generation/client package(s)

Open
#86 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

roadmap
Dominant language
Python
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

At present, ThingClient instances are generated at runtime based on Thing Descriptions. This works, but doesn't allow type checking or autocompletion. My aspiration is to enable both of these, which probably requires code generation.

The way I see this working is that labthings_fastapi should provide code that will generate a client module based on a Thing subclass. This could be integrated into the build system of a Python package, such that the built package contains a client module - or even releases a second client package (without the hardware/server dependencies). This client module would include a ThingClient subclass with all the actions and properties of the Thing.

Dependencies of things on each other would ideally go via ThingClient objects, so the generated code should be able to be used for server-side DirectThingClients as well as HTTP based ThingClients.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing ThingClient and DirectThingClient implementations in labthings_fastapi, along with how Thing subclasses and Thing Descriptions are represented. Define the code-generation and package-integration scope before implementation. Done should provide typed, autocompleting client classes usable for both HTTP clients and server-side dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.