mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-23 16:36:23 +00:00
Removes Homebrew and PyPI wheel/sdist as Hermes distribution paths while
preserving the supported source, Docker, and Nix workflows.
Changes:
- Removes the Homebrew formula, PyPI publish workflow, sdist manifest
(MANIFEST.in), and wheel/sdist release-attachment logic from scripts/release.py.
- Keeps setuptools metadata and entry points required by editable installs
and Docker/Nix builds, but adds a setup.py guard that rejects wheel/sdist
builds outside a sealed Nix derivation (HERMES_NIX_BUILD=1).
- Removes pip/Homebrew install detection, PyPI update checks, the pip
self-update path, the deprecation-banner state, the postinstall subcommand,
wheel data-directory fallbacks in agent/i18n.py and hermes_constants.py,
and the ACP Registry manifest/version-lockstep release logic.
- Adds /nix/store/ path detection so `nix run` / `nix profile install`
installs (which don't set HERMES_MANAGED) are correctly identified as
"nix" rather than falling through to "git"/"unknown".
- Retired install-method values ("pip", "homebrew") in existing
.install_method stamps (both code-scoped and home-scoped) are ignored by
the allowlist reader and fall through to "unknown" instead of resurrecting
a retired enum value.
- Updates Nix packaging to ship bare runtime data (locales, optional-mcps)
through store symlinks and wrapper env vars instead of wheel data-files.
- Removes the ACP Registry manifest/icon and their version-lockstep tests.
- Deletes or rewrites packaging, pip-update, Homebrew, and ACP Registry
tests; adds parametrized coverage for the packaging build guard covering
BOTH sdist and wheel paths (the guards live in separate cmdclass entries
— a passing sdist test proves nothing about the wheel path).
- Updates installation/platform documentation and related user-facing copy.
- Adjusts the supply-chain scan so deleted install-hook files do not trigger
a finding, while additions or modifications still require the existing
ci-reviewed label gate.
Supported installation paths (unchanged):
- git installer (install.sh)
- Docker
- Nix/NixOS
- editable development installs (uv sync, uv pip install -e ., pip install -e .)
74 lines
2.9 KiB
Python
74 lines
2.9 KiB
Python
"""
|
|
setup.py — wheel/sdist build guard.
|
|
|
|
pip/PyPI and Homebrew are no longer supported distribution methods for
|
|
Hermes Agent (see website/docs/getting-started/platform-support.md). The
|
|
wheel would ship without bundled assets (locales, skills, optional-mcps,
|
|
web_dist, tui_dist, plugin manifests) since those are resolved at runtime
|
|
via env-var overrides set by the nix wrapper or the source-checkout layout.
|
|
|
|
This file overrides the ``bdist_wheel`` and ``sdist`` setuptools commands
|
|
to raise an error when run outside a Nix build. The PEP 517
|
|
``build_wheel`` / ``build_sdist`` hooks in
|
|
``setuptools.build_meta`` call these commands internally, so the guard
|
|
fires for ``uv build``, ``pip wheel``, ``python -m build``, and direct
|
|
``setup.py`` invocations alike.
|
|
|
|
The one legitimate consumer of ``build_wheel`` is uv2nix, which calls
|
|
``setuptools.build_meta.build_wheel`` (→ ``bdist_wheel``) inside a Nix
|
|
build sandbox. ``nix/python.nix`` sets ``HERMES_NIX_BUILD=1`` on the
|
|
Hermes package derivation, so only that build may create an artifact.
|
|
|
|
Editable installs (``uv sync``, ``pip install -e .``, ``nix develop``)
|
|
use ``build_editable``, which does NOT call ``bdist_wheel`` — it calls
|
|
``build_ext`` in editable mode. So the guard does not affect development.
|
|
"""
|
|
|
|
import os
|
|
|
|
from setuptools import setup
|
|
from setuptools.command.sdist import sdist
|
|
|
|
_IN_NIX_BUILD = os.environ.get("HERMES_NIX_BUILD") == "1"
|
|
|
|
_BLOCK_MESSAGE = (
|
|
"Building wheels or sdists for hermes-agent is not supported.\n"
|
|
"Hermes is distributed via the shell installer, Docker image, or Nix.\n"
|
|
"See: https://hermes-agent.nousresearch.com/docs/getting-started/installation\n"
|
|
"\n"
|
|
"If you are developing, use an editable install instead:\n"
|
|
" uv sync # or: uv pip install -e .\n"
|
|
"\n"
|
|
"If you are building with Nix (uv2nix), this error should not fire —\n"
|
|
"the Hermes Nix derivation sets HERMES_NIX_BUILD=1. If it does, file a bug."
|
|
)
|
|
|
|
|
|
class _GuardedSdist(sdist):
|
|
def run(self, *args, **kwargs):
|
|
if not _IN_NIX_BUILD:
|
|
raise RuntimeError(_BLOCK_MESSAGE)
|
|
return super().run(*args, **kwargs)
|
|
|
|
|
|
cmdclass = {"sdist": _GuardedSdist}
|
|
|
|
# bdist_wheel is only available when the `wheel` package is installed.
|
|
# setuptools.build_meta.build_wheel() calls it internally, so the guard
|
|
# fires for all PEP 517 wheel build paths. Define the subclass only when
|
|
# the import succeeds — otherwise a None base class raises TypeError at
|
|
# class-definition time, before the cmdclass guard can run.
|
|
try:
|
|
from setuptools.command.bdist_wheel import bdist_wheel
|
|
|
|
class _GuardedBdistWheel(bdist_wheel):
|
|
def run(self, *args, **kwargs):
|
|
if not _IN_NIX_BUILD:
|
|
raise RuntimeError(_BLOCK_MESSAGE)
|
|
return super().run(*args, **kwargs)
|
|
|
|
cmdclass["bdist_wheel"] = _GuardedBdistWheel
|
|
except ImportError:
|
|
pass
|
|
|
|
setup(cmdclass=cmdclass)
|