Skip to content

attempt an optimistic localhost-only search for "==" requirements #2114

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

Closed
wants to merge 3 commits into from

Conversation

bukzor
Copy link

@bukzor bukzor commented Nov 4, 2014

This is mostly for discussion.

In our very large project (>300 requirements) we're finding that the round-trips to the pypi server make the pip portion of our build frustratingly slow, even though we've ensured that all wheels are built and available on local disk.

Here I attempt to leverage the fact that there's no need to talk to the pypi server if we have a == requirement and a match is found locally.

There's two parts of this implementation that are (probably) objectionable, and I'd like advise on how to implement them more cleanly:

  1. _find_requirement is called twice in the case of a package with pinned version, not found locally. This results in a series of messages "Do distributions at all found for foolib! Downloading foolib. Unpacking foolib. Successfully installed foolib."
  2. The fake html page (line 751). This doesn't seem to cause any problems, but does seem like a pretty terrible hack.

On the other hand, if you don't mind these problems as much as I do, don't let me stop you from pulling :)

@bukzor bukzor force-pushed the optimistic-double-equals branch from 3d8fc1f to ec5fd8c Compare November 4, 2014 18:57
@bukzor bukzor force-pushed the optimistic-double-equals branch from ec5fd8c to 2cdf43a Compare November 4, 2014 19:01
@bukzor
Copy link
Author

bukzor commented Nov 4, 2014

All tests pass, after rebasing onto #2116 .

@achembarpu
Copy link

+1 - along with the new default caching mechanism, this is very useful for projects!

@piotr-dobrogost
Copy link

I think passing --no-index with --find-links should prevent reaching pypi server, doesn't it?

@bukzor
Copy link
Author

bukzor commented Nov 25, 2014

@piotr Yes, and then it fails if anything is not yet cached. The objective
is to speed up normal operation.

On Tue, Nov 25, 2014 at 9:59 AM, Piotr Dobrogost [email protected]
wrote:

I think passing --no-index with --find-links should prevent reaching pypi
server, doesn't it?


Reply to this email directly or view it on GitHub
#2114 (comment).

Buck Golemon
Cell: (408) 202-3901

@piotr-dobrogost
Copy link

@bukzor
But you write

(...) even though we've ensured that all wheels are built and available on local disk

@@ -1,3 +1,2 @@
[egg_info]
tag_build = dev
tag_svn_revision = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related to this change or was it committed by accident?

@msabramo
Copy link
Contributor

This seems useful as it will speed things up when you pin with == but not fail if you don't like it would with --no-index.

@msabramo
Copy link
Contributor

Can you fix the merge conflicts? I'd love to play with this.

@bukzor
Copy link
Author

bukzor commented Dec 22, 2014

@msabramo: merged. The conflict was trivial, an unrelated edit on the next line.

@msabramo
Copy link
Contributor

Cool, thanks! There's a couple of test failures on Python 3, but I still will probably pull this down and play with it.

@msabramo
Copy link
Contributor

How do I test this?

I did pip install --find-links=/opt/pip/wheels zope.sqlalchemy==0.7.3 and I have a wheel for zope.sqlalchemy==0.7.3 in /opt/pip/wheels so I was expecting it to use that not download, but it did do a download.

A repeat of that command didn't fetch it but that was seeming because of the caching and I saw the same behavior on the develop branch.

@bukzor
Copy link
Author

bukzor commented Dec 24, 2014

You have to use --wheel-dir iirc

--phone is hard.
On Dec 23, 2014 5:06 PM, "Marc Abramowitz" [email protected] wrote:

How do I test this?

I did pip install --find-links=/opt/pip/wheels zope.sqlalchemy==0.7.3 and
I have a wheel for zope.sqlalchemy==0.7.3 in /opt/pip/wheels so I was
expecting it to use that not download, but it did do a download.

A repeat of that command didn't fetch it but that was seeming because of
the caching and I saw the same behavior on the develop branch.


Reply to this email directly or view it on GitHub
#2114 (comment).

@msabramo
Copy link
Contributor

msabramo commented Mar 7, 2015

Shoot I need to look at this again. Quite similar to #2493 - right? Sorry, browsing on phone so hard to check in detail.

@piotr-dobrogost
Copy link

@msabramo

In 2493 you write

If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

whereas here there's this statement:

Here I attempt to leverage the fact that there's no need to talk to the pypi server if we have a == requirement and a match is found locally.

Looking briefly on this PR it seems that found locally above refers also to packages available locally for install and not only installed ones. If that's the case then features in both PRs are different. Btw, skipping pypi if there's locally available package for install would be nice to have. #2090 asks about similar feature but there there's no restriction to requirements with == operator.

@piotr-dobrogost
Copy link

Shouldn't this feature work also for <= requirements?

@dstufft
Copy link
Member

dstufft commented Apr 7, 2015

Going to close this, we've decided in another PR that trying to do this is not something we generally want to do. It's an optimization and one that's likely to break in unexpected ways, especially with the new PEP 440 meaning of ==.

@dstufft dstufft closed this Apr 7, 2015
@bukzor
Copy link
Author

bukzor commented Apr 7, 2015

link?

On Mon, Apr 6, 2015 at 9:15 PM, Donald Stufft [email protected]
wrote:

Going to close this, we've decided in another PR that trying to do this is
not something we generally want to do. It's an optimization and one that's
likely to break in unexpected ways, especially with the new PEP 440 meaning
of ==.


Reply to this email directly or view it on GitHub
#2114 (comment).

Buck Golemon
Cell: (408) 202-3901

@pfmoore
Copy link
Member

pfmoore commented Apr 7, 2015

#2631 and #2493

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants