-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Support Poetry version syntax and optional dependencies #454
Conversation
for more information, see https://pre-commit.ci
Hi @dlqqq , thanks a lot for your contribution! I am happy that you are enjoying grayskull. I have a few suggestions that I will add later today, I am at my day job, so I don't have much time to review right now, but I will do it later. Thank you! 🚀 |
can you add |
@marcelotrevisani Done. 😎 |
I have one more suggestion; after that, it should be good to go! :) Thanks a lot for your contribution! |
@marcelotrevisani Addressed your comments. 😁 |
Thanks for your contributions! 🚀 |
@marcelotrevisani NP, thanks for reviewing. Do you think you could a 2.3.0 release soon so we can let people know that this issue is fixed on the latest version? |
sure, let me cut a new release |
@dlqqq, I really appreciate this work. The lack of |
@marcelotrevisani Thank you for all of your contributions! This is a critical project to the Conda Forge ecosystem, and I noticed that you have been maintaining this for 3+ years. I figured I should pay back your generosity with my own. I would appreciate your review on this PR. 🤗 ❤️
Description
This PR implements support for the most common Poetry projects by correctly handling Poetry version syntax and optional dependencies.
What this PR implements:
^
and~
version operatorsoptional
were being included in the Conda recipe version specifiersoptional = true
What this PR does NOT implement:
1.2.3a1
python = "..."
git
,path
,url
,source
,markers
Strategy
Version specifiers
Poetry version operators are mostly compatible with Conda recipe version operators, with the exception of
^
and~
which need to have custom encoding logic. The expected behavior is roughly:^M.m.p
⇒>=M.m.p,<(M+1).0.0
~M.m.p
⇒>=M.m.p,<M.(m+1).0
(format: Poetry version syntax ⇒ Conda recipe version syntax)
As you might expect, this logic is a bit trickier because Poetry also allows non-semver version specifiers like
~1
or^0
, and has special edge cases for major version 0. Please see the implementation inpy_toml.py
for details.Optional dependencies
Optional dependencies need to be listed under
requirements.run_constrained
in the recipe metadata.Complete example
The Poetry dependency:
Should be listed in the recipe metadata as:
We are implicitly ignoring all Poetry dependency specification fields aside from
version
andoptional
at the moment, as it’s not clear how to support them.Suggested next steps
py
preprocessing selector for python 3.10? conda-build#4032if
statements. This style of code is brittle and prone to failure.CondaMetadata
class that accepts a list of metadata sources and handles field resolution (i.e. “generate the listrequirements.run
, merging all dependencies together”) declaratively through a clean API.References
requirements.run_constrained
in recipe metadata