-
Notifications
You must be signed in to change notification settings - Fork 543
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
Reimplement rules in Starlark in rules_python #1069
Comments
This is a clean-copy without any changes to provide a baseline Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. These tests are approximately the same as Bazel's Java-implemented tests. Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. These tests are approximately the same as Bazel's Java-implemented tests. Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. These tests are approximately the same as Bazel's Java-implemented tests. Work towards bazelbuild#1069
This is to provide some regression tests for the Starlark rewrite. These tests are approximately the same as Bazel's Java-implemented tests. Work towards #1069
This is so that the transitive dependencies of defs.bzl can be easily found and validated; some Google internal tooling does this validation. The old comment indicated bzl_library wasn't used to avoid a dependency on skylib, however, we've since added a dependency on skylib. Work towards bazelbuild#1069
This is so that the transitive dependencies of defs.bzl can be easily found and validated; some Google internal tooling does this validation. The old comment indicated bzl_library wasn't used to avoid a dependency on skylib, however, we've since added a dependency on skylib. Work towards bazelbuild#1069
This is so that the transitive dependencies of defs.bzl can be easily found and validated; some Google internal tooling does this validation. The old comment indicated bzl_library wasn't used to avoid a dependency on skylib, however, we've since added a dependency on skylib. Work towards bazelbuild#1069
This is so that the transitive dependencies of defs.bzl can be easily found and validated; some Google internal tooling does this validation. The old comment indicated bzl_library wasn't used to avoid a dependency on skylib, however, we've since added a dependency on skylib. Work towards bazelbuild#1069
This is so that the transitive dependencies of defs.bzl can be easily found and validated; some Google internal tooling does this validation. The old comment indicated bzl_library wasn't used to avoid a dependency on skylib, however, we've since added a dependency on skylib. Work towards #1069
This is basically a performance optimization. Bazel can only see that a bzl file changed, not the particular contents. This means that any downstream bzl file loading it is invalidated, even if it doesn't load any of the affected code. As an example, if a package only loads `py_library.bzl`, then changing `py_test.bzl` doesn't need to invalidate all libraries. Work towards bazelbuild#1069
This is basically a performance optimization. Bazel can only see that a bzl file changed, not the particular contents. This means that any downstream bzl file loading it is invalidated, even if it doesn't load any of the affected code. As an example, if a package only loads `py_library.bzl`, then changing `py_test.bzl` doesn't need to invalidate all libraries. * Also removes some more extraneous license comments Work towards bazelbuild#1069
This is basically a performance optimization. Bazel can only see that a bzl file changed, not the particular contents. This means that any downstream bzl file loading it is invalidated, even if it doesn't load any of the affected code. As an example, if a package only loads `py_library.bzl`, then changing `py_test.bzl` doesn't need to invalidate all libraries. * Also removes some more extraneous license comments Work towards bazelbuild#1069
This is basically a performance optimization. Bazel can only see that a bzl file changed, not the particular contents. This means that any downstream bzl file loading it is invalidated, even if it doesn't load any of the affected code. As an example, if a package only loads `py_library.bzl`, then changing `py_test.bzl` doesn't need to invalidate all libraries. * Also removes some more extraneous license comments Work towards bazelbuild#1069
This is basically a performance optimization. Bazel can only see that a bzl file changed, not the particular contents. This means that any downstream bzl file loading it is invalidated, even if it doesn't load any of the affected code. As an example, if a package only loads `py_library.bzl`, then changing `py_test.bzl` doesn't need to invalidate all libraries. * Also removes some more extraneous license comments Work towards #1069
This provides a public entry point for loading the underlying `PyCcLinkParamsProvider` provider that is built into Bazel. This provider isn't yet usable from Bazel, but adding a loadable way for it to migrate off the built-in rules is the first step. Work towards bazelbuild#1069
This provides a public entry point for loading the underlying `PyCcLinkParamsProvider` provider that is built into Bazel. This provider isn't yet usable from Bazel, but adding a loadable way for it to migrate off the built-in rules is the first step. Work towards bazelbuild#1069
This provides a public entry point for loading the underlying `PyCcLinkParamsProvider` provider that is built into Bazel. This provider isn't yet usable from Bazel, but adding a loadable way for it to migrate off the built-in rules is the first step. Work towards bazelbuild#1069
This provides a public entry point for loading the underlying `PyCcLinkParamsProvider` provider that is built into Bazel. This provider isn't yet usable from Bazel, but adding a loadable way for it to migrate off the built-in rules is the first step. Work towards #1069
This is a pristine copy of the Starlark implementation of the Python rules from Bazel. This code isn't loaded and won't work as-is. Modifications to make it work will be made is subsequent changes. Work towards bazelbuild#1069
This makes the rules_python Starlark implementation accept and return the builtin providers. This allows depending on, and being depended on by, the builtin rules, which enables the two rule sets to interoperate better. Work towards bazelbuild#1069
This makes the rules_python Starlark implementation accept and return the builtin providers. This allows depending on, and being depended on by, the builtin rules, which enables the two rule sets to interoperate better. Work towards #1069
This makes rules_python compatible with disabling using the native rules in Bazel. Work towards bazelbuild#1069
This makes rules_python compatible with disabling using the native rules in Bazel. Work towards bazelbuild#1069
With the release of Bazel 7, support for 5 is no longer necessary. Work towards bazelbuild#1069
This makes rules_python compatible with disabling using the native rules in Bazel. While we're here, update some examples in docs to load py_runtime to better make clear the builtin py_runtime objects shouldn't be used. Work towards #1069
With the release of Bazel 7, support for 5 is no longer necessary. Also deletes all the integration tests of the examples. They were broken when run from the main repo, and CI was only building them, not running them, as part of the main repo due to having `--test_tag_filters=-integration-test`. CI runs them separately in their own workspace. Work towards #1069
wondering if pyc support is on the roadmap? #1761 |
… Bazel 7+ Respecting it for earlier versions was only done for testing purposes. The implementation requires the `py_internal` object, which only exists on Bazel 7 and higher. Work towards bazelbuild#1069
This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards bazelbuild#1069
This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards bazelbuild#1069
This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards bazelbuild#1069
This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards bazelbuild#1069
…7+ (#1699) This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards #1069
The 0.31.0 release of rules_python has enabled the rules_python Starlark implementation for Bazel 7+. 🎆 ! If you encounter issues, please file bugs in rules_python. I'm eager to identify and fix any issues. If you do encounter issues, setting The most likely problem to occur is using a combination of the Bazel-builtin rules/providers and the rules_python rules/providers. They should interoperate OK, but please report any issues. |
Let's close this as complete as it is working well. Thank you @rickeylev! |
This is the general tracking issue for re-implementing the Bazel-bundled Python rules in Starlark in the rules_python repo.
The Bazel-side issue is bazelbuild/bazel#15897
As of now (Feb 2023), the Bazel bundled rules (not providers or flags, though) have all been re-implemented in Starlark. They will used in Bazel 7. Hooks for low-level Bazel behaviors the Python rules need are exposed to the rules_python repo. So now this is mostly a matter of copying that code over here, cleaning it up, and flushing out any missing hooks.
TODO
That's the high level gist, some lower level TODOs are:
@bazel_tools
An optional bonus thing is to backport the low-level hooks to 5.x and/or 6.x. This makes them available sooner, so that we don't have to wait for Bazel 7. There isn't a ton to backport (I intentionally made them to be amenable to this idea), but there's several small pieces. The two general pieces are exposing the flags as fragments and the
py_internal
object:py_internal
object and it's backing pieces:py_internal
name declaration in BazelRuleClassProvider.javapy_internal
name override in exports.bzlconfig_settings
--python_path
and--python_top
from BazelPythonConfiguration; note, however, that--python_top
is supposed to be unused (superceded by toolchains) and--python_path
is probably unused (unclear; some comments indicate it might be used as part of windows support)--build_python_zip
from PythonConfiguration.java; note, however, it, too, can be replicated in Starlark by using platforms or thepy_internal.get_current_os_name()
helper.The text was updated successfully, but these errors were encountered: