-
-
Notifications
You must be signed in to change notification settings - Fork 638
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 python_requirements
and poetry_requirements
using old macro in favor of target generation
#14075
Deprecate python_requirements
and poetry_requirements
using old macro in favor of target generation
#14075
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -1268,6 +1268,24 @@ def register_bootstrap_options(cls, register): | |||
"may not be enabled.", | |||
) | |||
|
|||
register( | |||
"--use-deprecated-python-macros", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this flag will land as un-deprecated, it's starting out misnamed. Maybe invert to --use-new-python-macros
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh I don't think it matters much. But in my head, it makes sense to see this in pants.toml
:
[GLOBAL]
use_deprecated_python_macros = false
It makes clear that you're opting out of deprecated functionality. Technically, the macros aren't yet formally deprecated. But in spirit, they are deprecated. It's only a logistical reason why we can't formally deprecate them more quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. What does the alternative look like..
[GLOBAL]
use_new_python_macros = true
Makes it clear that you're opting in to use the new macros before that is the default thing.
Hmm.. nah, that option name is more wrong, the new thing is not macros at all..
…f `sources: list[str]` (#14082) To minimize behavior changes while implementing #14075, we want to make sure that `--changed-since=HEAD --changed-dependees=direct` will still claim that all generated `python_requirement` targets are impacted if the `requirements.txt` changed. This would happen naturally if a generated target depended on its target generator: #13118. But that will require a lot more design work and is a big change we're not ready to make. So we can work around this by still having `_python_requirements_file` even with target generators. But before doing that, we should change to `source: str` to actually represent the expected API of the target. Because this is a private API, we make a breaking change. [ci skip-rust] [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
[ci skip-rust] [ci skip-build-wheels]
a837300
to
66ba6f9
Compare
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
66ba6f9
to
235f591
Compare
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
python_requirements
and poetry_requirements
using old macro in favor of target generationpython_requirements
and poetry_requirements
using old macro in favor of target generation
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Bump @stuhood, this needs a re-review as it was approved while still a WIP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
|
||
use_deprecated_python_macros = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still weird to me (seems like a double-negative), but oh well!
…enerators [ci skip-rust] [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
"2.11.0.dev0", | ||
"the option `--use-deprecated-python-macros` defaulting to true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that would be good to fix before 2.10.0
is that this warning currently triggers in repos without the python backend enabled.
Closes #12915.
Benefits of switching to target generation
./pants help
.Deprecation plan
This PR adds a new global option
--use-deprecated-python-macros
with a default ofTrue
. When True,parser.py
is taught to load the old macros; else it loads the new targets.The PR deprecates the default of
--use-deprecated-python-macros
so that it will default toFalse
in Pants 2.11. Then, we'll deprecate the option outright and remove it in Pants 2.12, meaning the macros will be removed then too.How users upgrade