polite-garden-50641
04/08/2021, 7:37 PMfast-nail-55400
04/28/2021, 5:54 PMsrc/python/pants/backend/terraform/tffmt.py:21: note: In module imported here:
src/python/pants/engine/process.py: note: In class "InteractiveRunner":
src/python/pants/engine/process.py:334:2: error: Cannot determine type of
'side_effecting' [has-type]
@side_effecting
^
fast-nail-55400
05/04/2021, 7:48 PMplain-sundown-25537
05/05/2021, 9:12 PMbig-xylophone-43403
05/13/2021, 5:08 AMProcess
to read tags and populate the version
kwarg. However, I’m not sure what input_digest
and/or working_dir
should be provided to the Git process 🧵proud-dentist-22844
05/13/2021, 6:22 PM./pants test
goal) to ensure that services are running. If they are not, then it should bail with helpful instructions on setting up the developer environment.
new target: service
depend on it from python_tests target:
service(name="service-mongo", ... other metadata describing the service here ...)
python_tests(
name="tests",
dependencies=["//:service-mongo"],
)
Then, we add an @rule
with targets: Targets
in the input that filters down to the service
targets. That rule can use Process
or similar to check for that the service is running.
then rules()
would return [*collect_rules(), UnionRule(TestFieldSet, AssertServiceRequest)]
I think?
But is there a way to insert my rule so that it has to run first, before pytest? Am I in the ballpark?proud-dentist-22844
05/13/2021, 6:24 PMpython_tests
called service_dependencies
, but however it is defined, I'm still not sure how to add this pre-pytest step.proud-dentist-22844
05/13/2021, 11:52 PMpants_requirement(name="pants", dist="pantsbuild.pants")
in pylint-plugins/BUILD
as recommended in the docs.
But now, I'm getting an ugly error when I try to regen constraints:
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.5.0rc2 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 1.29.0, 1.30.0, 1.30.1, 1.30.2, 1.30.3, 1.30.4rc0, 1.30.4, 1.30.5rc0, 2.0.0a0, 2.0.0a1, 2.0.0a2, 2.0.0a3, 2.0.0b0, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0rc3, 2.0.0, 2.0.1rc0, 2.0.1rc1, 2.0.1rc2, 2.0.1rc3, 2.0.1rc4, 2.0.1, 2.0.2rc0, 2.0.2, 2.1.0.dev0, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0rc3, 2.1.0, 2.1.1rc0, 2.1.1rc1, 2.1.1rc2, 2.1.1, 2.1.2rc0, 2.1.2)
ERROR: No matching distribution found for pantsbuild.pants==2.5.0rc2
Any ideas on what to do for that?proud-dentist-22844
05/14/2021, 8:25 PMdistro
in a plugin (in an @_uncacheable_rule
)?
https://pypi.org/project/distro/
https://github.com/nir0s/distro/blob/master/distro.py
Looks like it runs these basic commands: uname -rs
lsb_release -a
It also accesses a variety of files like /etc/os-release
.
Would I shoot myself in the foot by using this?proud-dentist-22844
05/14/2021, 8:29 PMIt is not safe to usehttps://www.pantsbuild.org/v2.5/docs/rules-api-processlike you normally would because this can break caching and will not leverage Pants's parallelism.subprocess.run()
enough-analyst-54434
05/14/2021, 8:29 PMenough-analyst-54434
05/14/2021, 8:30 PMfast-nail-55400
05/14/2021, 8:31 PMfast-nail-55400
05/14/2021, 8:31 PMenough-analyst-54434
05/14/2021, 8:32 PMenough-analyst-54434
05/14/2021, 8:32 PMproud-dentist-22844
05/14/2021, 8:33 PMenough-analyst-54434
05/14/2021, 8:33 PMproud-dentist-22844
05/14/2021, 8:34 PMenough-analyst-54434
05/14/2021, 8:34 PMenough-analyst-54434
05/14/2021, 8:34 PMproud-dentist-22844
05/14/2021, 8:34 PMenough-analyst-54434
05/14/2021, 8:35 PMawait Get(ProcessResult, Process(...))
- not subprocess.enough-analyst-54434
05/14/2021, 8:36 PMproud-dentist-22844
05/14/2021, 8:37 PMproud-dentist-22844
05/14/2021, 8:37 PMenough-analyst-54434
05/14/2021, 8:37 PMfast-nail-55400
05/14/2021, 8:37 PMYou’re saying to write a “script” (a pex) and shell out to it from within the plugin?there are some existing examples in the pants source code of a plugin writing a script to a digest and then invoking it with the Process-realted rules.
fast-nail-55400
05/14/2021, 8:37 PMfast-nail-55400
05/14/2021, 8:38 PM