ripe-gigabyte-88964
10/02/2023, 4:15 PMMultipleSourcesField
where I just provide the default
field. However, in pants peek
no sources are listed, I just see sources_raw
. Do I need to write custom code to hydrate the sources?gorgeous-winter-99296
10/07/2023, 9:06 AME No installed rules return the type GenerateCargoTargetsRequest, and it was not provided by potential callers of @rule(pants_cargo_porcelain.target_types:172:generate_cargo_generated_target(GenerateCargoTargetsRequest, RustSubsystem, RustupTool) -> GeneratedTargets, gets=[Get(SourceFiles, [SourceFilesRequest]), Get(RustToolchain, [RustToolchainRequest]), Get(ProcessResult, [CargoProcessRequest])]).
My runner is dumb as rocks:
rule_runner = RuleRunner(
rules=[
*register.rules(),
*clippy_register.rules(),
QueryRule(Partitions, [CargoClippyRequest.PartitionRequest]),
# QueryRule(LintResult, [CargoClippyRequest.Batch]),
],
target_types=register.target_types(),
)
Which at this point is everything in the plugin. register.rules()
bundles the following from my target types.
def rules():
return [
*collect_rules(),
UnionRule(GenerateTargetsRequest, GenerateCargoTargetsRequest),
]
But I'm guessing this happens "one step up" where something has to do a union lookup...gorgeous-winter-99296
10/10/2023, 9:05 PMdry-orange-3870
10/12/2023, 2:34 PMcontent = FileContent(path=versions_file_path, content="some string")
digest = await Get(Digest, CreateDigest([content]))
That resulted in the infamous Filesystem changed during run: retrying 'MyGoal'
infinite loop. I was really confused. Upon further inspection of the run logs, I found this:
09:14:56.95 [31m[ERROR][0m panic at 'called `Result::unwrap()` on an `Err` value: "Field `content` was not convertible to type alloc::vec::Vec<u8>: PyErr { type: <class 'TypeError'>, value: TypeError(\"'str' object cannot be interpreted as an integer\"), traceback: None }"', src/intrinsics.rs:422
So I updated the code above to call .encode()
on the string before passing it as content
and things started working. However, I feel like my mistake should have resulted in an error / failure instead of the infinite Filesystem changed
loop. Should I open a bug for this?helpful-rocket-63313
10/16/2023, 4:56 PMgrpc-gateway
, https://github.com/grpc-ecosystem/grpc-gateway can generate a REST API for grpc services, but it has to be generated in go. This means changing/modifying https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/codegen/protobuf/go/rules.py codegen.protobuf.go
.
My current approach is, to copy the official source code of codegen.go.protobuf.rules to local pants_plugin
, and use this custom code generator. For this custom plugin, I am generating a local go.mod
and go.sum
which includes grpc-gateway
packages, and any relevant changes like downloading binaries (https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/codegen/protobuf/go/rules.py#L596) or adding plugin here https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/codegen/protobuf/go/rules.py#L500
Do you think it's the right approach ? If yes, then do you think this can/should be added to official code generator(controlled by some variable, like generate_grpc_gateway)? If yes, then once I have my local plugging stabilized, I can create a PR.ripe-gigabyte-88964
10/24/2023, 3:17 PMAddress
objects are equivalent if one is relative and one is absolute? I tried comparing their address.spec
, which documentation claims will prepend //
to any build root level targets, but I am not seeing that behavior in actuality, the relative specs are still missing the //
.famous-xylophone-36532
10/25/2023, 10:42 AMgorgeous-winter-99296
10/26/2023, 7:42 AMrustup
crashing out because of that.ripe-gigabyte-88964
10/26/2023, 2:47 PMTargetRootsToFieldSets
- what am I missing here?
10:45:22.46 [ERROR] 1 Exception encountered:
Engine traceback:
in select
..
in plugins.splat.goals.my_plugin_goal
`my-plugin-goal` goal
Traceback (most recent call last):
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 626, in native_engine_generator_send
res = rule.send(arg) if err is None else rule.throw(throw or err)
File "/Users/nick.dellosa/Projects/data-platform/pants-plugins/plugins/myplugin/goals.py", line 385, in splat_deploy
target_roots_to_splat_deploy_field_sets = await Get(
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 118, in __await__
result = yield self
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 626, in native_engine_generator_send
res = rule.send(arg) if err is None else rule.throw(throw or err)
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/engine/internals/specs_rules.py", line 552, in find_valid_field_sets_for_target_roots
field_set_types=union_membership[request.field_set_superclass],
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/engine/unions.py", line 134, in __getitem__
return self.union_rules[union_type] # type: ignore[return-value]
File "/Users/nick.dellosa/Library/Caches/nce/4ce2ab7b680d1a68593ba94c1a1eb8a45d8b6cc2fd7c215163282f168119ea3d/bindings/venvs/2.18.0.dev7/lib/python3.9/site-packages/pants/util/frozendict.py", line 77, in __getitem__
return self._data[k]
KeyError: <class 'plugins.myplugin.targets.MyPluginFieldSet'>
colossal-fish-7635
10/27/2023, 4:36 PMfamous-xylophone-36532
10/31/2023, 3:32 PMpants publish :my-target
. But nothing happens! How do I know if Pants is actually running my rule? If I comment out the rule Pants complains about missing paths from all of the other kinds of publishable targets in my repo (Docker image and Helm chart).famous-xylophone-36532
11/01/2023, 4:12 PMripe-gigabyte-88964
11/01/2023, 5:53 PMfamous-xylophone-36532
11/03/2023, 12:38 PMgorgeous-winter-99296
11/03/2023, 2:35 PMfamous-xylophone-36532
11/06/2023, 3:01 PMproud-dentist-22844
11/07/2023, 12:54 AMname <email@domain>
. Validating email seems like a pretty common thing, but a quick search for email in the pants codebase didn’t turn up anything. Are there any helpful utils I should use? Or is regex the way to go?famous-xylophone-36532
11/08/2023, 11:49 AMproud-dentist-22844
11/08/2023, 4:06 PMhelp_text
strings. Are there any other help texts that do that? Would it be formatted like a markdown table?broad-processor-92400
11/09/2023, 3:03 AMrequirements.txt
next to register.py
, or even with [GLOBAL].plugins
.
Background: I just realised today that the plugins = ["hdrhistogram"]
line we have in our pants.ci.toml
on recommendation from https://www.pantsbuild.org/docs/using-pants-in-ci seems to be unpinned.
Presumably I could go and replace everything with transitively pinned ==
requirements, but that feels... unsatisfying; is there another way?proud-dentist-22844
11/09/2023, 6:55 PMnumerous-apartment-3919
11/09/2023, 10:11 PMinterpreter_constraints = ['==3.10.*']
from pants.toml
but I am having a hard time wrapping my head around the interpreter requirements for pants itself. I can't ever seem to generate lockfiles as no candidate of pants
is available for python 3.10. I've tried setting an interpreter-constraints = ['==3.9.*']
on the python_sources
in the plugin build file but it had no effect. Is there a more complete example I could look at?gorgeous-winter-99296
11/10/2023, 5:05 PMbinary_crate -> workspace -> {all_member_packages}
. However, for "non-output" targets it becomes weird. For example, clippy
operates on a package but needs the whole workspace. So then we get package -> workspace -> {all_member_packages}
- and those member packages then depend back on the package we're analysing via the workspace. I can definitely solve this by just adding more indirection, but having a specific target just for linting feels conceptually wrong.
Maybe @fast-nail-55400 has some thoughts from working with go?dry-orange-3870
11/16/2023, 7:44 PMpants.backend.python.goals.setup_py
with `package_dists`; looks like the file was refactored in see this commit.
However, I still have one test that is failing. The output looks something like this:
E ValueError: Encountered 27 rule graph errors:
E No installed rules return the type AddPrefix, and it was not provided by potential callers of @rule(<intrinsic>(AddPrefix) -> Digest).
E If that type should be computed by a rule, ensure that that rule is installed.
E If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
E No installed rules return the type CreateArchive, and it was not provided by potential callers of @rule(pants.core.util_rules.archive:47:create_archive(CreateArchive) -> Digest, gets=[Get(Digest, [CreateDigest]), ZipBinary, BashBinary, TarBinary, Get(Digest, [MergeDigests]), Get(ProcessResult, [Process])]).
E If that type should be computed by a rule, ensure that that rule is installed.
E If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
E No installed rules return the type CreateDigest, and it was not provided by potential callers of @rule(<intrinsic>(CreateDigest) -> Digest).
E If that type should be computed by a rule, ensure that that rule is installed.
E If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
...
Any ideas on what other changes might be causing this?gorgeous-winter-99296
11/21/2023, 9:48 PM@rule(desc="Find all cargo packages in project")
def find_all_cargo_targets(all_targets: AllTargets) -> AllCargoTargets:
...
@rule(desc="Assign packages to workspaces")
async def assign_packages_to_workspaces(
all_cargo_targets: AllCargoTargets,
) -> CargoPackageMapping:
...
And I'm now implementing a new goal; generate-lockfiles
, which should make use of this.
@rule
async def determine_rust_user_resolves(
_: KnownCargoUserResolveNamesRequest,
cargo_targets: AllCargoTargets,
) -> KnownUserResolveNames:
...
works, but if I replace the second argument with a CargoPackageMapping
or try to query for one inside that rule, it breaks the rule graph. I'm assuming this is because of something that the assign_package_to_workspaces
rule does, but the only things it looks for is SourceFiles
, DigestContents
, and RawSpecs
. Neither of those should - I think? - need resolves to be known. Or maybe they do, in order to validate fields..?gorgeous-winter-99296
11/21/2023, 10:23 PMdry-orange-3870
11/28/2023, 11:18 PMVenvPexProcess
and ProcessResult
. Currently, we just do this after we get the `ProcessResult`:
print(result.stdout.decode())
print(result.stderr.decode())
This is great and all, but is there a way to output log lines as they're being produced? This would be super useful for long-running processesdry-orange-3870
11/29/2023, 10:12 PMawait Get(ProcessResult, CRequest....)
to call rule C
. C
has dependencies on other rules, but they're all rules that are provided by pants; none of them are custom rules from our repo. Until today, A
didn't depend on any other rules. Everything has been working quite well.
Today, I updated A
to depend on C
in the same way that B
depends on C
. However, this is resulting in rule graph errors anytime I run any pants commands. I'll attach the stacktrace in the thread, but the main error message is this: ValueError: Encountered 225 rule graph errors:
. However, the exact number of alleged rule graph errors is random; rerunning the same command potentially produces a different number of rule graph errors than the previous run even if I don't make any changes.
If I comment out the await Get(ProcessResult, CRequest...)
line in A
, the rule graph errors go away and pants is happy again. I've tried adding the -ldebug --print-stacktrace
flags, but this doesn't result in any additional helpful output being produced.
Any ideas on what's happening here? I'm really confused as
(1) calling this rule from B
is fine but causes everything to start on fire when I try to use it from A
(2) nothing is calling this function yet. Is pants scanning the source code of each rule function in order to infer dependencies?dry-orange-3870
12/05/2023, 10:26 PMcurved-manchester-66006
12/06/2023, 4:22 PM