Is there any way to stop coursier from running whe...
# development
w
Is there any way to stop coursier from running when I don't need the deps it provides?
Copy code
⏺ oss/pants-pyright % ./pants --changed-since=origin/main fmt                                                                                ⎇ 17557-npx-dep-version*
⠠ 107.83s Fetching with coursier: org.scala-lang:scala-reflect:2.13.7
⠤ 107.73s Fetching with coursier: org.jline:jline:3.20.0
⠤ 107.73s Fetching with coursier: org.scalameta:scalafmt-interfaces:3.2.1
⠤ 107.73s Fetching with coursier: org.scala-lang.modules:scala-parallel-collections_2.13:1.0.4
⠤ 107.73s Fetching with coursier: org.scala-lang:scala-compiler:2.13.7
That went up to 3000 seconds before I cancelled it yesterday, and I'm formatting 3 python files in the nodejs backend
This has been a semi-common occurrence in my plugin work, where this stuff runs and basically "breaks" my Pants instance, and I can't run certain goals anymore
c
besides toggle the jvm off, that seems very broken..
w
besides toggle the jvm off
Like remove the backend packages?
Ha! I forgot about this when I went to some meetings. VERY broken
This happens every month or so. I basically wipe everything pants-centric and start again
c
> besides toggle the jvm off
Like remove the backend packages?
can’t you disable the jvm backend?
Copy code
─❯ ./pants global --help-advanced | grep backend
  --backend-packages="['<str>', '<str>', ...]"
  PANTS_BACKEND_PACKAGES
  backend_packages
      default: []
      current value: [
          "pants.backend.build_files.fix.deprecations",
          "pants.backend.build_files.fmt.black",
          "pants.backend.python",
          "pants.backend.experimental.python.packaging.pyoxidizer",
          "pants.backend.explorer",
          "pants.backend.python.lint.autoflake",
          "pants.backend.python.lint.black",
          "pants.backend.python.lint.docformatter",
          "pants.backend.python.lint.flake8",
          "pants.backend.python.lint.isort",
          "pants.backend.python.typecheck.mypy",
          "pants.backend.python.mixed_interpreter_constraints",
          "pants.backend.shell",
          "pants.backend.shell.lint.shellcheck",
          "pants.backend.shell.lint.shfmt",
          "pants.backend.docker",
          "pants.backend.docker.lint.hadolint",
          "pants.backend.experimental.go",
          "pants.backend.experimental.java",
          "pants.backend.experimental.java.lint.google_java_format",
          "pants.backend.experimental.java.debug_goals",
          "pants.backend.experimental.python",
          "pants.backend.experimental.python.packaging.pyoxidizer",
          "pants.backend.experimental.scala",
          "pants.backend.experimental.scala.lint.scalafmt",
          "pants.backend.experimental.scala.debug_goals",
          "internal_plugins.releases",
          "internal_plugins.test_lockfile_fixtures"
      ] (from pants.toml)
      Register functionality from these backends.
Copy code
╰─❯ ./pants --backend-packages="-['pants.backend.experimental.java', 'pants.backend.experimental.java.lint.google_java_format', 'pants.backend.experimental.java.debug_goals']" global --help-advanced | grep backend
10:41:43.77 [INFO] Initialization options changed: reinitializing scheduler...
10:41:45.08 [INFO] Scheduler initialized.
  --backend-packages="['<str>', '<str>', ...]"
  backend_packages
          "pants.backend.build_files.fix.deprecations",
          "pants.backend.build_files.fmt.black",
          "pants.backend.python",
          "pants.backend.experimental.python.packaging.pyoxidizer",
          "pants.backend.explorer",
          "pants.backend.python.lint.autoflake",
          "pants.backend.python.lint.black",
          "pants.backend.python.lint.docformatter",
          "pants.backend.python.lint.flake8",
          "pants.backend.python.lint.isort",
          "pants.backend.python.typecheck.mypy",
          "pants.backend.python.mixed_interpreter_constraints",
          "pants.backend.shell",
          "pants.backend.shell.lint.shellcheck",
          "pants.backend.shell.lint.shfmt",
          "pants.backend.docker",
          "pants.backend.docker.lint.hadolint",
          "pants.backend.experimental.go",
          "pants.backend.experimental.python",
          "pants.backend.experimental.python.packaging.pyoxidizer",
          "pants.backend.experimental.scala",
          "pants.backend.experimental.scala.lint.scalafmt",
          "pants.backend.experimental.scala.debug_goals",
      Register functionality from these backends.
w
I was just confirming what you meant by toggle the jvm off.. yep, testing that shortly to see what happens
👍 1
c
Ah, misread your “remove backend” as actually removing the sources… 🤣
w
Delete.... EVERYTHING!!!!!!!
😬 1
So yeah, can't remove the scala backend, but I CAN remove the scala formattter
And, instead of 3000 seconds, took about 3
Ugh... maybe not
Copy code
pants.engine.target.InvalidFieldException: Unrecognized field `skip_scalafmt=True` in target src/python/pants/backend/scala/dependency_inference:scala_parser. Valid fields for the target type `scala_sources`: ['dependencies', 'description', 'experimental_provides_types', 'jdk', 'overrides', 'resolve', 'scalac_plugins', 'sources', 'tags'].
🫠 1
b
Oh huh thought
What if this is due to partitioning?
SJ have you filed a bug? Have time for debugging?
c
w
So, two surprises here. I is the actual
coursier
-centric "bug"? Still determining what's going on. The other is that, removing the scalafmt from the backend packages still caused an issue during
lint
I believe.
c
The other is no surprise, if you’re using fields in your BUILD files that comes from a disabled backend, expect issues..
1
w
🙂 True, but! Isn't this one a weird one? I've skipped/disabled scalafmt globally, and can no longer use Pants because I want to... skip ... scala... formatting.... .....
♾️ 1
♾️
b
Pantsoboros? Ouropantsos?
w
Pants 3.0 aka Jörmungandr
so even though you’re asking to not use scala, there’s still scala fields in use in the active set of BUILD files pants is working on..
ah, well weird UX maybe yes…. ok ♾️
w
Yeah, technically makes sense - but UX feels a bit janky. This is actually part of a bigger discussion that I'm not sure how I feel about - where I wonder if BUILD files without the correct backend should be so strict, unless something is specifically intended to be run in the dependency chain or via
::
But that's more just spitballing
b
FWIW I want general goal fields. (E.g. "skip_fmt") which might've been intended here
Still possibly to ignore unknown fields. @wide-midnight-78598 feel free to file a request
w
Yep, I'm working on a UX doc for next month's meeting, so just collecting some anecdotes as we run into them. A general
skip_goal
I think makes more sense here, rather than
skip_this_backendoption_which_may_not_be_registered
Wait... no... that still doesn't work
I might want to skip only one of many formatters/linters... Womp womp 😢
I guess the fact that the formatter isn't registered definitely means that the
skip_scalafmt
is useless in that case though, so 🤷
b
I think there's 2 here: • General fields for skipping goals • Allow "unknown" fields