aboutsummaryrefslogtreecommitdiff
path: root/WORKSPACE
diff options
context:
space:
mode:
authormattmoor <mattmoor@google.com>2017-09-15 14:12:03 -0700
committerGitHub <noreply@github.com>2017-09-15 14:12:03 -0700
commit7f4cc9244dac7637d514e4f86364507681dda37e (patch)
tree60ba189ef3271ac9e79ab0b1f18963125b4510ab /WORKSPACE
parent9160fc7367be8db56ae90c581bd0ceebda969e24 (diff)
downloadbazelbuild-rules_python-7f4cc9244dac7637d514e4f86364507681dda37e.tar.gz
PIP dependency support (#1)
* Check in an initial version of the pip rules. This is broken off of my prototype repository, and there are a handful of TODOs left to resolve. * Remove some vestigial convenience code. Elaborate on why the TODO to rewrite {pip,whl}.sh as Python is harder than it looks. * Incorporate Code Review Feedback * First cut at skydoc-based documentation. * Move whl.sh into a Python script that has unit testing. * Migrate pip.sh into piptool.py This migrates the logic from pip.sh into piptool.py, which should improve portability by removing the bash dependency. This also has the beginnings of wrapping piptool as a closed redistributable that doesn't rely on a system-installed copy of PIP, but instead uses these rules to pull pip into a PAR bundle. Besides needing to work out the details of releasing and redistributing the PAR, we have two unresolved issues: * When bundled as a PAR (vs. py_binary), piptool seems to pick up the system-installed version of pip. * When bundled as a PAR, piptool sometimes sees cert issues resolving requirements (similar to what we see with httplib2). * Address the cert issue in piptool as a PAR. With this change I am able to build/test my PR on my macbook without pip installed. The only additional change I have locally is to switch from running piptool.py as a simple .py file to downloading/using a PAR built from this change. I believe we still have the problem that the .par picks the host's version of pip instead of our embedded copy, but I haven't reverified that issue still exists (this just does nothing to address that issue). * Fix assorted buildifier issues. * Fix a typo in docs * Incorporate @duggelz code review feedback. * Incorporate review feedback move python tools under a top-level rules_python package simplify version_test * Adopt a canonical naming format for imported whl_library rules. `whl_library` rules generated by `pip_import` are now named as: ``` pypi__{distribution}_{version} ``` Substituting illegal characters (e.g. `-`, `.`) with underscores. * Move the piptool dependency into a .PAR file. Add a script for updating the tools and document this and the docs script. * Fix buildifier issues.
Diffstat (limited to 'WORKSPACE')
-rw-r--r--WORKSPACE109
1 files changed, 109 insertions, 0 deletions
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..ddab657
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,109 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+workspace(name = "io_bazel_rules_python")
+
+# Skydoc stuff
+git_repository(
+ name = "io_bazel_rules_sass",
+ remote = "https://github.com/bazelbuild/rules_sass.git",
+ tag = "0.0.2",
+)
+
+load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories")
+
+sass_repositories()
+
+git_repository(
+ name = "io_bazel_skydoc",
+ remote = "https://github.com/bazelbuild/skydoc.git",
+ tag = "0.1.3",
+)
+
+load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
+
+skydoc_repositories()
+
+# Requirements for building our piptool.
+load("//python:pip.bzl", "pip_import")
+
+pip_import(
+ name = "piptool_deps",
+ requirements = "//python:requirements.txt",
+)
+
+load(
+ "@piptool_deps//:requirements.bzl",
+ _piptool_install = "pip_install",
+)
+
+_piptool_install()
+
+git_repository(
+ name = "subpar",
+ remote = "https://github.com/google/subpar",
+ tag = "1.0.0",
+)
+
+# Test data for WHL tool testing.
+http_file(
+ name = "grpc_whl",
+ sha256 = "c232d6d168cb582e5eba8e1c0da8d64b54b041dd5ea194895a2fe76050916561",
+ # From https://pypi.python.org/pypi/grpcio/1.6.0
+ url = ("https://pypi.python.org/packages/c6/28/" +
+ "67651b4eabe616b27472c5518f9b2aa3f63beab8f62100b26f05ac428639/" +
+ "grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl"),
+)
+
+http_file(
+ name = "futures_whl",
+ sha256 = "c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f",
+ # From https://pypi.python.org/pypi/futures
+ url = ("https://pypi.python.org/packages/a6/1c/" +
+ "72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/" +
+ "futures-3.1.1-py2-none-any.whl"),
+)
+
+http_file(
+ name = "mock_whl",
+ sha256 = "5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1",
+ # From https://pypi.python.org/pypi/mock
+ url = ("https://pypi.python.org/packages/e6/35/" +
+ "f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/" +
+ "mock-2.0.0-py2.py3-none-any.whl"),
+)
+
+# Imports for examples
+pip_import(
+ name = "examples_helloworld",
+ requirements = "//examples/helloworld:requirements.txt",
+)
+
+load(
+ "@examples_helloworld//:requirements.bzl",
+ _helloworld_install = "pip_install",
+)
+
+_helloworld_install()
+
+pip_import(
+ name = "examples_version",
+ requirements = "//examples/version:requirements.txt",
+)
+
+load(
+ "@examples_version//:requirements.bzl",
+ _version_install = "pip_install",
+)
+
+_version_install()