For more detailed setup instructions, see https://rules-python.readthedocs.io/en/latest/getting-started.html
Using Bzlmod
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_python", version = "0.40.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
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 = "690e0141724abb568267e003c7b6d9a54925df40c275a870a4d934161dc9dd53",
strip_prefix = "rules_python-0.40.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.40.0/rules_python-0.40.0.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 = "690e0141724abb568267e003c7b6d9a54925df40c275a870a4d934161dc9dd53",
strip_prefix = "rules_python-0.40.0/gazelle",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.40.0/rules_python-0.40.0.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
- refactor(pkg_aliases): create a macro for creating whl aliases by @aignas in #2391
- chore: change bcr presubmit to drop bazel 6, add last_rc (bazel 8) by @rickeylev in #2404
- deps: update to gazelle 0.40.0 by @rickeylev in #2403
- chore!: remove requirements.txt for the twine publishing tool by @aignas in #2401
- ci: add last_rc, remove extraneous pystar configs by @rickeylev in #2405
- fix: upgrade to rules_proto 7.0.2 to pickup fix for Bazel 9 by @rickeylev in #2408
- fix: keep import path values if Bazel-builtin PyInfo is removed by @rickeylev in #2415
- docs: tell how to do pyc-only builds by @rickeylev in #2417
- chore: update changelog for 0.40.0 by @rickeylev in #2416
Full Changelog: 0.39.0...0.40.0