{"record":{"id":"5e0e52aa7a981b71","repo":"AlexsJones/llmfit","slug":"llmfit-python-platform-tag-is-not-supported-for-ed","errorCode":null,"errorMessage":"LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs. Let the build system detect the host platform instead.","messagePattern":"LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs\\. Let the build system detect the host platform instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llmfit-python/hatch_build.py","lineNumber":169,"sourceCode":"        )\n        output = result.stdout.strip()  # e.g. \"llmfit 0.9.8\"\n        match = re.match(r\"^llmfit v?(\\d+\\.\\d+\\.\\d+)$\", output)\n        if not match:\n            raise RuntimeError(f\"Unexpected output from '{bin_path} --version': {output!r}\")\n        binary_version = match.group(1)\n        if binary_version != expected_version:\n            raise RuntimeError(\n                f\"Binary version mismatch: binary at {bin_path} reports {binary_version!r} \"\n                f\"but Cargo.toml (or LLMFIT_VERSION) says {expected_version!r}. \"\n                \"Run 'make build' to recompile.\",\n            )\n        print(f\"  Binary version OK ({binary_version})\")\n\n    def initialize(self, version: str, build_data: dict) -> None:\n        \"\"\"Locate the platform binary and configure the wheel before it is built.\"\"\"\n        py_target_from_env = os.environ.get(\"LLMFIT_PYTHON_PLATFORM_TAG\")\n        if version == \"editable\" and py_target_from_env:\n            raise ValueError(\n                \"LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs. \"\n                \"Let the build system detect the host platform instead.\",\n            )\n        running_platform = self._detect_platform()\n        py_target = py_target_from_env or running_platform\n        if py_target not in TARGET_CONFIGS:\n            raise ValueError(\n                f\"Unknown LLMFIT_PYTHON_PLATFORM_TAG={py_target!r}. Must be one of: {sorted(TARGET_CONFIGS)}\",\n            )\n\n        upstream_target, binary_name = TARGET_CONFIGS[py_target]\n        pypi_version: str = self.metadata.version\n\n        print(f\"  target={upstream_target}  version={pypi_version}  wheel tag=py3-none-{py_target}\")\n\n        llmfit_root = Path(self.root).parent\n        if version == \"editable\":\n            # For editable installs, look for target/debug/llmfit or target/release/llmfit (or llmfit.exe on Windows).","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/AlexsJones/llmfit/blob/acc7e40c3a0afbd36510a92f2f8f3d5177cfc0fe/llmfit-python/hatch_build.py#L151-L187","documentation":"Raised in LlmfitBinaryBuildHook.initialize() when Hatchling requests an editable build (version == 'editable') while the LLMFIT_PYTHON_PLATFORM_TAG environment variable is set. Editable installs always use the locally compiled host binary from target/debug or target/release, so a wheel-platform override is meaningless there and is rejected with this ValueError.","triggerScenarios":"Exporting LLMFIT_PYTHON_PLATFORM_TAG for a release/cross build (e.g. in a CI matrix or shell profile) and then running `uv sync`, `uv run`, or `pip install -e llmfit-python` in the same shell without clearing the variable.","commonSituations":"A CI job template that sets the tag globally for all steps, including the editable-install smoke test; a developer's .zshrc/.bashrc exporting the variable after doing one cross build; switching between `uv build` and `uv sync` in one script.","solutions":["Unset the variable for editable work: `unset LLMFIT_PYTHON_PLATFORM_TAG && uv sync` (or `env -u LLMFIT_PYTHON_PLATFORM_TAG uv sync`)","Scope the variable to the single release command instead of the shell: `LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_aarch64 uv build`","In CI, split cross-build (standard) and dev-install (editable) steps so the variable only exists in the release step"],"exampleFix":"# before\nexport LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_aarch64\nuv sync  # ValueError: not supported for editable installs\n\n# after\nunset LLMFIT_PYTHON_PLATFORM_TAG\nuv sync","handlingStrategy":"validation","validationCode":"import os\nif os.environ.get(\"UV editable marker\", \"\"):  # placeholder\n    pass\n# practical guard before an editable install:\nif os.environ.get(\"LLMFIT_PYTHON_PLATFORM_TAG\"):\n    import subprocess, sys\n    cmd = sys.argv[1:]\n    if any(a in (\"sync\", \"run\") or \"-e\" in a for a in cmd):\n        del os.environ[\"LLMFIT_PYTHON_PLATFORM_TAG\"]","typeGuard":null,"tryCatchPattern":"try:\n    subprocess.run([\"uv\", \"sync\"], check=True)\nexcept subprocess.CalledProcessError:\n    raise SystemExit(\"editable install failed — check LLMFIT_PYTHON_PLATFORM_TAG is not set\")","preventionTips":["Set LLMFIT_PYTHON_PLATFORM_TAG per-command (VAR=... uv build), never export it globally","In CI, use step-scoped env so the editable smoke test runs with a clean environment","Add `unset LLMFIT_PYTHON_PLATFORM_TAG` to scripts that switch from release to dev flows"],"tags":["python","env-var","editable-install","packaging"],"backgroundTag":"env-var-misconfiguration","analyzedSha":"acc7e40c3a0afbd36510a92f2f8f3d5177cfc0fe","analyzedAt":"2026-08-17T10:35:29.658Z","contentChangedAt":"2026-08-17T10:35:29.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}