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

Add :my_func shorthand for the entry_point field #11064

Merged
merged 2 commits into from Oct 29, 2020

Conversation

Eric-Arellano
Copy link
Contributor

Problem

A user pointed out it's clunky to have to set path.to.module:my_func. They need to set the :my_func portion so that it works with setuptools, so they can't use the default entry point when you set sources and leave off entry_point.

Solution

Add a third option: an explicit sources field + explicit entry_point field that starts with : will be expanded to path.to.module:my_func.

# Results in `project.app:my_func`
pex_binary(
  sources=["app.py"],
  entry_point=":my_func"
)

@coveralls
Copy link

coveralls commented Oct 28, 2020

Coverage Status

Coverage remained the same at 0.0% when pulling 971ea44 on Eric-Arellano:entry-point-shorthand into 3760987 on pantsbuild:master.

f"{repr(request.sources.address)}, so it must have exactly one source, but it has "
f"{len(binary_source_paths.files)}."
)
instructions_url = "https://www.pantsbuild.org/v2.1/docs/python-package-goal#creating-a-pex-file-from-a-pex_binary-target"
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to bake "v2.1" into this URL, so let's just use https://www.pantsbuild.org/docs/python-package-goal#creating-a-pex-file-from-a-pex_binary-target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stu proposed baking it in the other day: https://pantsbuild.slack.com/archives/C046T6T9U/p1603735964018700?thread_ts=1602610244.363000&cid=C046T6T9U

while it’s true that linking to v2.0 rather than v2.1 might get you older docs, it also won’t get you a broken link for removed/renamed features/pages
more likely to be correct on average i think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we don't want to rewrite the docs for 2.0 - this feature will not be backported. We don't want to change the "default" version until 2.1.0 has landed.

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trouble is, v2.1 docs will disappear eventually. We only have 5 versions back.

Probably we need an error URLs system, but for now hardcoding v2.1 is not a great idea.

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@Eric-Arellano Eric-Arellano merged commit c98ee36 into pantsbuild:master Oct 29, 2020
@Eric-Arellano Eric-Arellano deleted the entry-point-shorthand branch October 29, 2020 06:21
Eric-Arellano added a commit that referenced this pull request Nov 5, 2020
…rthand (#11093)

I accidentally forgot to wire this up in #11064.

Apparently #10829 didn't actually work either..we left off `UnionRule`.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants