Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fede517

Browse filesBrowse files
Exposed docs for compile_pip_requirements (bazel-contrib#534)
Co-authored-by: Alex Eagle <eagle@post.harvard.edu>
1 parent c303849 commit fede517
Copy full SHA for fede517

File tree

7 files changed

+47
-11
lines changed
Filter options

7 files changed

+47
-11
lines changed

‎docs/BUILD

Copy file name to clipboardExpand all lines: docs/BUILD
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ bzl_library(
5959
srcs = [
6060
"//python/pip_install:pip_repository.bzl",
6161
"//python/pip_install:repositories.bzl",
62+
"//python/pip_install:requirements.bzl",
63+
],
64+
deps = [
65+
":defs",
6266
],
6367
)
6468

‎docs/pip.md

Copy file name to clipboardExpand all lines: docs/pip.md
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
22

3+
<a name="#compile_pip_requirements"></a>
4+
5+
## compile_pip_requirements
6+
7+
<pre>
8+
compile_pip_requirements(<a href="#compile_pip_requirements-name">name</a>, <a href="#compile_pip_requirements-extra_args">extra_args</a>, <a href="#compile_pip_requirements-visibility">visibility</a>, <a href="#compile_pip_requirements-requirements_in">requirements_in</a>, <a href="#compile_pip_requirements-requirements_txt">requirements_txt</a>, <a href="#compile_pip_requirements-tags">tags</a>,
9+
<a href="#compile_pip_requirements-kwargs">kwargs</a>)
10+
</pre>
11+
12+
Macro creating targets for running pip-compile
13+
14+
Produce a filegroup by default, named "[name]" which can be included in the data
15+
of some other compile_pip_requirements rule that references these requirements
16+
(e.g. with `-r ../other/requirements.txt`)
17+
18+
Produce two targets for checking pip-compile:
19+
20+
- validate with `bazel test <name>_test`
21+
- update with `bazel run <name>.update`
22+
23+
24+
**PARAMETERS**
25+
26+
27+
| Name | Description | Default Value |
28+
| :-------------: | :-------------: | :-------------: |
29+
| name | base name for generated targets, typically "requirements" | none |
30+
| extra_args | passed to pip-compile | <code>[]</code> |
31+
| visibility | passed to both the _test and .update rules | <code>["//visibility:private"]</code> |
32+
| requirements_in | file expressing desired dependencies | <code>None</code> |
33+
| requirements_txt | result of "compiling" the requirements.in file | <code>None</code> |
34+
| tags | tagging attribute common to all build rules, passed to both the _test and .update rules | <code>None</code> |
35+
| kwargs | other bazel attributes passed to the "_test" rule | none |
36+
37+
338
<a name="#pip_import"></a>
439

540
## pip_import

‎examples/pip_install/BUILD

Copy file name to clipboardExpand all lines: examples/pip_install/BUILD
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load(
66
"requirement",
77
)
88
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
9-
load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements")
9+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
1010

1111
# Toolchain setup, this is optional.
1212
# Demonstrate that we can use the same python interpreter for the toolchain and executing pip in pip install (see WORKSPACE).

‎examples/pip_parse/BUILD

Copy file name to clipboardExpand all lines: examples/pip_parse/BUILD
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load("@pip_parsed_deps//:requirements.bzl", "entry_point", "requirement")
22
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
3-
load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements")
3+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
44

55
# Toolchain setup, this is optional.
66
# Demonstrate that we can use the same python interpreter for the toolchain and executing pip in pip install (see WORKSPACE).

‎python/pip.bzl

Copy file name to clipboardExpand all lines: python/pip.bzl
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
load("//python/pip_install:pip_repository.bzl", "pip_repository")
1717
load("//python/pip_install:repositories.bzl", "pip_install_dependencies")
18+
load("//python/pip_install:requirements.bzl", _compile_pip_requirements = "compile_pip_requirements")
19+
20+
compile_pip_requirements = _compile_pip_requirements
1821

1922
def pip_install(requirements, name = "pip", **kwargs):
2023
"""Imports a `requirements.txt` file and generates a new `requirements.bzl` file.

‎python/pip_install/BUILD

Copy file name to clipboardExpand all lines: python/pip_install/BUILD
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ filegroup(
1313

1414
filegroup(
1515
name = "bzl",
16-
srcs = [
17-
"pip_repository.bzl",
18-
"repositories.bzl",
19-
],
16+
srcs = glob(["*.bzl"]),
2017
visibility = ["//:__pkg__"],
2118
)
2219

2320
exports_files(
24-
[
25-
"pip_repository.bzl",
26-
"repositories.bzl",
27-
],
21+
glob(["*.bzl"]),
2822
visibility = ["//docs:__pkg__"],
2923
)

‎python/pip_install/requirements.bzl

Copy file name to clipboardExpand all lines: python/pip_install/requirements.bzl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"Rules to verify and update pip-compile locked requirements.txt"
1+
"""Rules to verify and update pip-compile locked requirements.txt"""
22

33
load("//python:defs.bzl", "py_binary", "py_test")
44
load("//python/pip_install:repositories.bzl", "requirement")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.