-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix editable requirement parsing. #2464
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, editable requirements in requirements files were not parsed properly by Pex. Although they did not trigger parse errors, PEXes created from editable requirements would fail to import those requirements at runtime despite the editable project distribution being embedded in the PEX file. Fixes pex-tool#2410
jsirois
commented
Jul 14, 2024
pex = os.path.join(str(tmpdir), "pex") | ||
run_pex_command(args=["-r", requirements, "-m", "example", "-o", pex]).assert_success() | ||
output = ( | ||
subprocess.check_output(args=[pex, "A", "wet", "duck", "flies", "at", "night!"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the fix in pex/requirements.py
here this subprocess fails similarly to the OP in #2410:
tests/integration/test_issue_2410.py::test_pex_with_editable Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/__main__.py", line 224, in <module>
result = boot(
bootstrap_dir='.bootstrap',
...<6 lines>...
inject_python_args=(),
)
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/__main__.py", line 218, in boot
bootstrap_pex(
~~~~~~~~~~~~~^
entry_point, python_args=python_args, execute=__SHOULD_EXECUTE__, venv_dir=venv_dir
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex_bootstrapper.py", line 643, in bootstrap_pex
pex.PEX(entry_point).execute()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 562, in execute
sys.exit(self._wrap_coverage(self._wrap_profiling, self._execute))
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 469, in _wrap_coverage
return runner(*args)
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 500, in _wrap_profiling
return runner(*args)
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 606, in _execute
return self.execute_entry(
~~~~~~~~~~~~~~~~~~^
EntryPoint.parse("run = {}".format(self._pex_info.entry_point))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 810, in execute_entry
return self.execute_module(entry_point.module)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/home/jsirois/.pex/unzipped_pexes/8a97e1ee50ec37bf439dfaac193544f17e281e0b/.bootstrap/pex/pex.py", line 818, in execute_module
runpy.run_module(module_name, run_name="__main__", alter_sys=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen runpy>", line 222, in run_module
File "<frozen runpy>", line 142, in _get_module_details
ImportError: No module named example
FAILED
zmanji
approved these changes
Jul 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, editable requirements in requirements files were not parsed
properly by Pex. Although they did not trigger parse errors, PEXes
created from editable requirements would fail to import those
requirements at runtime despite the editable project distribution being
embedded in the PEX file.
Fixes #2410