Skip to content

DESIGN: virtualenv-only core + out-of-tree env backends - #1599

Draft
HaoZeke wants to merge 18 commits into
airspeed-velocity:mainfrom
HaoZeke:design/env-backend-extract
Draft

DESIGN: virtualenv-only core + out-of-tree env backends#1599
HaoZeke wants to merge 18 commits into
airspeed-velocity:mainfrom
HaoZeke:design/env-backend-extract

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

Draft — not for merge until reviewed.

Core ASV keeps only virtualenv and existing. Optional environment backends are out-of-tree packages discovered via a single host API:

  • asv.envmgmt.discover.ensure_environment_backend / get_environment_class_by_name
  • Entry point group asv.environment_backends (EP name = tool_name)
  • Empty environment_typevirtualenv
  • Multi-provider EPs for one type → fail closed
  • Missing type → generic install/EP hint (no personal GitHub org URLs in core)
  • Legacy asv_env_<type> module import only if ASV_ENV_LEGACY_MODULE_FALLBACK is set

There is no in-tree asv.plugins.{conda,rattler,uv}.

Companion packages (providers)

Package environment_type Mechanism
asv_env_conda conda conda CLI
asv_env_rattler rattler py-rattler APIs
asv_env_uv uv uv.find_uv_bin + uv venv / uv pip
asv_env_mamba mamba libmambapy and/or micromamba CLI
asv_env_pixi pixi pixi CLI workspace (pixi.toml + install)
pip install -e .   # this branch
pip install "git+https://github.com/HaoZeke/asv_env_uv.git"
{ "environment_type": "uv" }

Test plan

  • Core has no asv.plugins.conda|rattler|uv modules
  • Optional types resolve from installed packages (asv_env_*), not asv.plugins.*
  • virtualenv/existing still built-in
  • Discovery unit tests + external plugin tests
  • Full CI after review

Refs #1542, #1436, #1543

HaoZeke added 5 commits June 27, 2026 06:55
Add asv.envmgmt (protocol, pure matrix helpers, identity fingerprints,
facade, virtualenv adapter preview) and a development design note for
separating matrix iteration from tool backends. Conf schema unchanged;
production Environment path untouched. Focused tests only (no full env
matrix suite). Draft-PR material for review—not for merge yet.
Assert plugin-free imports via AST rather than raw source substring so
docstrings may mention legacy wiring without failing the suite.
Use Path.read_text so pytest 9 on Python 3.14 does not treat an unclosed
open() as a failure via PytestUnraisableExceptionWarning.
Remove docs/source/development/environment_backend_extract.md from the
spike branch; design lives in internal notes only. Code preview
(asv.envmgmt + focused tests) remains for the draft PR.
@HaoZeke HaoZeke changed the title DESIGN: Environment backend extraction spike (matrix vs tool backends) DESIGN: virtualenv-only core + env backend extraction spike Jun 27, 2026
HaoZeke added 10 commits June 27, 2026 09:59
Move former in-tree conda/rattler/uv backends into installable plugin
packages under plugin_packages/. Teach PluginManager.import_plugin to
import absolute module names so conf "plugins": ["asv_conda"] works.
Add asv_mamba wrapper (prefers mamba CLI). Integration tests load all
plugins alongside core virtualenv.
Singleton load_plugins was dropped during the virtualenv-only rewrite and
broke conf plugins. Conftest conda lock monkeypatch targets asv_conda when
installed. Failed plugin imports now raise instead of failing silently.
Document that conda remains the primary CLI/shell backend while
libmamba/rattler/pixi (and future uv APIs) should be library-oriented.
Add a non-functional asv_pixi package skeleton for environment_type pixi.
- asv_mamba: libmambapy only (no conda CLI fallback)
- asv_rattler: py-rattler solve/install (unchanged API path)
- asv_pixi: environment_type pixi on top of asv_rattler APIs (not pixi CLI)
- asv_uv: stdlib venv + python -m pip (no uv CLI); CLI is not a stable API
- asv_conda: remains the shell/CLI backend

Registration tests updated for all plugin packages.
Remove plugin_packages/ from the ASV tree. Optional backends live in
separate repositories (asv_env_conda, asv_env_mamba, asv_env_rattler,
asv_env_uv, asv_env_pixi). Load entry points group asv.plugins when
present; conf plugins still list module names like asv_env_conda.
Conf plugins and entry points use the shared asv_env_* package names
from HaoZeke repos, not vendored asv_conda modules.
Resolve backends via ensure_environment_backend / ensure_conf_backends:
conf plugins, asv.plugins entry points by type name, then conventional
asv_env_<type> modules. Fail closed when a packaged backend is present
but broken or does not register the expected tool_name. Command and
library callers share the same path; no import-time swallowed EPs.
Rework the design branch toward the target architecture: resolve
environment_type via asv.environment_backends entry points with
fail-closed multi-provider errors, generic install hints (no personal
org URLs), empty type defaulting to virtualenv, and legacy asv_env_*
module import only when ASV_ENV_LEGACY_MODULE_FALLBACK is set.

Restore optional in-tree conda/rattler/uv bootstrap (additive Stage 1)
while keeping third-party packages discoverable through the same path.
@HaoZeke HaoZeke changed the title DESIGN: virtualenv-only core + env backend extraction spike DESIGN: Stage 1 env backend discovery (additive) Jul 6, 2026
Core keeps only virtualenv (and existing). Optional environment backends
resolve solely through asv.environment_backends entry points (asv_env_*
and third parties). Remove asv.plugins.{conda,rattler,uv} and re-point
tests/conftest accordingly.
@HaoZeke HaoZeke changed the title DESIGN: Stage 1 env backend discovery (additive) DESIGN: virtualenv-only core + out-of-tree env backends Jul 7, 2026
HaoZeke added 2 commits July 8, 2026 05:05
Wire asv[conda|mamba|rattler|uv|pixi] to out-of-tree providers, document
drop-in install, and add matrix_layers capability model for airspeed-velocity#1542/airspeed-velocity#1543/airspeed-velocity#1436.
Document pixi pip+ handling in env_backends docs with the extras bump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant