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

Issue:
Deprecate legacy resolver
#### What's the problem this feature will solve?

Pip's legacy resolver is going to be removed any time soon, let's prepare for it.

#### Describe the solution you'd like

Deprecate the legacy resolver and remove it as soon as pip removes its own legacy resolver.

#### Alternative Solutions

Vendoring?. We've gone that path before but that didn't help.

#### Additional context

- https://github.com/pypa/pip/issues/10946
- https://github.com/pypa/pip/milestone/47


Discussion:
In the mean time, maybe activate backtracking by default?
> In the mean time, maybe activate backtracking by default?

I just want to note here that we should at least close #1647 before or at the same time as making that change.
> In the mean time, maybe activate backtracking by default?

We'll do it in `7.0.0` because it's a breaking change.
Pinning the issue to bring more attention.

Resolving patch:
diff --git a/piptools/scripts/compile.py b/piptools/scripts/compile.py
--- a/piptools/scripts/compile.py
+++ b/piptools/scripts/compile.py
@@ -378,6 +378,13 @@ def cli(
         if isinstance(output_file, LazyFile):  # pragma: no cover
             ctx.call_on_close(safecall(output_file.close_intelligently))
 
+    if resolver_name == "legacy":
+        log.warning(
+            "WARNING: using legacy resolver is deprecated and will be removed in "
+            "future versions. The default resolver will be change to 'backtracking' "
+            "in 7.0.0 version. Specify --resolver=backtracking to silence this warning."
+        )
+
     ###
     # Setup
     ###


Test patch:
diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py
--- a/tests/test_cli_compile.py
+++ b/tests/test_cli_compile.py
@@ -2546,3 +2546,17 @@ def test_failure_of_legacy_resolver_prompts_for_backtracking(
         assert out.exit_code == 0, out
     else:  # pragma: no cover
         raise AssertionError("unreachable")
+
+
+def test_print_deprecation_warning_if_using_legacy_resolver(runner, current_resolver):
+    with open("requirements.in", "w"):
+        pass
+
+    out = runner.invoke(cli)
+    assert out.exit_code == 0, out
+
+    expected_warning = "WARNING: using legacy resolver is deprecated"
+    if current_resolver == "legacy":
+        assert expected_warning in out.stderr
+    else:
+        assert expected_warning not in out.stderr
Repository: jazzband/pip-tools

Issue:
"--cache-dir" flag is ignored when specifying "--resolver=backtracking"
When using the backtracking resolver, the custom cache dir flag appears to be ignored.

#### Environment Versions

1. Ubuntu 22.04
1. Python version: 3.11.1
1. pip version: 22.3.1
1. pip-tools version: 6.12.1

#### Steps to replicate

Execute the command `pip-compile -v --cache-dir /tmp/pip-cache --resolver=backtracking --upgrade requirements/requirements.in`

#### Expected result

The cache found in `/tmp/pip-cache` is used.

#### Actual result

The default cache folder in `~/.cache/pip-tools` is used. No files are generated in `/tmp/pip-cache`.
Note that without the `--resolver=backtracking` flag, the cache is properly generated and read from the custom path.


Discussion:
New resolver uses the pip cache so you can override cache-dir by using pip-args
```
--pip-args "--cache-dir=/tmp/pip-cache"
```
> New resolver uses the pip cache so you can override cache-dir by using pip-args
> 
> ```
> --pip-args "--cache-dir=/tmp/pip-cache"
> ```

That worked, thank you! I suggest maybe showing a warning if you try to use `--cache-dir` together with the `--resolver=backtracking` flag, as it's quite confusing that it gets silently ignored.
Or we can pass `--cache-dir` (if presented) to `--pip-args` with `—resolver=backtracking`.

Resolving patch:
diff --git a/piptools/scripts/compile.py b/piptools/scripts/compile.py
--- a/piptools/scripts/compile.py
+++ b/piptools/scripts/compile.py
@@ -424,6 +424,8 @@ def cli(
         pip_args.append("--no-build-isolation")
     if resolver_name == "legacy":
         pip_args.extend(["--use-deprecated", "legacy-resolver"])
+    if resolver_name == "backtracking" and cache_dir:
+        pip_args.extend(["--cache-dir", cache_dir])
     pip_args.extend(right_args)
 
     repository: BaseRepository


Test patch:
diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py
--- a/tests/test_cli_compile.py
+++ b/tests/test_cli_compile.py
@@ -2853,3 +2853,18 @@ def test_raise_error_when_input_and_output_filenames_are_matched(
         f"Error: input and output filenames must not be matched: {req_out_path}"
     )
     assert expected_error in out.stderr.splitlines()
+
+
+@pytest.mark.network
+@backtracking_resolver_only
+def test_pass_pip_cache_to_pip_args(tmpdir, runner, current_resolver):
+    cache_dir = tmpdir.mkdir("cache_dir")
+
+    with open("requirements.in", "w") as fp:
+        fp.write("six==1.15.0")
+
+    out = runner.invoke(
+        cli, ["--cache-dir", str(cache_dir), "--resolver", current_resolver]
+    )
+    assert out.exit_code == 0
+    assert os.listdir(os.path.join(str(cache_dir), "http"))
Repository: jazzband/pip-tools

Issue:
Tests failing against pip main branch
https://github.com/jazzband/pip-tools/actions/runs/4475375698/jobs/7864734569

```python
    def copy_install_requirement(
        template: InstallRequirement, **extra_kwargs: Any
    ) -> InstallRequirement:
        """Make a copy of a template ``InstallRequirement`` with extra kwargs."""
        # Prepare install requirement kwargs.
        kwargs = {
            "comes_from": template.comes_from,
            "editable": template.editable,
            "link": template.link,
            "markers": template.markers,
            "use_pep517": template.use_pep517,
            "isolated": template.isolated,
>           "install_options": template.install_options,
            "global_options": template.global_options,
            "hash_options": template.hash_options,
            "constraint": template.constraint,
            "extras": template.extras,
            "user_supplied": template.user_supplied,
        }
E       AttributeError: 'InstallRequirement' object has no attribute 'install_options'

```


`--install-options` removed in https://github.com/pypa/pip/pull/11858.


Discussion:

Resolving patch:
diff --git a/piptools/utils.py b/piptools/utils.py
--- a/piptools/utils.py
+++ b/piptools/utils.py
@@ -21,6 +21,7 @@
 from pip._vendor.packaging.version import Version
 from pip._vendor.pkg_resources import Distribution, Requirement, get_distribution
 
+from piptools._compat import PIP_VERSION
 from piptools.subprocess_utils import run_python_snippet
 
 _KT = TypeVar("_KT")
@@ -456,7 +457,6 @@ def copy_install_requirement(
         "markers": template.markers,
         "use_pep517": template.use_pep517,
         "isolated": template.isolated,
-        "install_options": template.install_options,
         "global_options": template.global_options,
         "hash_options": template.hash_options,
         "constraint": template.constraint,
@@ -465,6 +465,9 @@ def copy_install_requirement(
     }
     kwargs.update(extra_kwargs)
 
+    if PIP_VERSION[:2] <= (23, 0):
+        kwargs["install_options"] = template.install_options
+
     # Original link does not belong to install requirements constructor,
     # pop it now to update later.
     original_link = kwargs.pop("original_link", None)


Test patch:
Repository: jazzband/pip-tools

Issue:
Improve --allow-unsafe warning comment
Currently, if `pip-compile` suppresses a requirement because the `--allow-unsafe` flag wasn't passed, it includes a warning that reads something like this:

```
# WARNING: The following packages were not pinned, but pip requires them to be
# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag.
# pip
```

This wording is a little incorrect because it's not always the case that pip requires them to be pinned. Namely, if the requirement is already satisfied by a package that's already installed, then pip won't check any hashes (because it won't need to install anything for that requirement). Because of this, a user seeing the current message can get the mistaken idea that they don't have any options other than passing `--allow-unsafe`.

Thus, I'd like to suggest that the wording be modified slightly to read something like:

```
# WARNING: The following packages were not pinned, but pip requires them to be
# pinned when the requirements file includes hashes and the requirement isn't
# already satisfied by a package already installed. Consider using the
# --allow-unsafe flag.
# pip
```

(As a side note, there is a third option in addition to (1) commenting out the "unsafe" requirement, and (2) including the pinned requirement with hashes. Namely, the pinned requirement can be included without hashes. Doing that third option would enforce that the user has the correct version already installed by erroring out if they don't, while not risking doing an "unsafe" operation by uninstalling / installing the package in question. The reason is that, by not including the hashes, it prevents a new install from taking place.)


Discussion:
Thanks, @cjerdonek. Sounds reasonable to me.
I'll work on this.

Resolving patch:
diff --git a/piptools/writer.py b/piptools/writer.py
--- a/piptools/writer.py
+++ b/piptools/writer.py
@@ -32,7 +32,8 @@
 
 MESSAGE_UNSAFE_PACKAGES_UNPINNED = comment(
     "# WARNING: The following packages were not pinned, but pip requires them to be"
-    "\n# pinned when the requirements file includes hashes. "
+    "\n# pinned when the requirements file includes hashes and the requirement is not"
+    "\n# satisfied by a package already installed. "
     "Consider using the --allow-unsafe flag."
 )
 


Test patch:
Repository: jazzband/pip-tools

Issue:
Convert the README from rst to md
<!--- Describe the changes here. --->
This PR converts the documentation from README.rst to README.md
Related: https://github.com/jazzband/pip-tools/issues/1856
##### Contributor checklist

- [ ] Provided the tests for the changes.
- [x] Assure PR title is short, clear, and good to be included in the user-oriented changelog

##### Maintainer checklist

- [ ] Assure one of these labels is present: `backwards incompatible`, `feature`, `enhancement`, `deprecation`, `bug`, `dependency`, `docs` or `skip-changelog` as they determine changelog listing.
- [ ] Assign the PR to an existing or new milestone for the target version (following [Semantic Versioning](https://blog.versioneye.com/2014/01/16/semantic-versioning/)).



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -52,3 +52,4 @@
 # -------------------------------------------------------------------------
 default_role = "any"
 nitpicky = True
+suppress_warnings = ["myst.xref_missing"]


Test patch:
Repository: jazzband/pip-tools

Issue:
The latest and the stable documentation may have been built using the development version
Shouldn't be [there](https://pip-tools.readthedocs.io/) the latest released version?

<img width="788" alt="Screenshot 2023-04-07 at 01 17 17" src="https://user-images.githubusercontent.com/7377671/230510654-fd15e934-4243-4ee3-85c6-bb8d55e656d4.png">




Discussion:
It is only the name that points to the development version.

See the [overview](https://readthedocs.org/projects/pip-tools/versions/):

A change that has been made in #1847 for example is contained in the `latest` version, but not `stable`. That still points to commit [f3fd37ba](https://github.com/jazzband/pip-tools/commit/f3fd37ba9b3123aa2215238004a8454173d2a362).

Trying to investigate why that is the case.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -3,15 +3,17 @@
 
 from __future__ import annotations
 
-from functools import partial
+from importlib.metadata import version as get_version
 from pathlib import Path
 
-from setuptools_scm import get_version
+from sphinx.util import logging
+from sphinx.util.console import bold
+
+logger = logging.getLogger(__name__)
 
 # -- Path setup --------------------------------------------------------------
 
 PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve()
-get_scm_version = partial(get_version, root=PROJECT_ROOT_DIR)
 
 
 # -- Project information -----------------------------------------------------
@@ -20,18 +22,14 @@
 author = f"{project} Contributors"
 copyright = f"The {author}"
 
-# The short X.Y version
-version = ".".join(
-    get_scm_version(
-        local_scheme="no-local-version",
-    ).split(
-        "."
-    )[:3],
-)
-
 # The full version, including alpha/beta/rc tags
-release = get_scm_version()
+release = get_version(project)
+
+# The short X.Y version
+version = ".".join(release.split(".")[:3])
 
+logger.info(bold("%s version: %s"), project, version)
+logger.info(bold("%s release: %s"), project, release)
 
 # -- General configuration ---------------------------------------------------
 
@@ -47,6 +45,7 @@
 # a list of builtin themes.
 #
 html_theme = "furo"
+html_title = f"<nobr>{project}</nobr> documentation v{release}"
 
 
 # -------------------------------------------------------------------------


Test patch:
Repository: jazzband/pip-tools

Issue:
Options in pyproject.toml break usage of `pip-sync`
I found it handy to add some often used options to the `[tools.pip-tools]`-section of my `pyproject.toml`. In particular I added:
```
[tool.pip-tools]
strip-extras = true
no-emit-index-url = true
no-emit-trusted-host = true
```
But now, calling `pip-sync requirements.txt` breaks with:
```
Error: No such config key 'no_emit_index_url'. (Possible options: emit_index_url, extra_index_url, index_url)
```
I can see, that using instead `emit-index-url = false` would have the same effect and, actually, is probably the correct solution to this. But given the poor documentation of the `pyproject.toml`-behaviour, we are left guessing and this is tedious and time-consuming. Moreover, `pip-compile` does not complain about the `pyproject`-options and happily uses them. Only `pip-sync` spoils the experience ;-)
So, a bit more consistency would be nice.



#### Environment Versions

1. OS Type: MS Windows 10
1. Python version: Python 3.11.5
1. pip version: pip 23.2.1
1. pip-tools version: pip-compile, version 7.3.0

#### Steps to replicate

1. Put any of the `no-*` options in `pyproject.toml`, e.g. `no-emit-index-url = true`
2. Call `pip-compile` and enjoy.
3. Call `pip-sync` and scratch your head, sort out your frustration and try to think, what could possibly be the issue here.

#### Expected result

The behaviour of `pip-compile` and `pip-sync` when using options from `pyproject.toml` is consistent, well documented and intuitive.

#### Actual result
The subset of options that work with `pip-sync` is unexpectedlty smaller than that of `pip-compile`. 



Discussion:

Resolving patch:
diff --git a/piptools/utils.py b/piptools/utils.py
--- a/piptools/utils.py
+++ b/piptools/utils.py
@@ -702,7 +702,13 @@ def _invert_negative_bool_options_in_config(
         # Transform config key to its equivalent in the CLI
         long_option = _convert_to_long_option(key)
         new_key = cli_opts[long_option].name if long_option in cli_opts else key
+        negative_option_prefix = "no_"
         assert new_key is not None
+        if (
+            new_key.startswith(negative_option_prefix)
+            and long_option not in ONLY_NEGATIVE_OPTIONS
+        ):
+            new_key = new_key[len(negative_option_prefix) :]
 
         # Invert negative boolean according to the CLI
         new_value = (


Test patch:
diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py
--- a/tests/test_cli_compile.py
+++ b/tests/test_cli_compile.py
@@ -3481,7 +3481,7 @@ def test_invalid_cli_boolean_flag_config_option_captured(
     out = runner.invoke(cli, [req_in.as_posix(), "--config", config_file.as_posix()])
 
     assert out.exit_code == 2
-    assert "No such config key 'no_annnotate'." in out.stderr
+    assert "No such config key 'annnotate'." in out.stderr
 
 
 strip_extras_warning = (
Repository: jazzband/pip-tools

Issue:
Allow http(s) as constraint file
<!--- Describe the changes here. --->

Alternative to #2038.

In my opinion, this is probably overshooting.

##### Contributor checklist

- [ ] Included tests for the changes.
- [ ] PR title is short, clear, and ready to be included in the user-facing changelog.

##### Maintainer checklist

- [ ] Verified one of these labels is present: `backwards incompatible`, `feature`, `enhancement`, `deprecation`, `bug`, `dependency`, `docs` or `skip-changelog` as they determine changelog listing.
- [ ] Assign the PR to an existing or new milestone for the target version (following [Semantic Versioning](https://blog.versioneye.com/2014/01/16/semantic-versioning/)).



Discussion:

Resolving patch:
diff --git a/piptools/scripts/options.py b/piptools/scripts/options.py
--- a/piptools/scripts/options.py
+++ b/piptools/scripts/options.py
@@ -343,14 +343,6 @@ def _get_default_option(option_name: str) -> Any:
 constraint = click.option(
     "-c",
     "--constraint",
-    type=click.Path(
-        exists=True,
-        file_okay=True,
-        dir_okay=False,
-        readable=True,
-        allow_dash=False,
-        path_type=str,
-    ),
     multiple=True,
     help="Constrain versions using the given constraints file; may be used more than once.",
 )


Test patch:
Repository: jazzband/pip-tools

Issue:
Broken build due to failed `linkcheck` job
I've noticed that matrix badges are frequently inaccessible, see README:
<img width="893" alt="image" src="https://github.com/jazzband/pip-tools/assets/7377671/94c2d45a-12ef-4237-8a85-434ee1bd7c05">

Sometimes, a certain issue even results in CI builds [breaking](https://github.com/jazzband/pip-tools/actions/runs/5920050370/job/16051009863#step:10:446) (caught in #1973):

```
broken    https://img.shields.io/matrix/pip-tools:matrix.org?label=Discuss%20on%20Matrix%20at%20%23pip-tools%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat - 408 Client Error: Request Timeout for url: https://img.shields.io/matrix/pip-tools:matrix.org?label=Discuss%20on%20Matrix%20at%20%23pip-tools%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
```

Perhaps we should consider [ignoring](https://github.com/jazzband/pip-tools/blob/04d2235716bc43cad3c10288081a4d2b7ee56944/docs/conf.py#L55-L57) `https://img.shields.io/matrix` as well?

/cc @webknjaz 



Discussion:
Yes, that makes sense.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -54,6 +54,7 @@
 
 linkcheck_ignore = [
     r"^https://matrix\.to/#",
+    r"^https://img.shields.io/matrix",
 ]
 
 suppress_warnings = ["myst.xref_missing"]


Test patch:
Repository: jazzband/pip-tools

Issue:
flag in COMPILE_EXCLUDE_OPTIONS showing up in header
<!-- Describe the issue briefly here. -->

#### Environment Versions

1. OS Type
  Windows mingw
1. Python version: `$ python -V`
  Python 3.11.8
1. pip version: `$ pip --version`
  pip 24.0
1. pip-tools version: `$ pip-compile --version`
  pip-compile, version 7.4.1.dev14 (`main` as of 03/04/2024)

#### Steps to replicate

1. `pip-compile --no-reuse-hashes -o requirements.txt`

#### Expected result

`--no-reuse-hashes` doesn't show up in the generated header comment.

#### Actual result

```
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    pip-compile --generate-hashes --index-url=.. --no-reuse-hashes --output-file=requirements.txt --strip-extras --trusted-host=..
#
```



Discussion:

Resolving patch:
diff --git a/piptools/utils.py b/piptools/utils.py
--- a/piptools/utils.py
+++ b/piptools/utils.py
@@ -371,9 +371,14 @@ def get_compile_command(click_ctx: click.Context) -> str:
         # Get the latest option name (usually it'll be a long name)
         option_long_name = option.opts[-1]
 
+        negative_option = None
+        if option.is_flag and option.secondary_opts:
+            # get inverse flag --no-{option_long_name}
+            negative_option = option.secondary_opts[-1]
+
         # Exclude one-off options (--upgrade/--upgrade-package/--rebuild/...)
         # or options that don't change compile behaviour (--verbose/--dry-run/...)
-        if option_long_name in COMPILE_EXCLUDE_OPTIONS:
+        if {option_long_name, negative_option} & COMPILE_EXCLUDE_OPTIONS:
             continue
 
         # Exclude config option if it's the default one


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -374,6 +374,8 @@ def test_is_url_requirement_filename(caplog, from_line, line):
         (["--upgrade"], "pip-compile"),
         (["-P", "django"], "pip-compile"),
         (["--upgrade-package", "django"], "pip-compile"),
+        (["--reuse-hashes"], "pip-compile"),
+        (["--no-reuse-hashes"], "pip-compile"),
         # Check options
         (["--max-rounds", "42"], "pip-compile --max-rounds=42"),
         (["--index-url", "https://foo"], "pip-compile --index-url=https://foo"),
Repository: jazzband/pip-tools

Issue:
[TODO][CI][pip upstream changes] Fix failing nightlies running against `pip`'s `main` branch
Failure example: https://github.com/jazzband/pip-tools/actions/runs/8794562108/job/24134206791


Discussion:
A new pip 24.1 release is due out any day now. 

https://github.com/pypa/pip/issues/12613 
Last pass: https://github.com/jazzband/pip-tools/actions/runs/8716054525 Wed, 17 Apr 2024 03:54:40 GMT

First fail: https://github.com/jazzband/pip-tools/actions/runs/8732146094 Thu 18 Apr 2024 03:55:04 GMT

https://github.com/pypa/pip/commit/4d09e3c004857b3ba766cb93cdea8e1fc3c3c677 (https://github.com/pypa/pip/pull/12571) looks the most likely from a quick check of the commits from this window. 

Thanks for taking time to look into this!
This seems to be the faulty line:

https://github.com/jazzband/pip-tools/blob/b692edb31c548e2cc23d19ae3bf3732d729df089/piptools/exceptions.py#L30

We already had a similar case in #570.

Resolving patch:
diff --git a/piptools/exceptions.py b/piptools/exceptions.py
--- a/piptools/exceptions.py
+++ b/piptools/exceptions.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import operator
 from typing import Iterable
 
 from pip._internal.index.package_finder import PackageFinder
@@ -27,7 +28,9 @@ def __str__(self) -> str:
         versions = []
         pre_versions = []
 
-        for candidate in sorted(self.candidates_tried):
+        for candidate in sorted(
+            self.candidates_tried, key=operator.attrgetter("version")
+        ):
             version = str(candidate.version)
             if candidate.version.is_prerelease:
                 pre_versions.append(version)


Test patch:
Repository: OBOFoundry/OBOFoundry.github.io

Issue:
travis on master failing, due to metadata violations from new jsonschema checks
There are two things wrong:

 - the validate script assumes a util/reports folder
 - hp is failing; we already know that hp has a custom license and this should be reported elsewhere and is not a schema violation


Discussion:

Resolving patch:
diff --git a/util/validate-metadata.py b/util/validate-metadata.py
--- a/util/validate-metadata.py
+++ b/util/validate-metadata.py
@@ -7,9 +7,9 @@
 import re
 
 # file paths
-data_file = "../registry/ontologies.jsonld"
-schema_file = "metadata-schema.json"
-schema_lite_file = "metadata-schema-lite.json"
+data_file = "registry/ontologies.jsonld"
+schema_file = "util/metadata-schema.json"
+schema_lite_file = "util/metadata-schema-lite.json"
 report_file = "reports/metadata-violations.csv"
 
 # ultra-escaped regex strings


Test patch: