Skip to content

Conversation

@zhe-tao
Copy link
Collaborator

@zhe-tao zhe-tao commented Feb 17, 2023

Reasons for those changes

  1. Why setup the @python repository: Python projects with C/C++ extensions/modules require corresponding cpython headers and libraries.
  2. Why add options to build a hermetic Python: setting up a local bazel_python installation is efficient but may confuse new users like the reviewers.
  3. BTW, we want to fix Fail the execution if the specified bazel_python version is not installed. #14.

Changes in bazel_python.bzl

bazel_local_python

bazel_local_python replaces the original bazel_python. Changes:

  1. It now takes new python_version and name='python' arguments.
  2. It will create a local repository @name (@python by default) and expose cpython headers, libraries (@python or @python//:python) and binaries (e.g., @python//:bin/python3).

bazel_hermetic_python

The new bazel_hermetic_python fetches a python source code and builds it using @bazel_python//:external/python*.*.BUILD. It has the same interface as bazel_local_python and gives the build @python repository.

bazel_python_venv

bazel_python_venv no longer takes the python_version argument. Instead, it takes an (implicit) python (tool) argument to specify which Python repository and binary to use. It by default is @python//:bin/python3.

@zhe-tao zhe-tao requested a review from adityathakur February 17, 2023 01:51
@zhe-tao zhe-tao self-assigned this Feb 17, 2023
bazel_python.bzl Outdated
=========================================================================================
Warning: build a hermetic Python is experimental.

Know issues:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Know --> Known

@adityathakur
Copy link

Should README.md also be updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail the execution if the specified bazel_python version is not installed.

3 participants