For more detailed setup instructions, see https://rules-python.readthedocs.io/en/latest/getting-started.html
For the user-facing changelog see here
Using Bzlmod
Add to your MODULE.bazel file:
bazel_dep(name = "rules_python", version = "2.0.3")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.13",
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pypi",
python_version = "3.13",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pypi")Using WORKSPACE
Paste this snippet into your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "2610f57b934dc55d1df2728290199519b11cc53508dec34fd5ef0424bcb50242",
strip_prefix = "rules_python-2.0.3",
url = "https://github.com/bazel-contrib/rules_python/releases/download/2.0.3/rules_python-2.0.3.tar.gz",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()Gazelle plugin
Paste this snippet into your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python_gazelle_plugin",
sha256 = "2610f57b934dc55d1df2728290199519b11cc53508dec34fd5ef0424bcb50242",
strip_prefix = "rules_python-2.0.3/gazelle",
url = "https://github.com/bazel-contrib/rules_python/releases/download/2.0.3/rules_python-2.0.3.tar.gz",
)
# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.
load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")
_py_gazelle_deps()What's Changed
- build: release 2.0.3 by @udaya2899 in #3819
New Contributors
- @udaya2899 made their first contribution in #3819
Full Changelog: 2.0.2...2.0.3