Skip to content
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

A PexRequest should support pex -c. #11583

Closed
jsirois opened this issue Feb 19, 2021 · 1 comment · Fixed by #11620
Closed

A PexRequest should support pex -c. #11583

jsirois opened this issue Feb 19, 2021 · 1 comment · Fixed by #11620
Assignees

Comments

@jsirois
Copy link
Contributor

jsirois commented Feb 19, 2021

Right now, it only supports specifying modules or entry point functions:

:param entry_point: The entry-point for the built Pex, equivalent to Pex's `-m` flag. If
left off, the Pex will open up as a REPL.

if request.entry_point is not None:
argv.extend(["--entry-point", request.entry_point])

Of the three options for specifying a main this only allows for the worst two in terms of stability. Since Pants uses Pex to package python tools (i.e.: binaries folks run like pytest or black), it should probably bind to those public names which are console scripts instead of modules (slightly less stable presumably) or entry point functions (clearly the least stable). Pex supports this with -c.

@jsirois
Copy link
Contributor Author

jsirois commented Feb 19, 2021

This seems especially important because we generally allow users to change versions of tool libraries. Most of the time thats coupled with the ability to change entry point functions but its not in a few cases. Regardless, binding to a console script should make this moot across tool versions since any tool author changing their console script names has broken their brand and their users. Highly unlikely esp vs. moving around code.

@jsirois jsirois self-assigned this Feb 28, 2021
jsirois added a commit to jsirois/pants that referenced this issue Mar 2, 2021
Introduce `MainSpecification` which can either be an `EntryPoint` or
a `ConsoleScript`. Both `PexRequest` and `PexFromTargetsRequest` are
updated to take a `MainSpecification` as is `PythonToolBase`. All
internal rules are updated to use `ConsoleScript` where possible for
improved stability of entry points across requirement upgrades.

Fixes pantsbuild#11583

[ci skip-rust]
[ci skip-build-wheels]
jsirois added a commit that referenced this issue Mar 2, 2021
Introduce `MainSpecification` which can either be an `EntryPoint` or
a `ConsoleScript`. Both `PexRequest` and `PexFromTargetsRequest` are
updated to take a `MainSpecification` as is `PythonToolBase`. All
internal rules are updated to use `ConsoleScript` where possible for
improved stability of entry points across requirement upgrades.

Fixes #11583
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant