0.1.0
WORKSPACE setup
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
)
Incompatible Changes
(Note that, per semver, our version starts with 0.
so any minor release can have breaking changes)
We have deprecated the pip_import
rule and moved it to a "legacy" package. Bazel rulesets that attempt to import load("@rules_python//python:pip.bzl", "pip_import")
will fail, as pip_import
has been replaced
by load("@rules_python//python:pip.bzl", "pip_install")
See https://github.com/bazelbuild/rules_python/tree/master/examples/pip_install for an example of using pip_install
.
If you use a ruleset such as rules_docker which depends on pip_import
then you'll need to update that ruleset along with rules_python 0.1.0. We are working to land changes in those dependents to make this possible, in the meantime see the Patches section below.
If there's a problem with pip_install
which prevents you switching, please file an issue with us or discuss on Slack so we can resolve it.
We plan to remove it in a future breaking release.
In this case, note that you can still use pip_import
during the transition.
You just replace your loads from @rules_python//python:pip.bzl
with @rules_python//python/legacy_pip_import:pip.bzl
.
See https://github.com/bazelbuild/rules_python/tree/master/examples/legacy_pip_import for an example of use.
Thank you to @dillon-giacoppo and the other contributors to rules_python_external for building this better way to get dependencies from pip!
Patches
rules_docker
If you use rules_docker you can patch their release by adding this file to your repo. NOTE: it will print a WARNING line because of using the deprecated API; a better patch to switch to pip_install
is on the way.
rules_docker.pr1650.patch
diff repositories/py_repositories.bzl repositories/py_repositories.bzl
index 72bb27b..9ba152c 100644
--- repositories/py_repositories.bzl
+++ repositories/py_repositories.bzl
@@ -19,7 +19,7 @@ Provides functions to pull all Python external package dependencies of this
repository.
"""
-load("@rules_python//python:pip.bzl", "pip_import", "pip_repositories")
+load("@rules_python//python/legacy_pip_import:pip.bzl", "pip_import", "pip_repositories")
def py_deps():
"""Pull in external Python packages needed by py binaries in this repo.
then where you fetch rules_docker, add a patches
attribute:
http_archive(
name = "io_bazel_rules_docker",
patches = ["//:rules_docker.pr1650.patch"],
...
)
(Note, this assumes you have a BUILD file in the workspace root. You can put the patch file in any package you like)
Using the rules
See the source.