Files
boxsim-fileformat-rev/Dockerfile
T
magdevandClaude Fable 5 4737a5bae8 Add boxsim CLI: pure Python codec, netlist extraction, KiCad project generation
Replaces the bpj2ini.py prototype with a packaged tool. The A2F codec is now
reimplemented in Python, so neither Boxsim.exe nor a CPU emulator is needed to
decode a container; the emulator survives as a development-only oracle that the
codec is differentially tested against.

Verified:
- 134 containers decode byte-identically to Boxsim's own decoder, 270 pre-2.0
  files rejected by both implementations (tools/difftest.py --self-test)
- Default.BPJ: 22 components, 14 nets, no dangling terminal
- 22 of 22 parts resolve to library symbols; one series inferred from a
  sibling, two DC resistance deviations reported
- ERC clean and the netlist KiCad extracts from the generated sheet is an
  identical partition to the one derived from the Boxsim grid
- container build byte-identical to the host build
- 32 tests passing, ruff clean

Decode time went 69 s -> 14.5 s (binding emulator hooks to trap addresses)
-> 1.6 s (pure Python).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-29 11:10:43 +02:00

42 lines
1.5 KiB
Docker

# boxsim: decode Boxsim projects and generate KiCad projects from them.
#
# The image deliberately contains no KiCad and no Boxsim.exe:
# - KiCad 10 is a hard dependency of the *verification* gate only, and stays
# on the host. decode/extract/netlist/build all work without it.
# - The A2F codec is pure Python, so Boxsim's proprietary binary is not needed.
#
# Build via tools/build-image.sh, which stages the Visaton library and the
# Boxsim parts catalogue into the build context.
FROM python:3.13-slim AS base
LABEL org.opencontainers.image.title="boxsim" \
org.opencontainers.image.description="Boxsim project decoder and KiCad project generator" \
org.opencontainers.image.source="https://src.bundespruefstelle.ch/boxdev/re-boxsim" \
org.opencontainers.image.licenses="MIT"
WORKDIR /opt/boxsim
COPY pyproject.toml README.md ./
COPY boxsim ./boxsim
# Staged by tools/build-image.sh: the upgraded Visaton symbol library and the
# Visaton parts catalogue shipped with Boxsim.
COPY stage/Visaton.kicad_sym ./boxsim/data/Visaton.kicad_sym
COPY stage/Visatonteile.txt ./boxsim/data/Visatonteile.txt
COPY stage/footprints ./boxsim/data/footprints
COPY tools/selfcheck.py ./tools/selfcheck.py
RUN pip install --no-cache-dir .
ENV BOXSIM_CATALOG=/opt/boxsim/boxsim/data/Visatonteile.txt \
BOXSIM_KICAD_LIB=/opt/boxsim/boxsim/data/Visaton.kicad_sym
# Refuse to produce an image whose bundled library does not cover the catalogue.
RUN python tools/selfcheck.py
WORKDIR /work
ENTRYPOINT ["boxsim"]
CMD ["--help"]