How automatedchemistry/flowchem works
Project Type and Purpose
• flowchem is a Python-based control application for chemistry lab instruments. It combines a command-line interface (CLI), a configuration parser, a FastAPI-powered HTTP server, device-abstraction libraries, and client libraries, exposing heterogeneous hardware under a unified REST/WebSocket API and web UI.
File Structure Analysis
• Top level:
• pyproject.toml, README, LICENSE – project metadata and docs
• src/flowchem/ – main code, subdivided into:
– __main__.py – CLI entrypoint
– client/ – Python API clients (sync+async)
– server/ – REST server, core orchestrator, configuration parser, zeroconf
– components/ – high-level “flowchem_component” abstractions (pumps, valves, sensors, analytics)
– devices/ – low-level concrete device drivers and device_finder logic
– utils/ – shared utilities (exceptions, device_finder, people)
– vendor/ – vendored code
• examples/ – usage examples orchestrating experiments via client or config
• tests/ – unit/integration tests per subsystem
• README and docs describe a three-step startup: read config → initialize/start server & devices → expose API/UI.
Essential Details to Capture
• The plugin discovery process (device_finder → known_plugins)
• The two server modes: FastAPI vs Zeroconf
• The two client interfaces: sync_client and async_client
• The fact that fast startup goes through configuration_parser → core.init → device instantiation → API ready