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

Add/improve support for Path dependencies and GIT dependencies #712

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

romain-intel
Copy link
Contributor

Specifically:

  • adds subdirectory for GIT dependencies
  • adds the ability to pass "path" dependencies to Poetry

Description

This simply extends support of the arguments that conda-lock can parse in a pyproject.toml and passes them down to Poetry. Specifically it adds support for local directories and wheels as well as support for #subdirectory in GIT packages.

@romain-intel romain-intel requested a review from a team as a code owner September 27, 2024 05:49
Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for conda-lock ready!

Name Link
🔨 Latest commit c65d095
🔍 Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/66fee7a2aeb8260008d3b0d2
😎 Deploy Preview https://deploy-preview-712--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 configuration.

@romain-intel
Copy link
Contributor Author

Need to add a test for subdirectory.

@romain-intel
Copy link
Contributor Author

I suspect the micromamba test failures may be due to the release of micromamba 2.0

@maresb
Copy link
Contributor

maresb commented Sep 28, 2024

I suspect the micromamba test failures may be due to the release of micromamba 2.0

Noooooo! 😱 I wanted to release! Ok, I guess we have more work.

Regarding this PR, it looks mostly great. One of my big concerns is favoring Poetry-style pyproject.toml over standards-based pyproject.toml. I think/hope that this would be a really simple tweak to achieve this. I think you basically just need to support

parse_python_requirement("/path/to/some-package", manager="pip", mapping_url=DEFAULT_MAPPING_URL)

Looking forward to the additional test for subdir. Thanks again @romain-intel!!!

@maresb
Copy link
Contributor

maresb commented Sep 28, 2024

Ok, micromamba v2 was not so bad. I believe I took care of it in #713. Feel free to rebase on main, and I hope that will fix things.

@romain-intel
Copy link
Contributor Author

Hopefully that works -- the PEP for local requirements seems to be mypkg @ /path/to/mypkg so that is what I am testing here. Let me know if you need anything else.

@maresb
Copy link
Contributor

maresb commented Oct 2, 2024

On first glance this looks great, thanks so much @romain-intel!!!

Note one hiccup in the doctest with a missing subdir=None.

@romain-intel
Copy link
Contributor Author

whoops. Sorry about that. Hopefully that will do it.

Unrelated: I see a flurry of activity, planning a release soon?

@romain-intel
Copy link
Contributor Author

romain-intel commented Oct 2, 2024

Gah -- something up with windows :( . I can't seem to retrigger tests but I think everything else should be fine :).

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

Oops, #717 should fix it. Could you please rebase again?

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

Unrelated: I see a flurry of activity, planning a release soon?

Yes, I really want to get this released as soon as possible. There are a few tricky things though. The release of micromamba 2 is still causing a lot of chaos, e.g. #709, so we should probably let that settle down a bit first.

@romain-intel
Copy link
Contributor Author

Rebased.

And yes, micromamba v2 is also causing me headaches :). Hopefully you can release soon though. Definitely interested in getting this large change integrated.

Copy link
Contributor

@maresb maresb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, are you ready to merge @romain-intel?

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

I'm going to take all the green I can get and merge this. Feel free to do any followup in a subsequent PR.

@maresb maresb merged commit 29b78b1 into conda:main Oct 3, 2024
43 checks passed
@romain-intel
Copy link
Contributor Author

Thanks -- yes, sorry, busy day. Thanks for merging!!

@maresb
Copy link
Contributor

maresb commented Oct 4, 2024

I had a concern regarding the parse_python_requirement implementation for path dependencies, but now I'm convinced it's not that big of a deal.

We're assuming a nice PEP 508 compliant input string where the name is specified. However, pip is unfortunately a bit more loose about actually specifying the name.

So if I do:

from conda_lock.lookup import DEFAULT_MAPPING_URL
from conda_lock.src_parser.pyproject_toml import parse_python_requirement

parse_python_requirement(
    "./downloads/numpy-1.9.2-cp34-none-win32.whl", mapping_url=DEFAULT_MAPPING_URL
)

then I get

InvalidRequirement: Expected package name at the start of dependency specifier
    ./downloads/numpy-1.9.2-cp34-none-win32.whl
    ^

That error message is a lot more informative than I was expecting, which is why I don't think this is so serious of a problem.

Since not everyone has recently read PEP 508, it might be kind to intercept this exception and reraise with a note explaining that names can be specified by package-name @ .... But I wouldn't block the release on this.

@romain-intel
Copy link
Contributor Author

I can make a more informative message. I'll try this over the weekend or early next week. And yes, I am aware of that and it is spec compliant if not the easiest. I think pip extracts the name from the setup or something when not specified. So nice but then again, why have specs :).

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.

2 participants