Skip to content

Commit

Permalink
chore: move more things to MODULE.bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
aignas committed Mar 17, 2024
1 parent 7fee380 commit d0aff56
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 40 deletions.
21 changes: 20 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,26 @@ dev_pip.parse(
python_version = "3.11",
requirements_lock = "//docs/sphinx:requirements.txt",
)
use_repo(dev_pip, "dev_pip")

#####################
# Install twine for our own runfiles wheel publishing.
# Eventually we might want to install twine automatically for users too, see:
# https://github.com/bazelbuild/rules_python/issues/1016.

dev_pip.parse(
hub_name = "publish_deps",
python_version = "3.11",
requirements_darwin = "//tools/publish:requirements_darwin.txt",
requirements_lock = "//tools/publish:requirements.txt",
requirements_windows = "//tools/publish:requirements_windows.txt",
)
use_repo(
dev_pip,
"dev_pip",
publish_deps_twine = "publish_deps_311_twine",
)

# Bazel integration test setup below

bazel_binaries = use_extension(
"@rules_bazel_integration_test//:extensions.bzl",
Expand Down
41 changes: 2 additions & 39 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
# This file contains everything that is needed when using bzlmod
workspace(name = "rules_python")

load("//python:repositories.bzl", "python_register_multi_toolchains")
load("//python:versions.bzl", "MINOR_MAPPING")

python_register_multi_toolchains(
name = "python",
default_version = MINOR_MAPPING.values()[-2],
python_versions = MINOR_MAPPING.values(),
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

# Used for Bazel CI
Expand All @@ -44,41 +35,13 @@ rbe_preconfig(
toolchain = "ubuntu1804-bazel-java11",
)

# Add gazelle plugin so that we can run the gazelle example as an e2e integration
# test and include the distribution files.
local_repository(
name = "rules_python_gazelle_plugin",
path = "gazelle",
)

# The rules_python gazelle extension has some third-party go dependencies
# which we need to fetch in order to compile it.
load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

# See: https://github.com/bazelbuild/rules_python/blob/main/gazelle/README.md
# This rule loads and compiles various go dependencies that running gazelle
# for python requirements.
_py_gazelle_deps()

# This interpreter is used for various rules_python dev-time tools
load("@python//3.11.8:defs.bzl", "interpreter")

#####################
# Install twine for our own runfiles wheel publishing.
# Eventually we might want to install twine automatically for users too, see:
# https://github.com/bazelbuild/rules_python/issues/1016.
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
name = "publish_deps",
python_interpreter_target = interpreter,
requirements_darwin = "//tools/publish:requirements_darwin.txt",
requirements_lock = "//tools/publish:requirements.txt",
requirements_windows = "//tools/publish:requirements_windows.txt",
)

load("@publish_deps//:requirements.bzl", "install_deps")

install_deps()

#####################

# This wheel is purely here to validate the wheel extraction code. It's not
Expand Down

0 comments on commit d0aff56

Please sign in to comment.