Is there a good way to verify that a specific part...
# plugins
b
Is there a good way to verify that a specific part of a test process has executed? I have a test/build step that requires some c++ code being cythonized and wrapped into a wheel file so other python code can pull that in and use the c++ during run time. I've used
-ldebug
to get some meaningful output, see that pants creates a fingerprint for the c++ code and the pants plugin that we have to cythonize things, however I don't get confirmation that the process to actually compile the c++ code worked. It doesn't appear to have been called during the test process, which leads to tests failing later on.
h
do you know if the process is running at all? it can be helpful to use
--no-local-cache --no-pantsd
to debug
b
I'll try those. So far I don't see anything about whether the plugin ran or not. I'll re-run with those args and let you know. Thanks!
🤞 1
Running the test I am not seeing the library being called at all. I would've expected a couple of strings but can't find them in terminal.
h
oh wait is this pants v1?
b
No, this is v2
👍 1
V1 works just fine on a different branch
h
How does your plug-in work? Is it codegen?
b
Yeah
And it's supposed to call a setup.py in a git submodule, and cythonize parts of the c++ base and package that up into a .so file so other python code can import that
h
what if you use
./pants export-codegen ::
?
b
engine v2 (running pants 1.30) says that's not a goal
Sorry if that added to the confusion
h
ohhhhhh so this is Pants 1.30 but using the v2 engine? Got it! I didn't think 1.30 had a plugin hook for codegen for the v2 engine?
It looks like 2.0 for sure has the hook: https://www.pantsbuild.org/v2.0/docs/plugins-codegen
b
We've used a similar plugin (recently updated it to use engine v2) for a long time. Last working version for this plugin was pants 1.28.
h
oh cool nevermind, ignore me. we did have the codegen hook w/ 1.30 🎉 only not documented
yeah
export-codegen
goal did not exist in 1.30
b
Ah ok. The plugin we have is
SimpleCodegenTask
type if that helps.
h
How are you handling v1 vs v2? Are you running some parts of repo with one versus the other? Or using a branch it sounds like? the v1 plugin will not apply when v2 is being used, and vice versa
b
I'm working on trying to get everything to use pants 1.30 and engine version 2. The branch I was mentioning has pants 1.28 and engine v1, and that can build the same code that's failing with the pants 1.30 engine v2 setup.
If I need to jump to pants 2.X, then I can try that, but wanted to go to 1.30 so there wouldn't be too many big changes (in theory of course)
h
I recommend first going to 1.30 but using the v1 engine still. Land it so that you have fewer changes to deal with, even if that is short-term
b
Ok. Can I use the v1 engine for a specific BUILD and it's dependencies? Or would the entire code base have to use v1
h
the v2 engine is much better in 2.0 than 1.30, and kept (keeps) getting better from there, including performance improvements. We generally recommend upgrading one version at a time because then you get deprecation messages, like 2.0 to 2.2. You don't necessarly have to land those changes, but at least get it working locally: https://www.pantsbuild.org/docs/upgrade-tips Going from 1.30 to 2.x is a little tricky on which version to target. Honest truth is that I think 2.0 v2 engine is a big improvement over 1.30 v1 engine, but it really has gotten much better since then. I still think I'd recommend trying to get green CI on 2.0 v2 engine, then deciding if you want to bump to newer 2.x versions
an I use the v1 engine for a specific BUILD and it's dependencies?
Yeah, you can use a "mixed mode" as described here: https://www.pantsbuild.org/v2.4/docs/how-to-upgrade-pants-2-0#step-2-setup-jvm-node-and-go-support-if-relevant. But if your repo is all Python, that is unlikely to be a good approach as it can be hard/confusing to navigate both - the boudnary is less clear
b
Yeah I've been going version by version and had success until I tried 1.30 and the issues in this thread. I'm running a test with engine v1 so hopefully that works.
🤞 1
h
Cool. Glad to hear you're upgrading! We believe it's a substantially better experience, including thanks to dependency inference (on avg, 90% of BUILD file content gets deleted). Ack that upgrading takes some work 😕 we definitely are happy to help though
b
I appreciate the help! So far the test using engine v1 is actually doing what I need whereas engine v2 wasn't. So that's definitely progress for my POV. If we wanted to keep forging down the path to get as up to date as possible, would you recommend trying pants 2.X and continue bumping the version then once we're as far down that past as we want trying to bump the engine version? This is my first experience upgrading pants, so I'm not sure what order of operations are here
🙌 1
h
Awesome! So the big change with 2.0+ is it drops the v1 engine. To either use v2 in 1.30 or to use 2.0+, you will have to rewrite your plugin to use the v2 API How much of your repo uses this plugin? I'm wondering how feasible it will be to migrate most of your repo to 2.0 and then save the plugin rewrite for a later step. It will all have to be the same PR, but you can split it up into stages to be simpler
And bump that before you do any v2 stuff, I recommend landing the 1.30 upgrade into
main
b
Ah gotcha, rewriting the plugin may take a bit of work to get right. There are only a couple things out of the entire code base that use it, coming up with a split would work if that's what we needed to do to get past 1.X. Worth considering though
h
https://www.pantsbuild.org/v2.4/docs/how-to-upgrade-pants-2-0 is the general upgrade guide for 2.0. When you are ready for working on the plugin, we seriously are really happy to help and we've pair programmed w/ people in the past. We mean this:
We don't want having to port your plugins to block you from upgrading to 2.0.