Move load statements to the top to remove the Buildifier warnings (#277)
Also fix a dict ordering issue
diff --git a/distro/BUILD b/distro/BUILD
index ac1f5c1..2b51033 100644
--- a/distro/BUILD
+++ b/distro/BUILD
@@ -1,11 +1,11 @@
-package(
- default_visibility = ["//visibility:private"],
-)
-
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//releasing:defs.bzl", "print_rel_notes")
load("@rules_python//:version.bzl", "version")
+package(
+ default_visibility = ["//visibility:private"],
+)
+
# Build the artifact to put on the github release page.
pkg_tar(
name = "rules_python-%s" % version,
diff --git a/docs/BUILD b/docs/BUILD
index 90335fc..b84e250 100644
--- a/docs/BUILD
+++ b/docs/BUILD
@@ -16,13 +16,13 @@
# To regenerate documentation, run the top-level update_docs.sh script. #
###############################################################################
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
+
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
-load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
-load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
-
# We define these bzl_library targets here rather than in the //python package
# because they're only used for doc generation. This way, we avoid requiring
# our users to depend on Skylib.
diff --git a/examples/boto/BUILD b/examples/boto/BUILD
index 0bac9f6..a39c883 100644
--- a/examples/boto/BUILD
+++ b/examples/boto/BUILD
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
load("@examples_boto//:requirements.bzl", "requirement")
load("//python:defs.bzl", "py_test")
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
py_test(
name = "boto_test",
srcs = ["boto_test.py"],
diff --git a/examples/extras/BUILD b/examples/extras/BUILD
index babfc1b..85c9101 100644
--- a/examples/extras/BUILD
+++ b/examples/extras/BUILD
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
load("@examples_extras//:requirements.bzl", "requirement")
load("//python:defs.bzl", "py_test")
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
py_test(
name = "extras_test",
srcs = ["extras_test.py"],
diff --git a/examples/helloworld/BUILD b/examples/helloworld/BUILD
index 285bc9d..f7fb456 100644
--- a/examples/helloworld/BUILD
+++ b/examples/helloworld/BUILD
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
load("@examples_helloworld//:requirements.bzl", "requirement")
load("//python:defs.bzl", "py_library", "py_test")
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
py_library(
name = "helloworld",
srcs = ["helloworld.py"],
diff --git a/examples/version/BUILD b/examples/version/BUILD
index 6c6d8e4..735b993 100644
--- a/examples/version/BUILD
+++ b/examples/version/BUILD
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
load("@examples_version//:requirements.bzl", "requirement")
load("//python:defs.bzl", "py_test")
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
py_test(
name = "version_test",
srcs = ["version_test.py"],
diff --git a/experimental/examples/wheel/BUILD b/experimental/examples/wheel/BUILD
index 1e4dcec..8916423 100644
--- a/experimental/examples/wheel/BUILD
+++ b/experimental/examples/wheel/BUILD
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
load("//experimental/python:wheel.bzl", "py_package", "py_wheel")
load("//python:defs.bzl", "py_library", "py_test")
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
py_library(
name = "main",
srcs = ["main.py"],
diff --git a/experimental/examples/wheel/lib/BUILD b/experimental/examples/wheel/lib/BUILD
index 2dcc089..3b59662 100644
--- a/experimental/examples/wheel/lib/BUILD
+++ b/experimental/examples/wheel/lib/BUILD
@@ -11,12 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+load("//python:defs.bzl", "py_library")
+
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
-load("//python:defs.bzl", "py_library")
-
py_library(
name = "simple_module",
srcs = ["simple_module.py"],
diff --git a/experimental/python/wheel.bzl b/experimental/python/wheel.bzl
index 7f3c6fe..9cd6534 100644
--- a/experimental/python/wheel.bzl
+++ b/experimental/python/wheel.bzl
@@ -69,6 +69,7 @@
This rule is intended to be used as data dependency to py_wheel rule
""",
attrs = {
+ "deps": attr.label_list(),
"packages": attr.string_list(
mandatory = False,
allow_empty = True,
@@ -77,7 +78,6 @@
Sub-packages are automatically included.
""",
),
- "deps": attr.label_list(),
},
)
diff --git a/packaging/BUILD b/packaging/BUILD
index 5f69d37..237e0ba 100644
--- a/packaging/BUILD
+++ b/packaging/BUILD
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-licenses(["notice"]) # Apache 2.0
-
load("@piptool_deps//:requirements.bzl", "requirement")
load("@subpar//:subpar.bzl", "par_binary")
load("//python:defs.bzl", "py_library", "py_test")
+licenses(["notice"]) # Apache 2.0
+
py_library(
name = "whl",
srcs = ["whl.py"],