Description
conda-recipe-manager has an undeclared, unbounded dependency on conda for its MatchSpec implementation, and the conda code organization makes it difficult to patch around heavy binary dependencies.
This makes it hard to bootstrap crm in lightweight/automation environments that don't fully support the conda ecosystem (or vice-versa conda-forge/conda-forge.github.io#2244).
At present, there is at least one alternate MatchSpec implementation from the conda top-level org, namely py-rattler.
Additional context
Discussed on:
Design Ideas
- A relatively simple approach with import checks:
Details
- Move all imports of MatchSpec to an import of a local new
matchspec.py or conda_compat.py
- either with
ImportError (or slightly more efficient find_spec) checks, determine if conda is available
- if not available, try finding alternate implementations
- if any are found, provide that implementation
- A more scalable approach with entry points:
Details
- in
pyproject.toml, declare a new entry_point, e.g. conda-recipe-manager.v0.matchspec with an initial implementation (similar to the above)
- declare an interface contract (potentially with
abc, maybe just type hints) which includes an is_available check
- probably again in something like
conda_compat.py, wrap the conda implementation in something that conforms and advertise this in pyproject.toml
[project.entry_points."conda-recipe-manager.v0.matchspec"]
conda = "conda_recipe_manager.conda_compat.matchspec:CondaMatchSpec"
- use
entry_points(group="conda-recipe-manager.v0.matchspec") to find an available one when requested
- define
[optional-dependencies] for different providers
- if only for reference purposes, having the lower bound of
conda would probably be good
This would allow third-party packages to add new implementations, either directly, or via some plugin package, e.g. crm-py-rattler, e.g.
[project.entry_points."conda-recipe-manager.v0.matchspec"]
py-rattler = "crm_py_rattler.matchspec:PyRattlerMatchSpec"
In either event:
- add an environment variable, CLI flag, or other means to force a specific implementation
- if no implementation is found, add a helpful message and raise a dedicated exception type
- in the CLI, probably don't show a full traceback
Description
conda-recipe-managerhas an undeclared, unbounded dependency oncondafor itsMatchSpecimplementation, and thecondacode organization makes it difficult to patch around heavy binary dependencies.This makes it hard to bootstrap
crmin lightweight/automation environments that don't fully support thecondaecosystem (or vice-versa conda-forge/conda-forge.github.io#2244).At present, there is at least one alternate MatchSpec implementation from the
condatop-level org, namely py-rattler.Additional context
Discussed on:
graphvizandmatplotlibhave been removedcondais not distributed on PyPI, which generally makes it harder for Python-based downstreams such asgrayskullto confidently depend onconda-recipe-managerDesign Ideas
Details
matchspec.pyorconda_compat.pyImportError(or slightly more efficientfind_spec) checks, determine ifcondais availableDetails
pyproject.toml, declare a new entry_point, e.g.conda-recipe-manager.v0.matchspecwith an initial implementation (similar to the above)abc, maybe just type hints) which includes anis_availablecheckconda_compat.py, wrap thecondaimplementation in something that conforms and advertise this inpyproject.tomlentry_points(group="conda-recipe-manager.v0.matchspec")to find an available one when requested[optional-dependencies]for different providerscondawould probably be goodThis would allow third-party packages to add new implementations, either directly, or via some plugin package, e.g.
crm-py-rattler, e.g.In either event: