-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add conda mambabuild
subcommand to aid transitioning away from boa
#5351
Comments
conda-build could export a new subcommand plugin for this, setting the right context variables. I don't know if this might result into conflicts with boa's mambabuild subcommand (who wins a |
Yes, I agree that a separate package would work well. |
This would be all the Python code you need: In let's say from conda import plugins
from conda.common.io import env_var
def mambabuild(*args):
from conda_build.cli.main_build import execute
with env_var("CONDA_SOLVER", "libmamba"):
return execute(*args)
@plugins.hookimpl
def conda_subcommands():
yield plugins.CondaSubcommand(
name="mambabuild",
summary="Run conda-build with forced solver=libmamba.",
action=mambabuild,
) And then in your pyproject.toml: [project.entry-points.conda]
conda-mambabuild = "conda_mambabuild" |
That does indeed appear to work. package:
name: fakeboa
version: 0.0.1
source:
path: .
build:
noarch: python
number: 0
script: python -m pip install --no-deps --ignore-installed .
requirements:
host:
- python
- pip
run:
- python
- conda
run_constrained:
- boa > 999.999.999 [project]
name = "fakeboa"
version = "0.0.1"
[project.entry-points.conda]
conda-mambabuild = "fakeboa" |
Ah, actually, playing around with this package installed in the base envrionment alongside conda 24.1.2 and mamba 1.5.7,
so it seems as though I am missing some additional fakery. |
you wrote |
Yes, most of my company's CI scripts invoke |
I have gotten it to work, but I had to ditch conda plugins and instead create a script named
from conda.common.io import env_var
def main():
from conda_build.cli.main_build import main
with env_var("CONDA_SOLVER", "libmamba"):
main()
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "fakeboa"
version = "0.0.4"
[tool.setuptools]
packages = ["fakeboa"]
[project.scripts]
conda-mambabuild = "fakeboa:main"
package:
name: fakeboa
version: 0.0.4
source:
path: ..
build:
noarch: python
number: 0
script: python -m pip install --no-deps --ignore-installed .
requirements:
host:
- setuptools
- python
- pip
run:
- python
- conda
run_constrained:
- boa > 999.999.999
test:
import:
- fakeboa |
Ah, with Conda upgraded to 24.3.0 and mamba 1.5.8, this
Seems like I need to use different techniques to play nice with different version combinations. If I continue to explore this space, I will probably skip the conda 23.5.2 / mamba 1.4.9 compatibility, since I already have boa 0.14.0 for that, and try to get my fake boa to work for conda 24.3.0 and mamba 1.5.8. |
@wolfv can you tell me if this is crazy? Patching def do_call(args, parser):
if hasattr(args, "func"):
relative_mod, func_name = args.func.rsplit(".", 1)
# make module relative following https://github.com/conda/conda/pull/13173
if relative_mod.startswith("conda.cli."):
relative_mod = f'.{relative_mod.split(".")[-1]}'
elif hasattr(args, "_plugin_subcommand"):
action = args._plugin_subcommand.action
relative_mod = f'.{action.__module__.split(".")[-1]}'
func_name = action.__name__
else:
# NEW!!!!!!!!
if hasattr(args, "cmd"):
executable = shutil.which(f"conda-{args.cmd}")
if executable is not None:
os.execl(executable, executable, *sys.argv[2:])
# end new.
raise ValueError("Unrecognized 'args' object: %r" % args) |
Checklist
What is the idea?
Add a subcommand to
conda
calledmambabuild
which is equivalent to performingconda build --solver=libmamba
.Why is this needed?
My company wants to upgrade to the latest stable versions of
conda
andconda-build
. We also want to off-boardboa
as it appears to a concluded project (development has switched torattler-build
).However, my company has developed a large number of pipelines that invoke
mamba mambabuild
to get the build performance to an acceptable level. This was well beforeconda
itself added the--solver=libmamba
option.If we attempt to upgrade
conda
andconda-build
to the latest versions and removeboa
, then all of these pipelines will break. We lack the CI robots that made this easy to fix for conda-forge.What should happen?
Performing:
should be equivalent to performing:
for a generous transition period.
Additional Context
We discussed this in-person at the Conda open source room at PyCon 2024 with @wolfv and @beeankha and others.
The text was updated successfully, but these errors were encountered: