Skip to content
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

Handle Poetry Optional Dependency Quirks #388

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

srilman
Copy link
Contributor

@srilman srilman commented Mar 13, 2023

Fixes #385. This is a compilation of some unusual behavior I noticed when conda-lock parses some dependencies in pyproject.toml files with conflicting attributes:

  • When a dependency is an extra, but not specified as optional
  • When a dependency is an extra, but not in [tool.poetry.dependencies]
  • When a dependency is specified as optional, but not in [tool.poetry.dependencies]
  • When a dependency is specified as optional and in [tool.poetry.dependencies], but is not part of any extra

There are all things that Poetry seems to handle quietly in its own way (see the related issue). To minimize the number of parsing changes, I did not change how conda-lock treats the resulting categories of dependencies.

  • If a dependency is part of an extra, but not specified as optional or not under [tool.poetry.dependencies], conda-lock will print a warning but still treat it as part of the extra as it always has.
  • If a dependency is marked as optional or not optional but isn't associated with an extra, conda-lock will print a warning but just presume that it is optional if not in the main category, required if in main.

Essentially, this PR ensures that we maintain the invariant that an optional source dependency is a dependency not part of the main category. This is important for future PRs implementing multiple category support.

@srilman srilman requested a review from a team as a code owner March 13, 2023 00:09
@netlify
Copy link

netlify bot commented Mar 13, 2023

Deploy Preview for conda-lock ready!

Name Link
🔨 Latest commit 4840892
🔍 Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/640e6dc6c58f490008ac9237
😎 Deploy Preview https://deploy-preview-388--conda-lock.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@maresb
Copy link
Contributor

maresb commented Mar 15, 2023

I'm really looking forward to this PR series, but unfortunately I have no time this week.

@srilman
Copy link
Contributor Author

srilman commented Mar 15, 2023

No worries @maresb. Always appreciate your reviews!

@mariusvniekerk mariusvniekerk merged commit ac31f5d into conda:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional Dependencies Have Different Behavior in Conda Lock vs Poetry
3 participants