pants icon indicating copy to clipboard operation
pants copied to clipboard

Add script to identify backends not part of the pants distribution.

Open kaos opened this issue 1 year ago • 6 comments

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)

kaos avatar Feb 14 '24 20:02 kaos

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.

huonw avatar Feb 14 '24 22:02 huonw

Interesting idea to have this as a test. I'll look into it!

kaos avatar Feb 15 '24 07:02 kaos

This is a great idea, and having it run as a test would be good.

benjyw avatar Feb 16 '24 00:02 benjyw

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?).

huonw avatar Feb 21 '24 19:02 huonw

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)

kaos avatar Feb 22 '24 08:02 kaos