-
-
Notifications
You must be signed in to change notification settings - Fork 626
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
Simplify PythonSetup usage #4328
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
60e06e1
Simplify PythonSetup usage.
benjyw bf67293
Address code review comment.
benjyw 8306dba
Fix broken tests.
benjyw 915f146
Fix test breaks for real...
benjyw c5ff73c
Fix some removal hints.
benjyw 4cfabf4
Fix priority order of redundant flags.
benjyw 9ddde09
Will it ever end...?
benjyw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
python_library( | ||
dependencies = [ | ||
'3rdparty/python:setuptools', | ||
'src/python/pants/subsystem', | ||
], | ||
) |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# coding=utf-8 | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pex.fetcher import Fetcher, PyPIFetcher | ||
from pex.http import Context | ||
|
||
from pants.subsystem.subsystem import Subsystem | ||
|
||
|
||
class PythonRepos(Subsystem): | ||
"""A python code repository.""" | ||
options_scope = 'python-repos' | ||
|
||
@classmethod | ||
def register_options(cls, register): | ||
super(PythonRepos, cls).register_options(register) | ||
register('--repos', advanced=True, type=list, default=[], fingerprint=True, | ||
help='URLs of code repositories.') | ||
register('--indexes', advanced=True, type=list, fingerprint=True, | ||
default=['https://pypi.python.org/simple/'], help='URLs of code repository indexes.') | ||
|
||
@property | ||
def repos(self): | ||
return self.get_options().repos | ||
|
||
@property | ||
def indexes(self): | ||
return self.get_options().indexes | ||
|
||
def get_fetchers(self): | ||
fetchers = [] | ||
fetchers.extend(Fetcher([url]) for url in self.repos) | ||
fetchers.extend(PyPIFetcher(url) for url in self.indexes) | ||
return fetchers | ||
|
||
def get_network_context(self): | ||
# TODO(wickman): Add retry, conn_timeout, threads, etc configuration here. | ||
return Context.get() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is there a reason behind the import namespace split between PythonSetup vs PythonRepos? would generally expect them to live side-by-side at least in the same import namespace, no?
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.
Not necessarily. PythonRepos are needed both by the python backend and by core pants (in the plugin resolver), so they need to be in core Pants. And PythonRepos represents a clear concept that indeed has nothing specifically to do with the python backend.
PythonSetup, OTOH, is a bit of a hodge-podge of things, but most of them do relate specifically to the Python backend (e.g., how to set up an interpreter cache). So as long as the interpreter cache is in the Python backend and not the core, PythonSetup should be there too.
And indeed, the only thing the core needed from PythonSetup was that cache ttl setting, and that usage was pretty spurious - there's no reason to link "how pants resolves its plugins" with "how pants resolves code it builds".