curved-television-6568
06/16/2022, 2:46 PMbitter-ability-32190
06/16/2022, 2:52 PMproud-dentist-22844
06/16/2022, 3:31 PM<private>
which implicitly prevents the other module from importing it.nice-florist-55958
06/16/2022, 6:36 PMrun
exactly mirror pex_binary
with default execution_mode
? Inspecting the tmp process dir this seems true, but wanted to be completely sure. When setting execution_mode = "venv"
the layout does not change. That's ok, but I want to revise the advice verify applications work using pants run
before merging PRs being given to our developers to _`pants package` and then execute the resulting .pex
file if using non-default execution_mode._happy-kitchen-89482
06/16/2022, 10:03 PMhappy-kitchen-89482
06/16/2022, 10:03 PMhappy-kitchen-89482
06/16/2022, 10:04 PMhappy-kitchen-89482
06/16/2022, 10:11 PMhappy-kitchen-89482
06/16/2022, 10:11 PMproud-dentist-22844
06/17/2022, 12:57 AMproud-dentist-22844
06/17/2022, 1:00 AMrefined-addition-53644
06/17/2022, 9:57 AMresolve
which would show me the resolve(s) for a given target similar to dependencies
?
Or what would be a way to get the resolve for a target?
I am trying to debug a case where the test complains that the source file doesn't have the same resolve even though I have set the same resolve for the test and the source.curved-television-6568
06/17/2022, 10:00 AM./pants peek :tgt
gives you Pants view of things for all targets matching your CLI specs..refined-addition-53644
06/17/2022, 10:08 AMcurved-television-6568
06/17/2022, 10:27 AMwitty-house-77262
06/17/2022, 11:54 AMwitty-house-77262
06/17/2022, 11:55 AMhundreds-father-404
06/17/2022, 2:05 PMpeek
says it's Nonerefined-addition-53644
06/17/2022, 2:09 PMpeek
. I can't find it anywhere in peek's output. I am pretty sure all of them are using the correct resolve.hundreds-father-404
06/17/2022, 2:12 PM[
{
"address": "src/python/pants/util/strutil.py",
"target_type": "python_source",
...
"interpreter_constraints": null,
"resolve": null,
"skip_autoflake": false,
"skip_black": false,
...
}
]
refined-addition-53644
06/17/2022, 2:14 PM[
{
"address": "src/pyfleet-vehicle-spec/tests:tests",
"target_type": "python_tests",
"dependencies": [
"src/pyfleet-vehicle-spec/tests/test_main.py",
"src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py"
],
"description": null,
"overrides": null,
"skip_autoflake": false,
"skip_bandit": false,
"skip_black": false,
"skip_docformatter": false,
"skip_flake8": false,
"skip_isort": false,
"skip_mypy": false,
"sources": [
"src/pyfleet-vehicle-spec/tests/test_main.py",
"src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py"
],
"sources_raw": [
"test_*.py",
"*_test.py",
"tests.py"
],
"tags": null
}
]
refined-addition-53644
06/17/2022, 2:16 PMpython_sources(name="tests", resolve="vehicle_spec")
hundreds-father-404
06/17/2022, 2:18 PMpython_test
target like ./pants src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py
What's going on is that the target generator python_tests
(with an s) "moves" the field to generated targets and doesn't keep it itself. That was necessary for parametrize()
+ overrides
to work properly
cc @witty-crayon-22786, not sure how we could avoid user confusion here. It is definitely nuanced, and currently undocumentedrefined-addition-53644
06/17/2022, 2:18 PM2.11.1rc2
hundreds-father-404
06/17/2022, 2:21 PMpeek
on a target generator, add a key for generated_targets
with a list of the addresses of everything generated
A conceptual change in 2.11 is we leaned more into "target generators solely exist for boilerplate reduction". peek
became less useful for target generators. "atom targets" are where all the interesting stuff happensadamant-umbrella-23142
06/17/2022, 4:28 PMnice-florist-55958
06/17/2022, 5:56 PMrun
. Version is 2.13.0dev5
.
We have a project that contains some pex_binary
targets with default execution_mode
. When I do, e.g., ./pants run ./proj/app/oasmodel:skew
everything works. When another user does it (after pulling the same repo, using the same pants binary, pants.toml
, etc.), the execution crashes from ImportError
once a 3rdparty# dependency is encountered. The skew.pex
are identical (particularly ./.deps
) on first inspection of ./.pands.d/...
. Furthermore, pants package proj/app/oasmodel:skew && ./dist/proj.app.oasmodel/skew.pex
has the same issue.
On the user it does not work for, we tried setting execution_mode = "venv"
on the target, and pants package proj/app/oasmodel:skew && ./dist/proj.app.oasmodel/skew.pex
worked. An even more surprising behavior than ^ occurred when we tried pants run proj/app/oasmodel:skew
-- it worked! But comparing ./.pants.d/venv-mode-run
(venv execution mode) vs. ./pants.d/default-mode-run
(default execution mode), they look basically identical, and .deps
folders both contain the 3rdparty dependencies. As said, the former fails from importing any module exposed by a 3rdparty dist and the latter succeeds. I would not have expected this behavior given that run
does its own thing and doesn't care about exceution_mode
attribute in pex_binary
(or does it to some extent?).
I think my next step is to look where the actual Pex got splayed out on the filesystem (I thought that would be in .pants.d/
when using run
, but I guess it's in $PEX_ROOT/
?) and see how it mapped skew.pex/.deps
Python distributions into actual importable (or lack thereof) modules. But based on what I've seen so far, it does seem like an issue with Pex execution (not Pex building as the builds look the same) -- are there obvious environment setups that would cause the conversion of dists in .deps
into importable modules to fail?
I am in the process of assembling the complete logs and looking at the process outputs more closely. I'll open an issue for that, but wanted to give a heads up here and see if this prompts any ideas. One thing that I am suspicious of is this user was using VSCode Server (Linux) / VS Code (Windows w/ SSH plugin), and in the output I saw lots of unexpected tmp folders Pex was logging w/ -vscode-
labels in the paths. I wonder if the VSCode is doing something to the environment when using the terminal inside the IDE (but I also tried Putty and got the same behavior, though there could be an .env
file in the root causing the same behavior).proud-dentist-22844
06/18/2022, 6:09 AMbright-book-6256
06/18/2022, 9:12 AMbright-book-6256
06/18/2022, 9:57 AM