Skip to content
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

Deprecate the old export semantics. #17465

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/python/pants/backend/python/goals/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import logging
import os
import textwrap
import uuid
from collections import defaultdict
from dataclasses import dataclass
Expand All @@ -18,6 +19,7 @@
from pants.backend.python.util_rules.pex_environment import PexEnvironment
from pants.backend.python.util_rules.pex_from_targets import RequirementsPexRequest
from pants.backend.python.util_rules.pex_requirements import EntireLockfile, Lockfile
from pants.base.deprecated import warn_or_error
from pants.core.goals.export import (
Export,
ExportError,
Expand Down Expand Up @@ -370,7 +372,19 @@ async def export_virtualenvs(
)
return ExportResults(mv.result for mv in maybe_venvs if mv.result is not None)

# TODO: Deprecate this entire codepath.
# TODO: After the deprecation exipres, everything in this function below this comment
# can be deleted.
warn_or_error(
"2.23.0.dev0",
"exporting resolves without using the --resolve option",
textwrap.dedent(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think softwrap is the universal thing to use now.

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason that didn't look right when rendered. I'll fiddle with it in a future change, doesn't seem worth a CI round.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we use softwrap because it adjusts to the users' terminal size dynamically, e.g. huge 500 character columns. textwrap is instead based on the length of the source code.

f"""
Use the --resolve flag one or more times to name the resolves you want to export,
and don't provide any target specs. E.g.,\n
`{bin_name()} export --resolve=python-default --resolve=pytest`
"""
),
)
resolve_to_root_targets: DefaultDict[str, list[Target]] = defaultdict(list)
for tgt in request.targets:
if not tgt.has_field(PythonResolveField):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ def __new__(cls):
return super().__new__(
cls,
default=True,
removal_version="2.23.0.dev0",
removal_hint="Use the export goal's --resolve option to select tools to export, instead "
"of using this option to exempt a tool from export-by-default.",
help=(
lambda subsystem_cls: softwrap(
f"""
Expand Down