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

Proposed fix for #579 #588

Merged
merged 4 commits into from Feb 11, 2024
Merged

Proposed fix for #579 #588

merged 4 commits into from Feb 11, 2024

Conversation

ianpye
Copy link
Contributor

@ianpye ianpye commented Jan 24, 2024

Description

This PR proposes a simple fix to issue #579. Currently, the --pypi_to_conda_lookup_file flag does not work and produces an error whenever it is used, without checking the link first.

The removal of the following lines allows the flag to work as intended:

del self.pypi_lookup
del self.conda_lookup

@ianpye ianpye requested a review from a team as a code owner January 24, 2024 09:47
Copy link

netlify bot commented Jan 24, 2024

Deploy Preview for conda-lock ready!

Name Link
🔨 Latest commit c1e4d2f
🔍 Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/65c808a9deede200085677b4
😎 Deploy Preview https://deploy-preview-588--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.

@maresb
Copy link
Contributor

maresb commented Jan 24, 2024

Thanks a lot @ianpye for taking the initiative on this!

I believe the proper fix is something more like:

        if self._mapping_url != value:
            self._mapping_url = value
            # Invalidate cache
            try:
                del self.pypi_lookup
            except AttributeError:
                pass
            try:
                del self.conda_lookup
            except AttributeError:
                pass

This feature desperately needs a test to prevent a similar regression in the future.

@ianpye
Copy link
Contributor Author

ianpye commented Jan 29, 2024

Thanks @maresb for your input, I have changed my code to reflect those suggestions that you made.

@maresb
Copy link
Contributor

maresb commented Jan 29, 2024

Thanks @ianpye!

I made a quick attempt to write a test, but I didn't manage to get it to work properly yet. Do you have any ideas for a brief test that ensures we are using the specified mapping? I was thinking we could create a mapping URL that swaps some dependency, and then the test checks inside the generated lockfile for that substituted dependency.

@maresb
Copy link
Contributor

maresb commented Jan 29, 2024

Maybe I'm going the wrong way in my gist. I was thinking about constructing an example for pyproject.toml, but you're using only environment.yml, which is probably simpler.

@maresb
Copy link
Contributor

maresb commented Jan 29, 2024

The current test failure on macos is erroneous. See #591.

@ianpye
Copy link
Contributor Author

ianpye commented Jan 30, 2024

@maresb What do you think about having 2 simple tests, one that uses the flag to point to the new mapping url that you provided and one that swaps the link to an invalid link. The 2nd test would check for failure and show that there is an attempt to connect to the link provided.

@maresb maresb merged commit f592f2d into conda:main Feb 11, 2024
10 checks passed
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.

None yet

2 participants