myxce/src/xceadmin/pyproject.toml
Rongsong Shen 0f1df4998e
feat(deploy,xceadmin): standalone xceadmin packaging + deploy-ha usability (bug-1566)
Three related enhancements to make /xce-deploy-ha's output a
self-contained, directly-usable cluster for manual testing:

- xceadmin now builds an installable wheel (meson-build.sh) with
  correct dependencies (click/pycapnp/PyYAML/jsonschema, verified
  against actual imports -- pyproject.toml was missing several).
- deploy-ha.sh resolves the deploy environment's own bash
  ($BASH_BIN, baked into every generated script's shebang -- this
  environment's deploy-ha.sh had drifted to #!/bin/sh while still
  using bash-only syntax) and generates scripts/start-worker.sh /
  scripts/start-scheduler.sh sharing the controllers' --peers, plus
  a standalone xceadmin install (wheel extracted directly, resolved
  $PYTHONPATH baked into a wrapper script -- nix devShell packages
  are $PYTHONPATH entries, not merged into python3's own
  site-packages, so a --system-site-packages venv can't see them).
- bug-1566: xceadmin's --controller option had no relationship to a
  deployment's actual peers (hardcoded localhost:9991 default) --
  every command required an explicit --controller or silently tried
  the wrong port. Fixed via a $XCEADMIN_CONTROLLER envvar fallback
  (click precedence: explicit flag > envvar > bare default),
  exported by deploy-ha.sh's generated scripts/xceadmin wrapper.

Fixed/validated via TDD + live reproduction against a real deployed
cluster in a fully stripped environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 10:20:52 +00:00

58 lines
2.4 KiB
TOML

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "xceadmin"
version = "0.1.0"
description = "XCE cluster configuration admin CLI (config build / config push)"
requires-python = ">=3.10"
dependencies = [
"click>=8.0",
"pycapnp>=1.3",
"PyYAML>=6.0",
"jsonschema>=4.0",
]
# All four are real runtime imports (capnp/click/jsonschema/yaml — grep
# src/xceadmin src/xcecommon for `^import |^from `), not just dev/test
# tooling: an installed-but-undeclared dependency here would let `pip
# install` "succeed" while leaving the CLI broken at first real use
# (`ModuleNotFoundError` the moment `config build` touches capnp/jsonschema/
# yaml) — exactly the class of gap a wheel built for install-outside-this-
# repo needs to not have. pycapnp specifically: the nix dev shell's
# python3Packages.pycapnp (src/nixSupport/xce.nix) is preferred when
# available because it links against the same capnproto C++ runtime this
# repo's C code uses; PyPI's prebuilt pycapnp wheels are usually fine too
# for a plain `pip install` outside the nix shell, but that's a "usually,"
# not the guaranteed-consistent link this repo's own build gets.
# Wired into meson (src/xceadmin/meson.build custom_target, pulled in by
# src/meson.build's subdir('xceadmin')) so `nix build .#xcecore[_debug]`
# and `meson compile` install + test this package like every other
# component; src/tools/xce-build.sh's xceadmin case now just delegates to
# that same meson target.
[project.optional-dependencies]
test = ["pytest"]
[project.scripts]
xceadmin = "xceadmin.cli:main"
[tool.setuptools.packages.find]
where = ["src"]
include = ["xceadmin*", "xcecommon*"]
[tool.setuptools.package-dir]
"" = "src"
# Bundled copies of controller.capnp/c.capnp and the 7 JSON validation
# schemas (synced from src/schema/ and src/configs/schema/ into
# xcecommon/schema_files/ by src/xceadmin/meson-build.sh, the meson
# custom_target xce-build.sh's `xceadmin)` case now delegates to, before
# either the pinned test-install or the wheel build run against that same
# tree — see Requirement 5.5). Without this, a non-editable `pip install .`
# (or a wheel build) produces a package containing only *.py files and
# silently drops schema_files/ — an editable install would never catch this
# since it resolves straight into the checked-out source tree.
[tool.setuptools.package-data]
xcecommon = ["schema_files/*.capnp", "schema_files/json/*.schema.json"]