Skip to content

Commit

Permalink
Warn about strip extras by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhiebert authored Aug 6, 2023
1 parent 9e4aeff commit f1304aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,12 @@ This section lists `pip-tools` features that are currently deprecated.
- In the next major release, the `--allow-unsafe` behavior will be enabled by
default (https://github.com/jazzband/pip-tools/issues/989).
Use `--no-allow-unsafe` to keep the old behavior. It is recommended
to pass the `--allow-unsafe` now to adapt to the upcoming change.
to pass `--allow-unsafe` now to adapt to the upcoming change.
- The legacy resolver is deprecated and will be removed in future versions.
The new default is `--resolver=backtracking`.
- In the next major release, the `--strip-extras` behavior will be enabled by
default (https://github.com/jazzband/pip-tools/issues/1613).
Use `--no-strip-extras` to keep the old behavior.

### A Note on Resolvers

Expand Down
15 changes: 12 additions & 3 deletions piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ def _determine_linesep(
),
)
@click.option(
"--strip-extras",
"--strip-extras/--no-strip-extras",
is_flag=True,
default=False,
default=None,
help="Assure output file is constraints compatible, avoiding use of extras.",
)
@click.option(
Expand Down Expand Up @@ -365,7 +365,7 @@ def cli(
output_file: LazyFile | IO[Any] | None,
newline: str,
allow_unsafe: bool,
strip_extras: bool,
strip_extras: bool | None,
generate_hashes: bool,
reuse_hashes: bool,
src_files: tuple[str, ...],
Expand Down Expand Up @@ -676,6 +676,15 @@ def cli(
strategy=newline, filenames=(output_file.name, *src_files)
)

if strip_extras is None:
strip_extras = False
log.warning(
"WARNING: --strip-extras is becoming the default. "
"To silence this warning, "
"either use --strip-extras to opt into the new default "
"or use --no-strip-extras to retain the existing behavior."
)

##
# Output
##
Expand Down

0 comments on commit f1304aa

Please sign in to comment.