-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Add the conda package manager #296461
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 the conda package manager #296461
Changes from all commits
50b4051
9032d72
b948946
1335025
e3ab5cc
14d5b95
f4ab775
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
SomeoneSerge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||
| { | ||||||
| fetchFromGitHub, | ||||||
| lib, | ||||||
| stdenv, | ||||||
| cmake, | ||||||
| fmt, | ||||||
| spdlog, | ||||||
| tl-expected, | ||||||
| nlohmann_json, | ||||||
| yaml-cpp, | ||||||
| simdjson, | ||||||
| reproc, | ||||||
| libsolv, | ||||||
| curl, | ||||||
| libarchive, | ||||||
| zstd, | ||||||
| bzip2, | ||||||
| python3Packages, | ||||||
| }: | ||||||
| stdenv.mkDerivation rec { | ||||||
| pname = "libmamba"; | ||||||
| version = "1.5.7"; | ||||||
| src = fetchFromGitHub { | ||||||
| owner = "mamba-org"; | ||||||
| repo = "mamba"; | ||||||
| rev = "${pname}-${version}"; | ||||||
| hash = "sha256-HfmvLi9IBWlaGAn2Ej4Bnm4b3l19jEXwNl5IUkdVxi0="; | ||||||
| }; | ||||||
| nativeBuildInputs = [ | ||||||
| cmake | ||||||
| python3Packages.python | ||||||
|
||||||
| python3Packages.python | |
| python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I specifically asked the author to use python3Packages.python.
The motivation is that we'd be forced to use python3Packages instead of python3 if we later had to add some python packages as dependencies in order to keep splicing working and avoid bringing diverging versions of the interpreter into the closure. So, might as well always ask for python3Packages for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we merge this as is. If you want this changed to python3 I suggest we open a separate PR and discuss it there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we you are worried about using different python package sets, then use python3.pkgs instead of python3Packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, python3.pkgs breaks splicing. I think what we need instead is #296461 (comment)
SomeoneSerge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| pythonRelaxDepsHook, | ||
| fetchFromGitHub, | ||
| libmambapy, | ||
| hatchling, | ||
| hatch-vcs, | ||
| boltons, | ||
| }: | ||
| buildPythonPackage rec { | ||
| pname = "conda-libmamba-solver"; | ||
| version = "24.1.0"; | ||
| pyproject = true; | ||
|
|
||
| src = fetchFromGitHub { | ||
| inherit pname version; | ||
| owner = "conda"; | ||
| repo = "conda-libmamba-solver"; | ||
| rev = version; | ||
| hash = "sha256-vsUYrDVNMKHd3mlaAFYCP4uPQ9HxeKsose5O8InaMcE="; | ||
| }; | ||
|
|
||
| nativeBuildInputs = [ pythonRelaxDepsHook ]; | ||
|
|
||
| build-system = [ | ||
| hatchling | ||
SomeoneSerge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| hatch-vcs | ||
| ]; | ||
|
|
||
| dependencies = [ | ||
| boltons | ||
| libmambapy | ||
| ]; | ||
|
|
||
| # this package depends on conda for the import to run succesfully, but conda depends on this package to execute. | ||
| # pythonImportsCheck = [ "conda_libmamba_solver" ]; | ||
|
|
||
| pythonRemoveDeps = [ "conda" ]; | ||
|
|
||
| meta = { | ||
| description = "The libmamba based solver for conda."; | ||
| homepage = "https://github.com/conda/conda-libmamba-solver"; | ||
| license = lib.licenses.bsd3; | ||
| maintainers = [ lib.maintainers.ericthemagician ]; | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| fetchFromGitHub, | ||
| setuptools, | ||
| conda-package-streaming, | ||
| }: | ||
| buildPythonPackage rec { | ||
| pname = "conda-package-handling"; | ||
| version = "2.2.0"; | ||
| src = fetchFromGitHub { | ||
| owner = "conda"; | ||
| repo = "conda-package-handling"; | ||
| rev = version; | ||
| hash = "sha256-WeGfmT6lLwcwhheLBPMFcVMudY+zPsvTuXuOsiEAorQ="; | ||
| }; | ||
|
|
||
| pyproject = true; | ||
| build-system = [ setuptools ]; | ||
| dependencies = [ conda-package-streaming ]; | ||
|
|
||
| pythonImportsCheck = [ "conda_package_handling" ]; | ||
|
|
||
| meta = { | ||
| description = "Create and extract conda packages of various formats"; | ||
| homepage = "https://github.com/conda/conda-package-handling"; | ||
| license = lib.licenses.bsd3; | ||
| maintainers = [ lib.maintainers.ericthemagician ]; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| fetchFromGitHub, | ||
| flit-core, | ||
| requests, | ||
| zstandard, | ||
| }: | ||
| buildPythonPackage rec { | ||
| pname = "conda-package-streaming"; | ||
| version = "0.9.0"; | ||
| pyproject = true; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "conda"; | ||
| repo = "conda-package-streaming"; | ||
| rev = "v${version}"; | ||
| hash = "sha256-UTql2M+9eFDuHOwLYYKJ751wEcOfLJYzfU6+WF8Je2g="; | ||
| }; | ||
|
|
||
| build-system = [ flit-core ]; | ||
| dependencies = [ | ||
| requests | ||
| zstandard | ||
| ]; | ||
|
|
||
| pythonImportsCheck = [ "conda_package_streaming" ]; | ||
|
|
||
| meta = { | ||
| description = "An efficient library to read from new and old format .conda and .tar.bz2 conda packages."; | ||
| homepage = "https://github.com/conda/conda-package-streaming"; | ||
| license = lib.licenses.bsd3; | ||
| maintainers = [ lib.maintainers.ericthemagician ]; | ||
| }; | ||
| } |
SomeoneSerge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- a/conda/base/context.py | ||
| +++ b/conda/base/context.py | ||
| @@ -754,7 +754,7 @@ | ||
|
|
||
| @property | ||
| def conda_prefix(self): | ||
| - return abspath(sys.prefix) | ||
| + return expand("~/.conda") | ||
|
|
||
| @property | ||
| @deprecated( | ||
| @@ -787,28 +787,17 @@ | ||
| The vars can refer to each other if necessary since the dict is ordered. | ||
| None means unset it. | ||
| """ | ||
| - if context.dev: | ||
| - return { | ||
| - "CONDA_EXE": sys.executable, | ||
| - # do not confuse with os.path.join, we are joining paths with ; or : delimiters | ||
| - "PYTHONPATH": os.pathsep.join( | ||
| - (CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", "")) | ||
| - ), | ||
| - "_CE_M": "-m", | ||
| - "_CE_CONDA": "conda", | ||
| - "CONDA_PYTHON_EXE": sys.executable, | ||
| - } | ||
| - else: | ||
| - bin_dir = "Scripts" if on_win else "bin" | ||
| - exe = "conda.exe" if on_win else "conda" | ||
| - # I was going to use None to indicate a variable to unset, but that gets tricky with | ||
| - # error-on-undefined. | ||
| - return { | ||
| - "CONDA_EXE": os.path.join(sys.prefix, bin_dir, exe), | ||
| - "_CE_M": "", | ||
| - "_CE_CONDA": "", | ||
| - "CONDA_PYTHON_EXE": sys.executable, | ||
| - } | ||
| + import sys | ||
| + return { | ||
| + "CONDA_EXE": sys.executable, | ||
| + # do not confuse with os.path.join, we are joining paths with ; or : delimiters | ||
| + "PYTHONPATH": os.pathsep.join( | ||
| + [CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", "")] + [path for path in sys.path if "site-packages" in path] | ||
| + ), | ||
| + "_CE_M": "-m", | ||
| + "_CE_CONDA": "conda", | ||
| + "CONDA_PYTHON_EXE": sys.executable, | ||
|
Comment on lines
+16
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could you walk us through the patch? When is |
||
| + } | ||
|
|
||
| @memoizedproperty | ||
| def channel_alias(self): | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,83 @@ | ||
| { lib | ||
| , buildPythonPackage | ||
| , pythonAtLeast | ||
| , fetchPypi | ||
| , pycosat | ||
| , requests | ||
| , ruamel-yaml | ||
| , isPy3k | ||
| , enum34 | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| pythonRelaxDepsHook, | ||
| hostPlatform, | ||
| fetchFromGitHub, | ||
| # build dependencies | ||
| hatchling, | ||
| hatch-vcs, | ||
| # runtime dependencies | ||
| archspec, | ||
| conda-libmamba-solver, | ||
| conda-package-handling, | ||
| distro, | ||
| jsonpatch, | ||
| packaging, | ||
| platformdirs, | ||
| pluggy, | ||
| pycosat, | ||
| requests, | ||
| ruamel-yaml, | ||
| tqdm, | ||
| truststore, | ||
| # runtime options | ||
| defaultEnvPath ? "~/.conda/envs", # default path to store conda environments | ||
| defaultPkgPath ? "~/.conda/pkgs", # default path to store download conda packages | ||
| }: | ||
|
|
||
| # Note: this installs conda as a library. The application cannot be used. | ||
| # This is likely therefore NOT what you're looking for. | ||
|
|
||
| buildPythonPackage rec { | ||
| pname = "conda"; | ||
| version = "4.3.16"; | ||
| format = "setuptools"; | ||
| version = "24.1.2"; | ||
| pyproject = true; | ||
|
|
||
| # this is a very outdated version of conda that isn't compatible with python 3.10+ | ||
| disabled = pythonAtLeast "3.10"; | ||
|
|
||
| src = fetchPypi { | ||
| src = fetchFromGitHub { | ||
| inherit pname version; | ||
| sha256 = "a91ef821343dea3ba9670f3d10b36c1ace4f4c36d70c175d8fc8886e94285953"; | ||
| owner = "conda"; | ||
| repo = "conda"; | ||
| rev = version; | ||
| hash = "sha256-L/Y7Bb3R5YqXbjTN4CRPFnkgymVLrxuFmjVzpvt28dE="; | ||
| }; | ||
|
|
||
| propagatedBuildInputs = [ pycosat requests ruamel-yaml ] ++ lib.optional (!isPy3k) enum34; | ||
| nativeBuildInputs = [ pythonRelaxDepsHook ]; | ||
|
|
||
| build-system = [ | ||
| hatchling | ||
| hatch-vcs | ||
| ]; | ||
|
|
||
| dependencies = [ | ||
| archspec | ||
| conda-libmamba-solver | ||
| conda-package-handling | ||
| distro | ||
| jsonpatch | ||
| packaging | ||
| platformdirs | ||
| pluggy | ||
| pycosat | ||
| requests | ||
| ruamel-yaml | ||
| tqdm | ||
| truststore | ||
| ]; | ||
|
|
||
| patches = [ ./0001-conda_exe.patch ]; | ||
|
|
||
| makeWrapperArgs = [ | ||
| "--set CONDA_EXE ${placeholder "out"}/bin/conda" | ||
| ''--set-default CONDA_ENVS_PATH "${defaultEnvPath}"'' | ||
| ''--set-default CONDA_PKGS_DIRS "${defaultPkgPath}"'' | ||
| ]; | ||
|
|
||
| pythonImportsCheck = [ "conda" ]; | ||
|
|
||
| # No tests | ||
| doCheck = false; | ||
| # menuinst is currently not packaged | ||
| pythonRemoveDeps = lib.optionals (!hostPlatform.isWindows) [ "menuinst" ]; | ||
|
|
||
| meta = { | ||
| description = "OS-agnostic, system-level binary package manager"; | ||
| homepage = "https://github.com/conda/conda"; | ||
| license = lib.licenses.bsd3; | ||
| maintainers = [ lib.maintainers.ericthemagician ]; | ||
| }; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.