internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pypa/pip

Issue:
Give pip a manpage
See title.



Discussion:
Yeah, I've been meaning to do that, see http://andialbrecht.wordpress.com/2009/03/17/creating-a-man-page-with-distutils-and-optparse/

I got the Debian/Ubuntu manpage from svn://svn.debian.org/svn/python-modules/packages/python-pip/ :
https://gist.github.com/1513623

pip.1 is the latest, pip.xml was used to generate an older version of it.

Hm, question is how we update the man page in a sensible way. We should generate it before doing a release.

I'll get on this once some of the look & feel patches get merged in. I prefer if I didn't have to deal with troff directly - the following possibilities come to mind:
- Restructured Text -> Sphinx -> Man 
  **+** Already used for the rest of the documentation,
  **+** reST is [nice](https://raw.github.com/gvalkov/git-link/master/doc/git-link-man1.rst).
  **-** It's hard/impossible to make the man page look exactly the way you want it to.
- Asciidoc
  **+** Asciidoc is [nice](https://raw.github.com/git/git/master/Documentation/git-checkout.txt).
  **+** Git uses it and their man pages are excellent.
  **+** More control over formatting.
  **-** It's an external dependency (it's written in Python, but it's not on PyPi).
- Xmltoman
  **-** Xml
  **-** Perl 

I'm leaning towards asciidoc. I'm also thinking of iterating over all options and option groups, instead of using a custom `HelpFormatter`.

rst2man is part of docutils.  I'm not sure why you want Sphinx in the pipeline, or what is hard about getting desired output with it.

@mgedmin Sphinx will generate man pages for you too, when a tool is already being used that does what you want, why ignore it?


Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,6 +13,7 @@
 
 import os
 import sys
+import glob
 
 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
 
@@ -82,7 +83,7 @@
 
 # List of directories, relative to source directory, that shouldn't be searched
 # for source files.
-exclude_trees = ['build']
+exclude_patterns = ['_build/', 'man/']
 
 # The reST default role (used for this markup: `text`) to use for all documents
 # default_role = None
@@ -204,7 +205,7 @@
         'index',
         'pip.tex',
         u'pip Documentation',
-        u'The pip developers',
+        u'pip developers',
         'manual',
     ),
 ]
@@ -225,3 +226,27 @@
 
 # If false, no module index is generated.
 # latex_use_modindex = True
+
+# -- Options for Manual Pages -------------------------------------------------
+
+# List of manual pages generated
+man_pages = [
+    (
+        'man/pip',
+        'pip',
+        u'package manager for Python packages',
+        u'pip developers',
+        1
+    )
+]
+
+# Here, we crawl the entire man/commands/ directory and list every file with
+# appropriate name and details
+for fname in glob.glob('man/commands/*.rst'):
+    fname_base = fname[:-4]
+    outname = 'pip-' + fname_base[13:]
+    description = u'description of {} command'.format(
+        outname.replace('-', ' ')
+    )
+
+    man_pages.append((fname_base, outname, description, u'pip developers', 1))


Test patch:
Repository: pypa/pip

Issue:
the warning message on misatched versions during installation is wrong
* Pip version: 9.0.1-465-g841f5dfb
* Python version: 3.6.2
* Operating system: Arch Linux x86_64

### What I've run:

```shell
> cat >setup.py <<\EOF
from setuptools import setup
setup(name='project', version='1.0')
EOF
> python setup.py -q sdist
> cp dist/project-{1.0,2.0}.tar.gz
> pip install -f dist 'project==2.0'
Collecting project==2.0
  Requested project==2.0 from file:///tmp/tmp.S2Tp2tlsfO/dist/project-2.0.tar.gz,
  but installing version None
Installing collected packages: project
  Running setup.py install for project ... done
Successfully installed project-1.0
> pip install -U -f dist project==2.0
Collecting project==2.0
  Requested project==2.0 from file:///tmp/tmp.S2Tp2tlsfO/dist/project-2.0.tar.gz,
  but installing version 1.0
Installing collected packages: project
  Found existing installation: project 1.0
    Uninstalling project-1.0:
      Successfully uninstalled project-1.0
  Running setup.py install for project ... done
Successfully installed project-1.0
```
As you can see the information about the effective version being installed is wrong: the currently installed version is used.


Discussion:

Resolving patch:
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -595,7 +595,7 @@ def assert_source_matches_version(self):
             logger.warning(
                 'Requested %s, but installing version %s',
                 self,
-                self.installed_version,
+                version,
             )
         else:
             logger.debug(


Test patch:
diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py
--- a/tests/unit/test_req.py
+++ b/tests/unit/test_req.py
@@ -21,7 +21,7 @@
 from pip._internal.req.req_install import parse_editable
 from pip._internal.resolve import Resolver
 from pip._internal.utils.misc import read_text_file
-from tests.lib import assert_raises_regexp, requirements_file
+from tests.lib import DATA_DIR, assert_raises_regexp, requirements_file
 
 
 class TestRequirementSet(object):
@@ -605,3 +605,17 @@ def test_exclusive_environment_markers():
     req_set.add_requirement(eq26)
     req_set.add_requirement(ne26)
     assert req_set.has_requirement('Django')
+
+
+def test_mismatched_versions(caplog, tmpdir):
+    original_source = os.path.join(DATA_DIR, 'src', 'simplewheel-1.0')
+    source_dir = os.path.join(tmpdir, 'simplewheel')
+    shutil.copytree(original_source, source_dir)
+    req = InstallRequirement(req=Requirement('simplewheel==2.0'),
+                             comes_from=None, source_dir=source_dir)
+    req.run_egg_info()
+    req.assert_source_matches_version()
+    assert caplog.records[-1].message == (
+        'Requested simplewheel==2.0, '
+        'but installing version 1.0'
+    )
Repository: pypa/pip

Issue:
pip un-vendored support is broken
* Pip version: 9.0.1-465-g841f5dfb
* Python version: 2.7.13
* Operating system: Arch Linux x86_64

### What I've run:

```python
> ./.tox/py27-novendor/bin/pip search test
Traceback (most recent call last):
  File "./.tox/py27-novendor/bin/pip", line 7, in <module>
    from pip import main
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/__init__.py", line 46, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/vcs/mercurial.py", line 8, in <module>
    from pip.download import path_to_url
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/download.py", line 28, in <module>
    from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
ImportError: No module named parse
```

and after fixing that one:

```python
Traceback (most recent call last):
  File "./.tox/py27-novendor/bin/pip", line 7, in <module>
    from pip import main
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/__init__.py", line 46, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/index.py", line 39, in <module>
    from pip.wheel import Wheel, wheel_ext
  File ".tox/py27-novendor/lib/python2.7/site-packages/pip/wheel.py", line 21, in <module>
    from pip._vendor import pkg_resources, pytoml
ImportError: cannot import name pytoml
```



Discussion:

Resolving patch:
diff --git a/src/pip/_vendor/__init__.py b/src/pip/_vendor/__init__.py
--- a/src/pip/_vendor/__init__.py
+++ b/src/pip/_vendor/__init__.py
@@ -70,11 +70,13 @@ def vendored(modulename):
     vendored("six")
     vendored("six.moves")
     vendored("six.moves.urllib")
+    vendored("six.moves.urllib.parse")
     vendored("packaging")
     vendored("packaging.version")
     vendored("packaging.specifiers")
     vendored("pkg_resources")
     vendored("progress")
+    vendored("pytoml")
     vendored("retrying")
     vendored("requests")
     vendored("requests.packages")


Test patch:
Repository: pypa/pip

Issue:
minor, docs: "edit on github" 404
https://pip.pypa.io/en/stable/

Link in the top right returns a github 404

Edit on GitHub
https://github.com/pypa/pip/blob/28cc0b291db6ee5686010378edab60abf0067003/docs/index.rst


Discussion:
Hi @davidhyman!

Thanks for filing this issue. I'll look into it.
cf #2861 for some possible explanation
Thanks for finding that issue @xavfernandez! This issue is a duplicate of #2861 then?

Yup, but since #2861 is closed, we might want to keep this one open until this is fixed ?
I'm cool with that.

I think pip has to switch themes anyway (pypa/pypa-docs-theme#8); This would get fixed whenever that happens...

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -33,7 +33,7 @@
 # intersphinx
 intersphinx_cache_limit = 0
 intersphinx_mapping = {
-    'pypug': ('https://packaging.python.org/en/latest/', None),
+    'pypug': ('https://packaging.python.org/', None),
     'pypa': ('https://www.pypa.io/en/latest/', None),
 }
 
@@ -52,7 +52,7 @@
 
 # General information about the project.
 project = 'pip'
-copyright = '2008-2016, PyPA'
+copyright = '2008-2017, PyPA'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -83,7 +83,7 @@
 
 # List of directories, relative to source directory, that shouldn't be searched
 # for source files.
-exclude_patterns = ['_build/', 'man/']
+exclude_patterns = ['build/', 'man/']
 
 # The reST default role (used for this markup: `text`) to use for all documents
 # default_role = None
@@ -114,19 +114,17 @@
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'default'
-if not on_rtd:
-    try:
-        import sphinx_rtd_theme
-        html_theme = 'sphinx_rtd_theme'
-        html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
-    except ImportError:
-        pass
+html_theme = "pypa_theme"
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-# html_theme_options = {}
+html_theme_options = {
+    'collapsiblesidebar': True,
+    'externalrefs': True,
+    'navigation_depth': 2,
+    'issues_url': 'https://github.com/pypa/pip/issues'
+}
 
 # Add any paths that contain custom themes here, relative to this directory.
 
@@ -157,10 +155,13 @@
 
 # If true, SmartyPants will be used to convert quotes and dashes to
 # typographically correct entities.
-# html_use_smartypants = False
+smart_quotes = False
 
 # Custom sidebar templates, maps document names to template names.
-# html_sidebars = {}
+html_sidebars = {
+    '**': ['localtoc.html', 'relations.html'],
+    'index': ['localtoc.html']
+}
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.


Test patch:
Repository: pypa/pip

Issue:
Remove platform.libc_ver fallback
See https://github.com/pypa/pip/pull/3836#issuecomment-231568184

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/pypa/pip/3837)
<!-- Reviewable:end -->



Discussion:
It looks like this got stuck, should it be closed ?
eh, I think it'd be an improvement, but am not really up for arguing about it more
Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the ``master`` branch into this pull request or rebase this pull request against ``master`` then it will eligible for code review and hopefully merging!

Resolving patch:
diff --git a/src/pip/_internal/utils/glibc.py b/src/pip/_internal/utils/glibc.py
--- a/src/pip/_internal/utils/glibc.py
+++ b/src/pip/_internal/utils/glibc.py
@@ -1,7 +1,6 @@
 from __future__ import absolute_import
 
 import ctypes
-import platform
 import re
 import warnings
 
@@ -73,9 +72,13 @@ def have_compatible_glibc(required_major, minimum_minor):
 # misleading. Solution: instead of using platform, use our code that actually
 # works.
 def libc_ver():
+    """Try to determine the glibc version
+
+    Returns a tuple of strings (lib, version) which default to empty strings
+    in case the lookup fails.
+    """
     glibc_version = glibc_version_string()
     if glibc_version is None:
-        # For non-glibc platforms, fall back on platform.libc_ver
-        return platform.libc_ver()
+        return ("", "")
     else:
         return ("glibc", glibc_version)


Test patch:
Repository: pypa/pip

Issue:
New docs theme doesn't show subsections under (for example) pip install
As an example, compare https://pip.pypa.io/en/latest/reference/pip_install/ and https://pip.pypa.io/en/stable/reference/pip_install/

The sidebar for stable shows the subsections Usage, Description, Options and Examples, and Description is expandable another level. And there's a full multi-level table of contents at the top of the page. Both of these features are missing from the new layout, which is a significant regression in navigability.


Discussion:
Which of these do we want to go with:

- increase the depth of headers in the sidebar
  - just a matter of bumping a number in `conf.py`
- add a table of contents on the reference pages
  - just the matter of putting a `:contents:` on top of the files

I like the first option. Either way, we should increase the depth of the tree in https://pip.pypa.io/en/latest/reference/ to be one step deeper -- like it is in stable.

Making a PR with first...

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -127,7 +127,7 @@
 html_theme_options = {
     'collapsiblesidebar': True,
     'externalrefs': True,
-    'navigation_depth': 2,
+    'navigation_depth': 3,
     'issues_url': 'https://github.com/pypa/pip/issues'
 }
 
diff --git a/docs/pipext.py b/docs/pipext.py
--- a/docs/pipext.py
+++ b/docs/pipext.py
@@ -2,13 +2,14 @@
 
 import optparse
 import sys
+from textwrap import dedent
+
 from docutils import nodes
 from docutils.parsers import rst
 from docutils.statemachine import ViewList
-from textwrap import dedent
+
 from pip._internal import cmdoptions
 from pip._internal.commands import commands_dict as commands
-from pip._internal.utils.misc import get_prog
 
 
 class PipCommandUsage(rst.Directive):
@@ -16,8 +17,7 @@ class PipCommandUsage(rst.Directive):
 
     def run(self):
         cmd = commands[self.arguments[0]]
-        prog = '%s %s' % (get_prog(), cmd.name)
-        usage = dedent(cmd.usage.replace('%prog', prog)).strip()
+        usage = dedent(cmd.usage.replace('%prog', 'pip')).strip()
         node = nodes.literal_block(usage, usage)
         return [node]
 


Test patch:
Repository: pypa/pip

Issue:
pip does not detect circular build dependency
* Pip version: 10.0.devel
* Python version: any
* Operating system: any

### What I've run:

```
pip install pip-forkbomb-test
```

Curiously, the problem is most severe on solid-state-drives where there is minimal lag time, so the processes multiply quickly.


Discussion:
Relavant part:

```toml
[build-system]
requires = ["pip-forkbomb-test"]
```

I'd call this a release blocker.


Resolving patch:
diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py
--- a/src/pip/_internal/wheel.py
+++ b/src/pip/_internal/wheel.py
@@ -693,7 +693,7 @@ def _install_build_reqs(self, reqs, prefix):
         # Ignore the --no-binary option when installing the build system, so
         # we don't recurse trying to build a self-hosting build system.
         finder = copy.copy(self.finder)
-        finder.format_control = FormatControl(set(), set())
+        finder.format_control = FormatControl(set(), set([":all:"]))
         urls = [finder.find_requirement(InstallRequirement.from_line(r),
                                         upgrade=False).url
                 for r in reqs]


Test patch:
diff --git a/tests/data/packages/pep518-3.0.tar.gz b/tests/data/packages/pep518-3.0.tar.gz
Binary files a/tests/data/packages/pep518-3.0.tar.gz and b/tests/data/packages/pep518-3.0.tar.gz differ
Repository: pypa/pip

Issue:
config entry misdisplayed in pip 10 help
* Pip version: 10.0.0.dev0 (94d186b)
* Python version: 3.6
* Operating system: Arch Linux

### Description:

see below

### What I've run:

```
$ pip -h

Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      
          Manage local and global configuration.
  
          Subcommands:
  
          list: List the active configuration (or from the file specified)
          edit: Edit the configuration file in an editor
          get: Get the value associated with name
          set: Set the name=value
          unset: Unset the value associated with name
  
          If none of --user, --global and --venv are passed, a virtual
          environment configuration file is used if one is active and the file
          exists. Otherwise, all modifications happen on the to the user file by
          default.
  
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

<elided>
```

note how the config entry in the help displays way too much.


Discussion:
Nice catch @anntzer!



Resolving patch:
diff --git a/src/pip/_internal/commands/configuration.py b/src/pip/_internal/commands/configuration.py
--- a/src/pip/_internal/commands/configuration.py
+++ b/src/pip/_internal/commands/configuration.py
@@ -13,19 +13,7 @@
 
 
 class ConfigurationCommand(Command):
-    """Manage local and global configuration."""
-    name = 'config'
-    usage = """
-        %prog [<file-option>] list
-        %prog [<file-option>] [--editor <editor-path>] edit
-
-        %prog [<file-option>] get name
-        %prog [<file-option>] set name value
-        %prog [<file-option>] unset name
-    """
-
-    summary = """
-        Manage local and global configuration.
+    """Manage local and global configuration.
 
         Subcommands:
 
@@ -41,6 +29,18 @@ class ConfigurationCommand(Command):
         default.
     """
 
+    name = 'config'
+    usage = """
+        %prog [<file-option>] list
+        %prog [<file-option>] [--editor <editor-path>] edit
+
+        %prog [<file-option>] get name
+        %prog [<file-option>] set name value
+        %prog [<file-option>] unset name
+    """
+
+    summary = "Manage local and global configuration."
+
     def __init__(self, *args, **kwargs):
         super(ConfigurationCommand, self).__init__(*args, **kwargs)
 


Test patch:
Repository: pypa/pip

Issue:
Badly formatted help string of --upgrade-strategy option
* Pip version: 10.0.0b1  (it's nice to see this one on tracks! Congrats!)
* Python version: 3.6.4
* Operating system: Linux

### Description:

The `%(default)` place holder isn't properly replaced with `"only-if-needed"`.

### What I've run:

```
python3 -m pip install -h
```

Result:
```
...
Install Options:
...
  --upgrade-strategy <upgrade_strategy>
                              Determines how dependency upgrading should be handled
                              (default: %(default)s). "eager" - dependencies are upgraded
                              regardless of whether the currently installed version satisfies
                              the requirements of the upgraded package(s). "only-if-needed" - 
                              are upgraded only when they do not satisfy the requirements of
                              the upgraded package(s).
...
```



Discussion:
Thanks for the testing out the beta and filing this report @amorison!

This should be an easy fix, PR incoming. :)

Resolving patch:
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -124,7 +124,7 @@ def __init__(self, *args, **kw):
             default='only-if-needed',
             choices=['only-if-needed', 'eager'],
             help='Determines how dependency upgrading should be handled '
-                 '(default: %(default)s). '
+                 '[default: %default]. '
                  '"eager" - dependencies are upgraded regardless of '
                  'whether the currently installed version satisfies the '
                  'requirements of the upgraded package(s). '


Test patch:
Repository: pypa/pip

Issue:
pip install script warnings should ignore dirname(sys.executable)
From https://github.com/pypa/pip/pull/4553#issuecomment-378227212

> this is a common use case this PR did not cover.
>
> if the executable is installed in dirname(sys.executable), we can skip the warning. Basically, treat dirname(sys.executable) as being a directory on PATH.

The "use case" above, is of installation using `venv/bin/pip` when invoking without activating a virtualenv.

@pfmoore doesn't feel strongly either way. @ncoghlan is in favour.


Discussion:

Resolving patch:
diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py
--- a/src/pip/_internal/wheel.py
+++ b/src/pip/_internal/wheel.py
@@ -162,11 +162,14 @@ def message_about_scripts_not_on_PATH(scripts):
         script_name = os.path.basename(destfile)
         grouped_by_dir[parent_dir].add(script_name)
 
-    path_env_var_parts = os.environ["PATH"].split(os.pathsep)
-    # Warn only for directories that are not on PATH
+    # We don't want to warn for directories that are on PATH.
+    not_warn_dirs = os.environ["PATH"].split(os.pathsep)
+    # If an executable sits with sys.executable, we don't warn for it.
+    #     This covers the case of venv invocations without activating the venv.
+    not_warn_dirs.append(os.path.dirname(sys.executable))
     warn_for = {
         parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items()
-        if parent_dir not in path_env_var_parts
+        if parent_dir not in not_warn_dirs
     }
     if not warn_for:
         return None


Test patch:
Repository: pypa/pip

Issue:
"Display a message on Windows if pip is being modified" is triggered by get-pip.py
The check in https://github.com/pypa/pip/commit/e41bad700ed40593f073c0fe9b40d7d0d5e7e849 is too broad, as it detects running `get-pip.py` as an attempt to use pip to modify itself.


Discussion:

Resolving patch:
diff --git a/src/pip/_internal/basecommand.py b/src/pip/_internal/basecommand.py
--- a/src/pip/_internal/basecommand.py
+++ b/src/pip/_internal/basecommand.py
@@ -335,8 +335,8 @@ def populate_requirement_set(requirement_set, args, options, finder,
         # See https://github.com/pypa/pip/issues/1299 for more discussion
         should_show_use_python_msg = (
             WINDOWS and
-            requirement_set.has_requirement('pip') and
-            "pip" in os.path.basename(sys.argv[0])
+            requirement_set.has_requirement("pip") and
+            os.path.basename(sys.argv[0]).startswith("pip")
         )
         if should_show_use_python_msg:
             new_command = [


Test patch: