Skip to content

Extract machine-I/O into a standalone, published Marlin host-protocol library #188

Closed

Description

@CameronBrooks11

Tracking/research issue. Not yet actionable — capturing decisions and considerations so we can pick this up with context. Related: epic #187 (esp. #180, #182, #184).

Goal

Extract the machine-I/O protocol (fiberpath/execution/marlin.* + the new parser/transport from Phase 3) into a standalone, Apache-2.0, PyPI-published library under the fiberpath org. FiberPath then consumes it as a dependency.

Approach (agreed)

Build in-repo, extract at the seam. Implement Phases 1–3 of #187 inside fiberpath/fiberpath, but structure the protocol code as if it were already a package: pure transport + protocol + parser, zero deps on fiberpath.config, the GUI, or the IPC layer (those stay on the consumer side). Extract to its own repo + publish at the end of Phase 3 (before #183), when the API has stabilized — a near-mechanical move because the boundary was respected from day one.

License

Apache-2.0 (permissive → maximizes community reuse; fits the org's open ethos).

⚠️ License-compat consideration: Marlin firmware is GPL-3.0, and MarlinDocumentation has its own license. Any codegen that derives data from Marlin source/docs must be checked for compatibility with shipping that derived data under Apache-2.0 (derivative-work question). Resolve before doing codegen from GPL sources — may need to generate from a permissively-licensed/neutral source, or keep generated data in a separate, appropriately-licensed data file.

Naming (neutral — not fiberpath-marlin)

PyPI availability checked: pymarlin = taken; available: marlin-host, marlink, marlinlink, marlin-serial, reprap-host, gcode-host. Leaning marlin-host / marlink. (Pick alongside scope — see below.)

Source-of-truth / codegen ideas

Other considerations to weigh

  • Host Action Commands: handle //action: messages (pause/paused/resume/cancel/prompt_*) — a proper host responds to firmware-initiated requests. (Taxonomy/feat(execution): formal Marlin response taxonomy + state-machine parser #180.)
  • Marlin version matrix / drift: tag the corpus and any generated registry by firmware version; prefer runtime detection over version assumptions; test against traces from multiple Marlin versions/configs.
  • Transport abstraction + simulator: formalize the SerialTransport Protocol (serial / RFC2217 / socket), and add a MarlinSimulator fake that behaves like Marlin (acks, busy, temps, resend) for interactive tests beyond recorded replay.
  • API shape: sync core (current) vs async (asyncio) vs both. Decide the public surface deliberately; it affects the IPC layer (refactor: unify GUI<->subprocess IPC contract (single source of truth) #184) and the console (feat(cli): human interactive machine console with serial TX/RX tracing #178).
  • Scope vs name: Marlin-only now, but keep the transport/protocol seam so a RepRapFirmware/Grbl backend could be added later. Broader scope ⇒ broader name (reprap-host/gcode-host); Marlin-only ⇒ marlin-host.
  • Packaging: py.typed (typed lib), minimal deps (pyserial; optional extras), min Python version, SBOM, PyPI trusted publishing (org flow already proven on 0.7.3/0.7.4).
  • Docs: the normative protocol doc (feat(execution): formal Marlin response taxonomy + state-machine parser #180) becomes the lib's docs, aggregated by the existing multi-repo docs hub.
  • Hardware-in-the-loop: an optional @pytest.mark.hardware suite the maintainer runs at the lab, complementing the hardware-free corpus.

Decisions to resolve when picked up

  • Final name + scope breadth (Marlin-only vs RepRap-general).
  • Codegen depth (G-code registry: yes/no) and its license path (the GPL/Apache question above).
  • Sync vs async public API.
  • Min Python version + dependency surface.

Activity

  1. added
    enhancement
    python
    roadmap
    on Jun 26, 2026
  2. CameronBrooks11 commented on Jun 26, 2026

    @CameronBrooks11
    MemberAuthor

    Plan-review verdict (2026-06-25): KEEP as a dormant gate. Build-in-repo-then-extract stands. Drop the codegen-from-Marlin-docs idea (license tarpit) until a concrete second consumer exists. Publish only when a 2nd consumer appears (the CLI console + the API job runner) rather than on a fixed date.

  3. CameronBrooks11 commented on Jun 26, 2026

    @CameronBrooks11
    MemberAuthor

    Name decided (locked): marlin-host (PyPI/repo marlin-host, import marlin_host).

    Rationale: in the 3D-printing domain, host is the established term for the PC-side software that drives the firmware (OctoPrint, Pronterface are "hosts"), so marlin-host precisely names a host-side implementation of the Marlin serial protocol — not firmware tooling. It is neutral (not fiberpath-branded), avoids the dated py prefix, and sidesteps the PyPI-collision risk of a bare marlin/pymarlin. Fallback if unavailable at publish time: marlinhost.

    Approach (per decisions doc §4–6): build-in-repo-then-extract, Apache-2.0, hardware-free now (modeled from verified Marlin docs/source, synthetic conformance corpus), validate against real hardware next week. Build order: #180 (taxonomy/parser) → #179 (replay + corpus) → #181 (reliable transfer) → #182 (lifecycle) → extract here.

  4. CameronBrooks11 commented on Jun 28, 2026

    @CameronBrooks11
    MemberAuthor

    Done. marlin-host exists and is published: marlin-host==0.1.0 on PyPI (MVP, hardware-validated on RAMPS 1.4 / Marlin bugfix-2.1.x; mock/hardware-separated test suite). The extraction goal of this issue (standalone Apache-2.0, PyPI-published Marlin host-protocol library) is achieved. The consumer-side cutover — fiberpath depending on it and retiring the in-repo machine code — is tracked in the new epic #259. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpythonroadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions