pants: Add st2_*_python_distribution() macros to pants-plugins/macros.py#5901
Merged
cognifloyd merged 5 commits intomasterfrom Feb 16, 2023
Merged
pants: Add st2_*_python_distribution() macros to pants-plugins/macros.py#5901cognifloyd merged 5 commits intomasterfrom
st2_*_python_distribution() macros to pants-plugins/macros.py#5901cognifloyd merged 5 commits intomasterfrom
Conversation
4dd33c0 to
7de8f3c
Compare
rush-skills
approved these changes
Feb 15, 2023
amanda11
approved these changes
Feb 16, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This is another part of introducing pants, as discussed in various TSC meetings.
Related PRs can be found in:
Overview of this PR
This PR adds pants macros that reduce boilerplate around defining
python_distribution():st2_license()st2_component_python_distribution()st2_runner_python_distribution()The next PR will actually add those macros to the relevant BUILD files.
See #5890 for a description of pants macros and what is involved in using them in pants.
st2_license()macroWe need to add a LICENSE file to all of our wheels. When building wheels, we don't have to add any special metadata to the setup.py
setup()call (orpyproject.tomlor similar); we only need to put the LICENSE file in the directory that will be the wheel.st2/pants-plugins/macros.py
Lines 16 to 21 in 7de8f3c
st2_*_python_distribution()macrosThese macros create:
st2_licensemacro.python_artifactobject with the details needed to generate the setup.py kwargs. For example, it includes theversion_filearg which is unique topants-plugins/releasewhich uses this to inject the version based on that file.python_distributiontarget with the metadata for creating the wheel.Using this macro is like creating a
python_distributionlike this in each of the BUILD files:st2_component_python_distribution()macroThis is meant for for our primary components:
st2common,st2auth,st2api,st2client, etc.For example, in the next PR this is how we'll define the
st2apidistribution:st2/st2api/BUILD
Lines 1 to 4 in 7032faf
st2_runner_python_distribution()macroThis is meant for our runners:
contrib/runners/*_runner.For example, in the next PR this is how we'll define the
nooprunner's distribution:st2/contrib/runners/noop_runner/BUILD
Lines 1 to 7 in 7032faf