question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The PEX_TOOLS venv `--compile` option should ignore compile errors.

See original GitHub issue

If there is a compile error, it may be irrelevant as in this case https://github.com/ShantanuKumar/pants-multi-poetry.

There the PEX produced via ./pants package src/package-a/package_a:pex_package_a runs into this issue:

$ PEX_TOOLS=1 python3.9 dist/src.package-a.package_a/pex_package_a.pex venv --scope=deps --compile ./pex-deps-compiled 2>&1 | grep -C5 SyntaxError
Compiling './pex-deps-compiled/lib/python3.9/site-packages/aenum/__init__.py'...
Compiling './pex-deps-compiled/lib/python3.9/site-packages/aenum/_py2.py'...
***   File "./pex-deps-compiled/lib/python3.9/site-packages/aenum/_py2.py", line 5
    raise exc, None, tb
             ^
SyntaxError: invalid syntax

Compiling './pex-deps-compiled/lib/python3.9/site-packages/aenum/_py3.py'...
Listing './pex-deps-compiled/lib/python3.9/site-packages/aenum/doc'...
Compiling './pex-deps-compiled/lib/python3.9/site-packages/aenum/test.py'...
Compiling './pex-deps-compiled/lib/python3.9/site-packages/aenum/test_v3.py'...

The aenum/_py2.py file will never get imported by the Python 3.9 interpreter; so this compile failure is not relevant.

If the compile error is real, the application will encounter it at runtime and fail anyhow. On balance, it seems a later warning is by far the lesser of two evils here. Currently failing the venv creation due to failing compilation of a file stops things in their tracks with no recourse.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jsiroiscommented, Dec 1, 2022

If you do go the warning route, you’d use pex.pex_warnings.warn.

1reaction
jsiroiscommented, Dec 1, 2022

That should do. Note that the exception raised is pex.executor.Executor.NonZeroExit: https://github.com/pantsbuild/pex/blob/61c150d3635b3603ee9a0e8cf9bc748c415a8660/pex/executor.py#L40-L49

That has fields for stdout and stderr; so you could use one or both of those to relay compilation errors as a warning in case the errors are real and will actually blow up when the PEX is run. I’m not sure about how to handle that, being too noisy for some cases and potentailly too quiet for others, but that’s where the data is at any rate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEX runtime environment variables - Read the Docs
Boolean. Ignore any errors resolving dependencies when invoking the PEX file. This can be useful if. you know that a particular failing dependency ......
Read more >
pex/CHANGES.rst at main · pantsbuild/pex - GitHub
This is a fix release which addresses issues related to build time work_dir creation, virtualenv, and sh_boot support. In the unlikely event of...
Read more >
pex - PyPI
To build a standalone pex-tools-executable.pex binary that runs the pex-tools console script found in all pex version 2.1.35 and newer distributions:
Read more >
Please config file reference
For clarity the documentation refers to them simply as BUILD files but you could reconfigure them here to be something else.
Read more >
compiler errors have to be fixed before you can enter playmode
All compiler errors have to be fixed before you can enter playmode unity .Support me by Thanks Button Under Videofacebook page ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found