• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15workspace(name = "rules_python")
16
17# Everything below this line is used only for developing rules_python. Users
18# should not copy it to their WORKSPACE.
19
20load("//:internal_deps.bzl", "rules_python_internal_deps")
21
22rules_python_internal_deps()
23
24load("//:internal_setup.bzl", "rules_python_internal_setup")
25
26rules_python_internal_setup()
27
28load("//python:repositories.bzl", "python_register_multi_toolchains")
29load("//python:versions.bzl", "MINOR_MAPPING")
30
31python_register_multi_toolchains(
32    name = "python",
33    default_version = MINOR_MAPPING.values()[-1],
34    python_versions = MINOR_MAPPING.values(),
35)
36
37load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
38
39# Used for Bazel CI
40http_archive(
41    name = "bazelci_rules",
42    sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
43    strip_prefix = "bazelci_rules-1.0.0",
44    url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
45)
46
47load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
48
49# Creates a default toolchain config for RBE.
50# Use this as is if you are using the rbe_ubuntu16_04 container,
51# otherwise refer to RBE docs.
52rbe_preconfig(
53    name = "buildkite_config",
54    toolchain = "ubuntu1804-bazel-java11",
55)
56
57local_repository(
58    name = "rules_python_gazelle_plugin",
59    path = "gazelle",
60)
61
62# The rules_python gazelle extension has some third-party go dependencies
63# which we need to fetch in order to compile it.
64load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")
65
66# See: https://github.com/bazelbuild/rules_python/blob/main/gazelle/README.md
67# This rule loads and compiles various go dependencies that running gazelle
68# for python requirements.
69_py_gazelle_deps()
70
71#####################
72# Install twine for our own runfiles wheel publishing.
73# Eventually we might want to install twine automatically for users too, see:
74# https://github.com/bazelbuild/rules_python/issues/1016.
75load("@python//3.11.4:defs.bzl", "interpreter")
76load("@rules_python//python:pip.bzl", "pip_parse")
77
78pip_parse(
79    name = "publish_deps",
80    python_interpreter_target = interpreter,
81    requirements_darwin = "//tools/publish:requirements_darwin.txt",
82    requirements_lock = "//tools/publish:requirements.txt",
83    requirements_windows = "//tools/publish:requirements_windows.txt",
84)
85
86load("@publish_deps//:requirements.bzl", "install_deps")
87
88install_deps()
89