-
Notifications
You must be signed in to change notification settings - Fork 23
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
Allow support for overriding the default PyPI index url #26
Conversation
pur/__init__.py
Outdated
@@ -68,6 +68,8 @@ | |||
help='Prevents updating nested requirements files.') | |||
@click.option('-s', '--skip', type=click.STRING, help='Comma separated list ' + | |||
'of packages to skip updating.') | |||
@click.option('--index-url', type=click.STRING, help='Comma separated list ' + |
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.
Let's allow --index-url
to be passed multiple times with each argument added to a list. Then we can have urls that include commas.
pur/__init__.py
Outdated
@@ -311,7 +318,7 @@ def patched_parse_requirements(*args, **kwargs): | |||
req_file.parse_requirements = patched_parse_requirements | |||
|
|||
|
|||
def _get_requirements_and_latest(filename, force=False, minor=[], patch=[], | |||
def _get_requirements_and_latest(filename, index_url, force=False, minor=[], patch=[], |
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 should be optional, like index_urls=[]
.
pur/__init__.py
Outdated
@@ -330,7 +337,7 @@ def _get_requirements_and_latest(filename, force=False, minor=[], patch=[], | |||
""" | |||
session = PipSession() | |||
finder = PackageFinder( | |||
session=session, find_links=[], index_urls=[PyPI.simple_url]) | |||
session=session, find_links=[], index_urls=index_url) |
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.
Need to use PyPI.simple_url
when index_urls
list is empty.
pur/__init__.py
Outdated
@@ -201,7 +207,7 @@ def _internal_update_requirements(obuffer, updates, input_file=None, | |||
try: | |||
requirements = _get_requirements_and_latest(input_file, force=force, | |||
minor=minor, patch=patch, | |||
pre=pre) | |||
pre=pre, index_url=index_url) |
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.
s/index_url/index_urls/
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.
Todo:
- default to using
PyPI.simple_url
when no index urls defined - allow multiple
--index-url
that roll into a list namedindex_urls
Allow support for overriding the default PyPI index URL to use URLs pointed at a mirror.
Why
Corporate environments often require developers to use a repository mirror and the mirror is not always explicitly defined in the
requirements.txt
file.Example use case:
Issue:
#25