Skip to content

Commit

Permalink
docs: document the perf benefits of symlink startup options on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aignas committed Feb 7, 2024
1 parent fe1772c commit 2d559e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions docs/sphinx/pypi-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ use_repo(pip, "my_deps")
For more documentation, including how the rules can update/create a requirements
file, see the bzlmod examples under the {gh-path}`examples` folder.

We are using a host-platform compatible toolchain by default to setup pip dependencies.
During the setup phase, we create some symlinks, which may be inefficient on Windows
by default. In that case use the following `.bazelrc` options to improve performance if
you have admin privileges:
```
startup --windows_enable_symlinks
```

This will enable symlinks on Windows and help with bootstrap performance of setting up the
hermetic host python interpreter on this platform. Linux and OSX users should see no
difference.

### Using a WORKSPACE file

To add pip dependencies to your `WORKSPACE`, load the `pip_parse` function and
Expand Down
6 changes: 4 additions & 2 deletions python/private/toolchains_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@ exports_files(["python"], visibility = ["//visibility:public"])
]:
continue

# Use the symlink command as it will create copies if the symlinks are not
# supported, let's hope it handles directories, otherwise we'll have to do this in a very inefficient way.
# symlink works on all platforms that bazel supports, so it should work on
# UNIX and Windows with and without symlink support. For better performance
# users should enable the symlink startup option, however that requires admin
# privileges.
rctx.symlink(p, p.basename)

is_windows = (os_name == WINDOWS_NAME)
Expand Down

0 comments on commit 2d559e1

Please sign in to comment.