Skip to content

Commit 901405b

Browse files
authored
Update readme (#186)
1 parent aed2e05 commit 901405b

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

README.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,26 @@
44
https://github.com/bazelbuild/rules_python.
55
It is currently in pre-release, but we are committed to more development towards a 1.0 stable release.
66

7-
Some parts of `rules_python` are reused:
7+
The lower layer of `rules_python` is currently reused, dealing with the toolchain and dependencies:
88

99
- Same toolchain for fetching a hermetic python interpreter.
1010
- `pip_parse` rule for translating a requirements-lock.txt file into Bazel repository fetching rules
1111
and installing those packages into external repositories.
1212
- The Gazelle extension for generating BUILD.bazel files works the same.
1313

1414
However, this ruleset introduces a new implementation of `py_library`, `py_binary`, and `py_test`.
15-
The starlark implementations allow us to innovate, while the existing ones are embedded in Bazel's
16-
Java sources in the bazelbuild/bazel repo and therefore very difficult to get changes made.
15+
Our philosophy is to behave more like idiomatic python ecosystem tools, where rules_python is closely
16+
tied to the way Google does Python development in their internal monorepo, google3.
1717

18-
> We understand that there is also an effort at Google to "starlarkify" the Python rules,
19-
> but there is no committed roadmap or dates.
20-
> Given the history of other projects coming from Google, we've chosen not to wait.
18+
Things you'll love about rules_py:
2119

22-
Our philosophy is to behave more like idiomatic python ecosystem tools.
23-
Having a starlark implementation allows us to do things like
24-
attach Bazel transitions, mypy typechecking actions, etc.
25-
26-
Things that are improved in rules_py:
27-
28-
- We don't mess with the Python `sys.path`/`$PYTHONPATH`. Instead we use the standard `site-packages` folder layout produced by `pip_install`. This avoids problems like package naming collisions with built-ins (e.g. `collections`) or where `argparse` comes from a transitive dependency instead. (Maybe helps with diamond dependencies too).
29-
- We run python in isolated mode so we don't accidentally break out of Bazel's action sandbox, fixing:
20+
- We don't mess with the Python `sys.path`/`$PYTHONPATH`. Instead we use the standard `site-packages` folder layout produced by `pip_install`. This avoids problems like package naming collisions with built-ins (e.g. `collections`) or where `argparse` comes from a transitive dependency instead.
21+
- We run python in isolated mode so we don't accidentally break out of Bazel's action sandbox, fixing bugs like:
3022
- [pypi libraries installed to system python are implicitly available to builds](https://github.com/bazelbuild/rules_python/issues/27)
3123
- [sys.path[0] breaks out of runfile tree.](https://github.com/bazelbuild/rules_python/issues/382)
3224
- We create a python-idiomatic virtualenv to run actions, which means better compatibility with userland implementations of [importlib](https://docs.python.org/3/library/importlib.html).
3325
- Thanks to the virtualenv, you can open the project in an editor like PyCharm and have working auto-complete, jump-to-definition, etc.
34-
- The launcher uses the Bash toolchain rather than Python, so we have no dependency on a system interpreter - fixes MacOS no longer shipping with python.
35-
36-
Improvements planned:
37-
38-
- Build wheels in actions, so it's possible to have native packages built for the target platform,
39-
e.g. for a rules_docker py3_image.
40-
- Support `--only_binary=:all:` by always building wheels from source using a hermetic Bazel cc toolchain.
41-
- `dep` on wheels directly, rather than on a `py_library` that wraps it. Then we don't have to append to the `.pth` file to locate them.
26+
- The launcher uses the Bash toolchain rather than Python, so we have no dependency on a system interpreter.
4227

4328
_Need help?_ This ruleset has support provided by https://aspect.dev.
4429

0 commit comments

Comments
 (0)