-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require an already created session to be passed into APIs
- Loading branch information
Showing
7 changed files
with
131 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? This has caused us to pin an earlier version of pip due to non-obvious breakage. Suddenly requiring a session when one could be (and used to be) created automatically seems to break backwards compatibility without a clear reason.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip does not have a public API, everything is internal and this means that there is no backwards compatibility promises. The reason we're requiring a session and not just creating one is because in our internal uses of this API it was too easy to forget to pass in the session kwarg and lose settings like proxy and timeout settings.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing the requirements file should not need a HTTP Session object.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure it should, because you can point at remote files which need to be fetched with a HTTP session object.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nicer to have an API for remote objects and files, then.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do
-r https://example.com/
inside of arequirements.txt
. It's not possible to fully parse every possible requirements file without either removing that ability or passing in a session object.7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for uses in setup.py files
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. pip as an API
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip doesn't have an API and importing pip inside of a
setup.py
is a bad idea.7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstufft then what's the canonical way of expressing requirements for pip packages, then?
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the requirements inside of the
install_requires
of thesetup.py
.7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://caremad.io/2013/07/setup-vs-requirement/ might be helpful as well.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you need to duplicate the requirements.txt file and the info in the setup.py file? Seems fraught.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a
requirements.txt
file at all? If you have your dependencies inside ofsetup.py
you can dopip install .
inside of a checkout, or you can dopip install -e .
inside of a checkout or you can dopip install -e <vcs_url>
to point to a checkout.If you really want to support
pip install -r requirements.txt
inside of a check out you can just make a stubrequirements.txt
that has something like:or
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few upsides to using a requirements.txt.
7037443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4105 should help when requirements don't include URLs.