*: move away from python_rules

python_rules is completely broken when it comes to py2/py3 support.

Here, we replace it with native python rules from new Bazel versions [1] and rules_pip for PyPI dependencies [2].

rules_pip is somewhat little known and experimental, but it seems to work much better than what we had previously.

We also unpin rules_docker and fix .bazelrc to force Bazel into Python 2 mode - hopefully, this repo will now work
fine under operating systems where `python` is python2 (as the standard dictates).

[1] - https://docs.bazel.build/versions/master/be/python.html

[2] - https://github.com/apt-itude/rules_pip

Change-Id: Ibd969a4266db564bf86e9c96275deffb9610dd44
diff --git a/WORKSPACE b/WORKSPACE
index aee5f12..58dc8e5 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,6 +1,32 @@
+
 load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
+# Skylib
+
+skylib_version = "0.8.0"
+http_archive(
+    name = "bazel_skylib",
+    type = "tar.gz",
+    url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version),
+    sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
+)
+
+# Docker rules
+
+http_archive(
+    name = "io_bazel_rules_docker",
+    sha256 = "87fc6a2b128147a0a3039a2fd0b53cc1f2ed5adb8716f50756544a572999ae9a",
+    strip_prefix = "rules_docker-0.8.1",
+    urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.8.1.tar.gz"],
+)
+
+load(
+    "@io_bazel_rules_docker//repositories:repositories.bzl",
+    container_repositories = "repositories",
+)
+
+container_repositories()
 # Nix rules
 http_archive(
     name = "io_tweag_rules_nixpkgs",
@@ -24,42 +50,26 @@
 )
 
 # Python rules
+
 git_repository(
-    name = "io_bazel_rules_python",
-    remote = "https://github.com/bazelbuild/rules_python.git",
-    commit = "ebd7adcbcafcc8abe3fd8e5b0e42e10ced1bfe27",
+    name = "com_apt_itude_rules_pip",
+    commit = "e5ed5e72bf5a7521244e1d2119821628bbf17263",
+    remote = "https://github.com/apt-itude/rules_pip.git",
 )
 
 # Python dependencies
+load("@com_apt_itude_rules_pip//rules:dependencies.bzl", "pip_rules_dependencies")
 
-load("@io_bazel_rules_python//python:pip.bzl", "pip_import")
+pip_rules_dependencies()
 
-pip_import(
-    name = "py_deps",
-    requirements = "//:requirements.txt",
+load("@com_apt_itude_rules_pip//rules:repository.bzl", "pip_repository")
+
+pip_repository(
+    name = "pip36",
+    python_interpreter = "python3.6",
+    requirements = "//pip:requirements-linux.txt",
 )
 
-load("@py_deps//:requirements.bzl", "pip_install")
-
-pip_install()
-
-# Docker rules
-
-git_repository(
-    name = "io_bazel_rules_docker",
-    # Invoke puller.par with python2
-    # TODO(q3k): use upstream when py2/py3 bazel madness if fully fixed
-    remote = "https://github.com/q3k/rules_docker",
-    commit = "4642a2a7775e5713596bd6e37758735a0f38aa6e",
-)
-
-load(
-    "@io_bazel_rules_docker//repositories:repositories.bzl",
-    container_repositories = "repositories",
-)
-
-container_repositories()
-
 # Docker base images
 
 load("@io_bazel_rules_docker//container:container.bzl", "container_pull")