-
Notifications
You must be signed in to change notification settings - Fork 109
Lockcheck #816
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
base: main
Are you sure you want to change the base?
Lockcheck #816
Conversation
✅ Deploy Preview for conda-lock ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I'm seeing some surprising, but perhaps expected behavior. I run conda-lock -f pyproject.toml on this file [build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dependencies]
mailgun = { version = "*", source = "pypi" } # only depends on requests
[tool.poetry.group.dev.dependencies]
requests = "<2.32"
[tool.conda-lock]
channels = ['conda-forge']
platforms = ['linux-64']and I get a lock file like ...
- name: requests
version: 2.31.0
manager: conda
platform: linux-64
dependencies:
certifi: '>=2017.4.17'
charset-normalizer: '>=2,<4'
idna: '>=2.5,<4'
python: '>=3.7'
urllib3: '>=1.21.1,<3'
url: https://conda.anaconda.org/conda-forge/noarch/requests-2.31.0-pyhd8ed1ab_0.conda
hash:
md5: a30144e4156cdbb236f99ebb49828f8b
sha256: 9f629d6fd3c8ac5f2a198639fe7af87c4db2ac9235279164bfe0fcb49d8c4bad
category: main
optional: false
...
- name: requests
version: 2.32.4
manager: pip
platform: linux-64
dependencies:
certifi: '>=2017.4.17'
charset-normalizer: '>=2,<4'
idna: '>=2.5,<4'
urllib3: '>=1.21.1,<3'
url: https://files.pythonhosted.org/packages/7c/e4/56027c4a6b4ae70ca9de302488c5ca95ad4a39e190093d6c1a8ace08341b/requests-2.32.4-py3-none-any.whl
hash:
sha256: 27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c
category: main
optional: falseRequests is listed twice, which is expected, but I would expect the category on the conda-managed This occurs b/c the lock file / env spec are checked per group ( This could be worked around in this PR, but ideally would like some feedback by @maresb first. |
|
Thanks so much @Adam-D-Lewis for putting this together! Reviewing this will take one or many blocks of time involving several hours before I'll be able to understand the details, but I intend to make at least one iteration this week. In the meantime, I'll immediately address the unexpected result you observe. I really appreciate your analysis. What conda-lock is currently doing looks buggy to me from two levels:
It would be good to understand what's going wrong here. Shall we move this investigation also into #813? In general terms, at some point fairly soon I think it'll be necessary to fix or redo the flawed pip logic. I've made several passes at trying to understand the original intentions, adding more and more type hints along the way. This PR might be pushing the limits of what can be done prior to that. (I'll have to study it in order to evaluate this.) Also if you've incidentally managed to figure out any pieces of how the pip logic works, that would be incredibly valuable. Is this PR functioning as expected in non-pip cases? Thanks again, I really appreciate all your work! |
|
Hi @Adam-D-Lewis, I had a closer look at the code. I appreciate the tests and the clear intent, but I have some reservations about the approach. In particular, the current strategy requires the implementation of a lot of delicate helper functions that are extremely difficult to make robust and correct. I'm worried that the improvements required to make things robust would be a really huge effort. I think this feature would be more successful and maintainable if we cleverly leverage existing capabilities to, if possible, completely avoid the need to introduce fragile code. Some examples:
So before trying to implement by hand all this really subtle and fragile stuff, I'd like to check if there is any really simple way to achieve the same result. For example, if on a consistent environment I run micromamba install --dry-run --json [lockspec]then it returns almost immediately with {
"dry_run": true,
"message": "All requested packages already installed",
"prefix": "~/micromamba/envs/env-name",
"success": true
}If we could make this work, then we'd outsource all the difficult stuff to Unfortunately, unlike with Another interesting question is if extra packages should be pruned. After all, an environment with extra packages is still consistent with the lockspec(*). My initial instinct is to default to failing when extra packages are present, but include an (*) Interesting and important edge case where this is not completely true: Conda packages can have |
Description
Adds a
conda-lock checkcommand to check that a conda-lock file is compatible with the environment spec. One of the intents of this PR is that the command run fast enough to be reasonably used as a pre-commit hook.Closes #479