feat(windows): site-packages venv support#3718
feat(windows): site-packages venv support#3718rickeylev merged 25 commits intobazel-contrib:mainfrom
Conversation
…/rules_python into win.venv.site.packages
|
I think this is the last piece to bring venv support on windows on par |
There was a problem hiding this comment.
Code Review
This pull request updates documentation dependencies and implements robust support for Python virtual environments on Windows, specifically addressing symlink limitations and sys.path configuration. Changes include the introduction of an ExplicitSymlink provider, a recursive symlink tree helper for Windows, and refined bootstrap logic to correctly prioritize venv site-packages. Review feedback identifies several improvement opportunities for the Windows-specific logic, such as enabling link following in os.walk, utilizing UNC prefixes for long path support, and using exist_ok=True in os.makedirs to avoid errors. An optimization for symlink creation was also suggested to improve performance during venv setup.
…into win.venv.site.packages
This implements Windows support for library files being populated
in the venv site-packages directory (i.e.
--venv_site_packages=yes).This is mostly just an expansion of the work done to make venvs work
on Windows. It mostly just adds the site-packages paths to the list
of (venv_path, symlinks) values that is currently used for the
interpreter files.
The main notable change is that creation of the site-packages
directory also requires traversing the whole site-packages directory
and re-creating its structure in the temporary venv. This isn't ideal,
but there isn't much other option.
Work towards #3245