Conversation
The pip.version module provides several useful functions for getting pip's version. It is no longer necessary to change the version seperately in docs/conf.py and setup.py.
Example: -E DIR, --environment=DIR -> -E, --environment <dir>
n.b: this commit breaks 'pip <command> --version' ; fix later
- The global 'parser' object was removed. At present it is instantiated in main() and passed on to each Command (stored as Command.main_parser) - All global command instances were removed. Deferred command imports were removed. Commands are instantiated on demand in main(). See pip.commands.__init__ - The command list is now part of the parser's description and comes before all other options. The pip help command now serves the purpose of showing a given command's options instead of all available commands. - Option handling was factored out of main() - All pip exceptions inherit from PipError - All command specific options grouped under a 'Command options' OptionGroup (very lame implementation at the moment) - Changed the wording of some options (wip)
- Reordering imports - ''' -> """ - __all__ lists to __all__ tuples - Small consistency fixes
There was a problem hiding this comment.
This kind of change is pure, useless noise in a diff. Please try to avoid such changes in pull requests.
There was a problem hiding this comment.
I should have separated these into '[style]' commits (or done nothing at all actually, since such things annoy us all differently)
|
Hi @gvalkov - thanks very much for the work here. I'm excited about the improved help output, so I'd like to get this merged, but there are some significant issues remaining to be addressed before that can happen. First, pip supports Python 2.4 through 3.2, all from a single codebase. This requires that in some cases we sacrifice beautiful code for this wider support. The worst is catching exceptions where we need the exception instance: since Python 3 requires the "as" syntax and Python < 2.6 doesn't support it, you must simply catch the exception with no Secondly, the existing tests must pass. I've tried to get the tests passing, and in doing so I fixed a number of Python version compatibility issues that I found, as well as some typos and unwanted/unnecessary changes, and pushed to https://github.com/carljm/pip/tree/gvalkov-refactor. I was still blocked on getting the tests to run on Python 2.4, though - it seems the way your code interacts with optparse is broken with Python 2.4's optparse. This will need to be fixed. On Python 3.2 I'm seeing at least one test failure, in an autocompletion test. Lastly, I'm not sure why there are so many cosmetic rearrangements of things like docstrings, or replacing lists with tuples (incorrectly, IMO), in this pull request. I won't block the pull request on that kind of thing, since I'd really like to get these improvements in - but in future please keep your diffs minimal. Unless there's a really good reason for a cosmetic change, it just makes the diff harder to review and makes future use of "git annotate" more difficult. Thanks again! Hopefully we can get this into merge shape soon. |
|
Thanks @carljm - I replied to some of your code comments. Honeslty, I've never had to deal with future/backward compatibiliy to such an extend (2.4 to 3.2 is like ~7 years). Some of these things just don't pop up in my head ( The point of the pull request was to get more eyes on the code, since it changes things all over the place. I didn't consider it completely mergeable either. I'll definitely have a look at your fork and work on getting it into merge shape, as you said. |
|
I'm closing this as I won't have any time to work on it in the foreseeable future. Thanks @carljm for the time spend reviewing and on #pip. Pip is such a flagship tool for anyone in the Python world and I really hope I can get back to hacking on it again. |
This branch attempts to address some areas of pip that I think need more work.
Look and Feel
old:
[
pip help](https://gist.github.com/raw/1556718/d82231058dd3c3ff3e1529eaf325b4f5d3075540/pip%20help%20(develop%206d6ead)[
pip help install](https://gist.github.com/raw/1556718/76f4e7ded3301d9595a62196a80c9d66c665dcba/pip%20help%20install%20(develop%206d6ead)new:
pip helppip help installpippip --helpandpip helpwith no arguments should behave in the same way.--src=DIR, --source=DIR, --source-dir=DIR, --source-directory=DIRlike lines. Decide on two and maintain compatibility for the rest.Code
... Listing all these would turn this into a design document and I actually prefer fixing things. Please refer to the code - the commits are fairly atomic (mostly for demonstrative purposes)
This is still mostly a work in progress, but since refactoring work often ends up being un-mergeable, I'd be glad if this was merged earlier.