-
Notifications
You must be signed in to change notification settings - Fork 541
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
Allow extry_point
to include extra targets
#980
Conversation
extra_point
to include extra dependencies
extra_point
to include extra dependenciesextra_point
to include extra targets
extra_point
to include extra targetsextra_point
to include extra targets
071c9c0
to
3455b2f
Compare
3455b2f
to
9ec07b4
Compare
extra_point
to include extra targetsextra_point
to include extra targets
r? @alexeagle would you like to take a look since you approve/merge the first version of |
extra_point
to include extra targetsextry_point
to include extra targets
entry_point_binary( | ||
name = "yamllint_binary", | ||
pkg = "yamllint", | ||
) |
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.
Since the basic feature is to allow additional dependencies, please provide an example where it does so. Otherwise it isn't clear what the difference is between these two, and its harder for readers to see code reflective of their case.
@@ -235,6 +235,9 @@ def dist_info_requirement(name): | |||
def entry_point(pkg, script = None): | |||
fail("Not implemented yet") | |||
|
|||
def entry_point_binary(name, pkg, script = None, **kwargs): | |||
fail("Not implemented yet") |
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.
Instead of simply "not implemented yet", lets change the message to better indicate that codegen generates the implementation for this, so if you hit this, it means you're loading the wrong thing.
It feels to me like the So IMO this isn't needed and adds maintenance burden for rules_python. |
You're totally right that it's a syntax sugar and user can build their own to involve additional dependencies. However, from a user perspective, it's not obvious at first glance on how to do that, especially for users not familiar with Bazel and If we keep the current solution, at least we should clearly call out the limitation and list out the alternatives in the documentation so users don't get confused on this. However, I would argue that i'll be better time spent to just provide a better solution instead of writing those documentation.
I think
I think the end goal here is to only keep the new |
The maintainers have discussed various plans to redesign how entry_points and the various generated functions are handled. We’re going to try move away from such a heavy reliance on generated repository rules. The functionality described in this PR would work with simple macros too (and would probably be more appropriate since it’s syntax sugar). |
Hey @groodt, thx for the context. One quick question
Do you mean by a macro provided by |
@groodt @alexeagle @rickeylev hey, just wanna check to see if we still want to have this PR merged in some way. Or if we want to take a totally different approach, that's ok too. Let me know how you think. |
This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
PR author asked questions that were never answered on publicly github. would like to see them answered before this PR is auto-closed |
Introduce a new `entry_point` macro to `rules_python` as opposed to the `hub` repository which allows users to generate an `entry_point` script for a given package. This will check the `console_scripts` key in the `entry_points.txt` dist-info file and avoids eager fetching of third party repositories because it is a `genrule` and a `py_binary` underneath the hood and exists in `rules_python`. This is a breaking change for bzlmod users as they will have to start using `@rules_python//python:entry_point.bzl`. For others this new macro is available to be used, but the old code is still present. Fixes bazelbuild#1362 Fixes bazelbuild#543 Fixes bazelbuild#979 Fixes bazelbuild#1262 Closes bazelbuild#980 Closes bazelbuild#1294
Over in #979 we're talking about and spec'ing out a new rule/macro to handle this case. There's a pending PR with most of the functionality implemented. At this point, we're just finishing up some details and waiting for the PR author to come back from vacation. As such, I'll close this PR. |
Introduce a new `entry_point` macro to `rules_python` as opposed to the `hub` repository which allows users to generate an `entry_point` script for a given package. This will check the `console_scripts` key in the `entry_points.txt` dist-info file and avoids eager fetching of third party repositories because it is a `genrule` and a `py_binary` underneath the hood and exists in `rules_python`. This is a breaking change for bzlmod users as they will have to start using `@rules_python//python:entry_point.bzl`. For others this new macro is available to be used, but the old code is still present. Fixes bazelbuild#1362 Fixes bazelbuild#543 Fixes bazelbuild#979 Fixes bazelbuild#1262 Closes bazelbuild#980 Closes bazelbuild#1294
Introduce a new `entry_point` macro to `rules_python` as opposed to the `hub` repository which allows users to generate an `entry_point` script for a given package. This will check the `console_scripts` key in the `entry_points.txt` dist-info file and avoids eager fetching of third party repositories because it is a `genrule` and a `py_binary` underneath the hood and exists in `rules_python`. This is a breaking change for bzlmod users as they will have to start using `@rules_python//python:entry_point.bzl`. For others this new macro is available to be used, but the old code is still present. Fixes bazelbuild#1362 Fixes bazelbuild#543 Fixes bazelbuild#979 Fixes bazelbuild#1262 Closes bazelbuild#980 Closes bazelbuild#1294
#1363) Add `py_console_script_binary`, a macro/rule that allows better customization of how entry points are generated. Notable features of it are: * It allows passing in additional dependencies, which makes it easier for plugin dependencies to be added to tools such as pylint or sphinx. * The underlying `py_binary` rule can be passed in, allowing custom rules, such as the version-aware rules, to be used for the resulting binary. * Entry point generation is based upon a wheel's `entry_points.txt` file. This helps avoid loading external repositories unless they're actually used, allows entry points to have better version-aware support, and allows bzlmod to provide a supportable mechanism for entry points. Because the expected common use case is an entry point for our pip generated repos, there is special logic to make that easy and concisely do. Usage of `py_console_script_binary` is not tied to our pip code generation, though, and users can manually specify dependencies if they need to. BREAKING CHANGE: This is a breaking change, but only for bzlmod users. Note that bzlmod support is still beta. Bzlmod users will need to replace using `entry_point` from `requirements.bzl` with loading `py_console_script_binary` and defining the entry point locally: ``` load("@rules_python//python/entry_points:py_console_script_binary.bzl, "py_console_script_binary") py_console_script_binary(name="foo", pkg="@mypip//pylint") ``` For workspace users, this new macro is available to be used, but the old code is still present. Fixes #1362 Fixes #543 Fixes #979 Fixes #1262 Closes #980 Closes #1294 Closes #1055 --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #979
What is the new behavior?
Does this PR introduce a breaking change?
Other information