-
Notifications
You must be signed in to change notification settings - Fork 104
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
Default PyPI dependencies for pyproject.toml #334 #362
Conversation
✅ Deploy Preview for conda-lock ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Thanks @pep-sanwer, this looks good. Could you please remove the references to Poetry? Simply because specifying dependencies in Unfortunately my alternative suggestions for wording and variable names at the moment are a bit awkward... I'd say that dependencies specified in Finally, I think we may be limiting ourselves by having the setting be a boolean. Namely, we may want to specify a channel, or a list of channels. How about something like:
@croth1, could you please have a look at this? (He has been thinking about channels lately.) |
With limited knowledge of the whole system here are my two cents: I like the idea of ultimately having something like: (side note: I find it extremely attractive to explore whether instead of solving with poetry ontop of conda, and then trying to mingle everything together, we could make a fake-repo just like for the virtual packages and solve everything together with the conda solver. While this seems technically much harder, I have a strong suspicion that this will be conceptually much easier and a lot of headaches we have right now might just magically disappear) Back to the topic 😬 - as I see it the changes in this PR are completely poetry-toml specific and I feel it's worth offering this, without having it to fit into a grand vision. For now, I would suggest keeping the changes as they are and configure in a poetry specific namespace: [tool.conda-lock.poetry_toml]
default-dependencies-to-conda = false Should be easy to deprecate and pull these configurations into the main |
Thanks a lot @croth1 for the feedback! I agree that the "right" way to do things would be with a unified solver. I'm very interested in looking into what this would involve, and I suspect we could use something like libsolv. It might be interesting to read up on the details and ping wolfv for advice. But unless some expert like wolfv steps in, I don't see this happening anytime soon. As for a short/medium-term solution, based on @croth1's advice, I think it makes sense that we specify which package manager (pip vs conda) to prefer by default. As for terminology, we already have this in the new-style unified lockfile. There we use a categorical value [tool.conda-lock]
default-project-dependency-manager = "pip" Now that we have identified "dependency managers" rather than "channels" as the appropriate level of abstraction, I wonder again if it might make sense to use a list here, so something like dependency-manager-priority = ["conda", "pip"] # the current default
dependency-manager-priority = ["pip"] # pip-only
dependency-manager-priority = ["pip", "conda"] # pip with conda as fallback
dependency-manager-priority = ["conda"] # strict conda mode Do you think this would be useful? Or more importantly doable? Terminology rant...In short, in order to avoid perpetuation of confusion, I simply want to use the proper terminology. Specifically, "dependencies specified in I've seen widespread confusion (and been confused myself) about the Python packaging ecosystem, and a big part of this appears to be generization which falsely conflates various tools and standards. (For example, I used to conflate pip with setuptools.) I get concerned when I see "poetry-toml", because this serves to perpetuate confusion that For a concrete example, conda-lock doesn't use Poetry, and conda-lock can generate lockfiles for itself (up to a few remaining general issues). |
What's the expected behavior for non-Poetry (e.g. conda-lock) |
@croth1, @maresb thank you both for the wonderful feedback and comments. Re: Terminology & Poetry-namings & Abstracting away from specific tools I especially like @croth1's short-term resolution suggestion of
Re: expected behavior for non-Poetry pyproject.toml files, i.e. when dependencies are defined in |
Implements default source to pypi switch in [tool.conda-lock] for all supported pyproject.toml flavors (poetry, pep621(flit, pdm))
The latest changes on the PR implement the discussed behavior across all currently supported Naming / config path has changed to reflect - setting: [tool.conda-lock]
default-non-conda-source = "pip" will treat all non-conda dependencies -- all dependencies defined outside of
Appreciate all your feedback! |
This looks great!!! Thanks so much for the update. I won't be able to look at it this week unfortunately, due to time constraints. |
Understood. Appreciate the heads-up! |
@maresb, please let me know if I can help ease this merge in anyway Appreciative of your time! |
Thanks so much for your perseverance @pep-sanwer! Let's do one more rebase. I'll squeeze this in before the Poetry revendor. |
The branch is out-of-date again, but don't bother rebasing this time, as it should be totally independent. Now we just have to deal with this recent flakiness with the failing tests... 😞 |
Got it - and yes most recent commits look completely independent. I'll the PR as is then! |
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.
Thanks so much @pep-sanwer for the extra effort here to make this work for all dependency managers! Excellent work!
@maresb, Thank you for merging this! Unfortunately, and my apologies for headache, my work was a bit sloppy.
breaks I haven't delved too deeply into the cause - but due to how the
A fix on my local (only for
|
Hey, thanks a lot for the report @pep-sanwer! No worries, this stuff happens. It looks like we just missed a test case. On the bright side, this is a new feature, so people aren't relying on it yet. One quirk of Poetry is that it doesn't define the Python dependency in But with a brief glance through the code, I don't see anywhere that we're parsing Would you like to open a PR with your fix for Poetry plus updated tests? |
@maresb - You are right, from what I can tell, python version is not ingested across the board for |
Thanks a lot @pep-sanwer for looking into this! A comprehensive solution would be excellent, but in case it helps to make incremental progress, I think we could break this one up into the Poetry and non-Poetry parts as separate pieces. (I conceptualize this as two separate bugs.) |
Quick draft implementation of changes discussed in #334:
Implements a
default-poetry-source-pypi
flag in[tool.conda-lock]
to default tosource = "pypi"
for all dependencies in[tool.poetry.dependencies]
, i.e.:[tool.poetry.dependencies]
[tool.conda-lock.dependencies]
by explicitly providing
default-poetry-source-pypi = true
in[tool.conda-lock]
section, e.g.:Updated Readme and tests to reflect changes. Please let me know any thoughts or comments!