pants
pants copied to clipboard
Add script to identify backends not part of the pants distribution.
These mistakes are done over and over again, and goes undetected for too long.
As a follow up, we could add a check mode and run during CI to catch early. For now, it's merely a conveniency that can be run manually.
Example output (pre #20529):
❯ ./build-support/bin/check_orphaned_plugins.py
These are discovered backends, which are not included in the pantsbuild.pants distribution:
* (internal_plugins.releases - intentionally excluded)
* (internal_plugins.test_lockfile_fixtures - intentionally excluded)
* pants.backend.build_files.fmt.ruff
* pants.backend.experimental.typescript
* (pants_explorer.server - intentionally excluded)
Nice! Is this something we can execute as a Pants test, so it gets run in CI automatically? One idea: a codegen target that exposes the output of peek
, that a normal old pytest (or whatever) test could then depend on.
Interesting idea to have this as a test. I'll look into it!
This is a great idea, and having it run as a test would be good.
My idea of a peek goal target is potentially too hard in the immediate term (although might be nice for users too)... an alternative that lets us start seeing the benefit sooner could be a test that runs outside the sandbox (that is, https://www.pantsbuild.org/2.19/reference/targets/python_test#run_goal_use_sandbox), and so can do things like directly globbing the filesystem for register.py
files and/or parsing the relevant BUILD file (since help-all
output might not be available either?).
I have this working, down to that I failed to run pants
on the repo using adhoc_tool
to get the output as a test resource
, the issue being that I want to run it in-repo rather than in a sandbox (because that caused issues for some reason, iirc)