Pants: add python_distribution BUILD metadata for st2* components#5909
Pants: add python_distribution BUILD metadata for st2* components#5909cognifloyd merged 5 commits intomasterfrom
python_distribution BUILD metadata for st2* components#5909Conversation
| scripts=[ | ||
| "bin/st2actionrunner", | ||
| "bin/st2notifier", | ||
| "bin/st2workflowengine", | ||
| "bin/st2scheduler", | ||
| "bin/runners.sh:shell", # used by service files installed by st2-packaging | ||
| ], |
There was a problem hiding this comment.
Lines 49 to 54 in f115934
Plus I noticed that st2-packaging needs runners.sh, so I included that as well.
| @@ -0,0 +1,4 @@ | |||
| st2_component_python_distribution( | |||
| component_name="st2api", | |||
| scripts=["bin/st2api"], | |||
| scripts=["bin/st2auth"], | ||
| entry_points={ | ||
| stevedore_namespace("st2auth.sso.backends"): { | ||
| "noop": "st2auth.sso.noop:NoOpSingleSignOnBackend", | ||
| }, | ||
| }, |
| entry_points={ | ||
| "console_scripts": { | ||
| "st2": "st2client.shell:main", | ||
| }, | ||
| }, |
| scripts=[ | ||
| # some scripts in bin are only for development and should not be included. | ||
| "bin/st2-bootstrap-rmq", | ||
| "bin/st2-cleanup-db", | ||
| "bin/st2-register-content", | ||
| "bin/st2-purge-executions", | ||
| "bin/st2-purge-workflows", | ||
| "bin/st2-purge-task-executions", | ||
| "bin/st2-purge-tokens", | ||
| "bin/st2-purge-trigger-instances", | ||
| "bin/st2-purge-traces", | ||
| "bin/st2-purge-rule-enforcements", | ||
| "bin/st2-generate-symmetric-crypto-key", | ||
| "bin/st2-track-result", | ||
| "bin/st2-validate-pack", | ||
| "bin/st2-validate-pack-config", | ||
| "bin/st2-pack-install", | ||
| "bin/st2-pack-download", | ||
| "bin/st2-pack-setup-virtualenv", | ||
| "bin/migrations/v3.5/st2-migrate-db-dict-field-values", | ||
| "bin/st2-run-pack-tests:shell", | ||
| "bin/st2ctl:shell", | ||
| "bin/st2-self-check:shell", | ||
| # dev scripts we might want to include | ||
| # "bin/st2-generate-schemas", | ||
| ], | ||
| entry_points={ | ||
| stevedore_namespace("st2common.metrics.driver"): { | ||
| "statsd": "st2common.metrics.drivers.statsd_driver:StatsdDriver", | ||
| "noop": "st2common.metrics.drivers.noop_driver:NoopDriver", | ||
| "echo": "st2common.metrics.drivers.echo_driver:EchoDriver", | ||
| }, | ||
| stevedore_namespace("st2common.rbac.backend"): { | ||
| "noop": "st2common.rbac.backends.noop:NoOpRBACBackend", | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Lines 50 to 82 in f115934
A few of the scripts were missing in setup.py, so I included them here. Also, a couple of them were missing the execute bit, so I added that as well.,
| scripts=[ | ||
| "bin/st2-rule-tester", | ||
| "bin/st2-trigger-refire", | ||
| "bin/st2rulesengine", | ||
| "bin/st2sensorcontainer", | ||
| "bin/st2garbagecollector", | ||
| "bin/st2timersengine", | ||
| ], |
| @@ -0,0 +1,4 @@ | |||
| st2_component_python_distribution( | |||
| component_name="st2stream", | |||
| scripts=["bin/st2stream"], | |||
|
#5906 should be merged first |
7016ce7 to
4dd0184
Compare
amanda11
left a comment
There was a problem hiding this comment.
Why are st2common/bin/st2-purge-task-executions and st2common/bin/st2-purge-workflows now empty files?
Is that github just showing it odd in PR, and all you've done is change the permissions on the file?
|
Yeah. That's just GitHub being weird as I only changed the execute bit, not the file contents. If you do a "view file" on those, you'll see the file contents. |
4dd0184 to
c3615b5
Compare
tag with stevedore_namespace so that once we enable the pants-plugin for stevedore, pants can install things appropriately for tests to access the setuptools metadata.
c3615b5 to
083fd00
Compare
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 the
st2_component_python_distribution()macro to the BUILD metadata for all of our components (st2common,st2client,st2auth, etc).Thanks to the macro, we only have to define 3 (or 4) parameters for each runner:
component_name,scripts, andentry_points. I copied the scripts and entry_points from thesetup.pyfile, which will become obsolete once pants can generate the setup.py file for us.Under
entry_points, I have "tagged" thest2auth.sso.backends, thest2common.metrics.driverand thest2common.rbac.backendcategories asstevedore_namespaces. Once we switch to 2.16 and enable thepants.backend.experimental.python.framework.stevedoreplugin, thestevedoreplugin will, for tests, use this "tag" to look up which wheels implement a plugin in that stevedore namespace.To facilitate comparison, I will add a comment to each of the files that shows the current
setup.pyentry_points and scripts.Next steps
Follow-up PRs will adjust the dependencies on the
python_distributions to ensure all files get included.