Skip to content

Commit 08bdc52

Browse files
pybind11_abseil authorscopybara-github
authored andcommitted
Update README for consistency with internal files. Document around issue with transitive dependency discovery for Bzlmod with http_archive.
PiperOrigin-RevId: 607701389
1 parent 9673d12 commit 08bdc52

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

README.md

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ pybind11_abseil can be built with Bazel or CMake. Instructions for both are belo
2323

2424
### Bazel
2525

26+
In your BUILD file:
27+
28+
```
29+
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
30+
```
31+
2632
#### Bzlmod
2733

2834
You can depend on the Bazel module and dependencies via one of the following commands in your MODULE.bazel:
@@ -37,13 +43,27 @@ bazel_dep(
3743

3844
To depend on floating master:
3945
```
40-
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
46+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4147
42-
git_repository(
43-
name = "pybind11_abseil",
44-
remote = "https://github.com/pybind/pybind11_abseil.git",
45-
branch = "master",
48+
http_archive(
49+
name = "pybind11_bazel",
50+
strip_prefix = "pybind11_bazel-master",
51+
urls = ["https://github.com/pybind/pybind11_bazel/archive/refs/heads/master.tar.gz"],
4652
)
53+
54+
http_archive(
55+
name = "pybind11",
56+
build_file = "@pybind11_bazel//:pybind11.BUILD",
57+
strip_prefix = "pybind11-master",
58+
urls = ["https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz"],
59+
)
60+
61+
http_archive(
62+
name = "pybind11_abseil",
63+
strip_prefix = "pybind11_abseil_master"
64+
urls = ["https://github.com/pybind/pybind11_abseil/refs/heads/master.tar.gz"],
65+
)
66+
4767
```
4868

4969
#### WORKSPACE
@@ -55,36 +75,25 @@ You will need to depend on `pybind11`, `pybind11_bazel`(see
5575
`pybind11_abseil`, e.g.
5676

5777
```
58-
git_repository(
59-
name = "pybind11_bazel",
60-
remote = "https://github.com/pybind/pybind11_bazel.git",
61-
branch = "master",
78+
http_archive(
79+
name = "pybind11_bazel",
80+
strip_prefix = "pybind11_bazel-master",
81+
urls = ["https://github.com/pybind/pybind11_bazel/archive/refs/heads/master.tar.gz"],
6282
)
6383
6484
http_archive(
6585
name = "pybind11",
6686
build_file = "@pybind11_bazel//:pybind11.BUILD",
67-
strip_prefix = "pybind11-2.6.2",
68-
sha256 = "8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2",
69-
urls = ["https://github.com/pybind/pybind11/archive/v2.6.2.tar.gz"],
87+
strip_prefix = "pybind11-master",
7088
)
7189
72-
load("@pybind11_bazel//:python_configure.bzl", "python_configure")
73-
python_configure(name = "local_config_python")
74-
75-
git_repository(
76-
name = "pybind11_abseil",
77-
remote = "https://github.com/pybind/pybind11_abseil.git",
78-
branch = "master",
90+
http_archive(
91+
name = "pybind11_abseil",
92+
strip_prefix = "pybind11_abseil_master",
93+
urls = ["https://github.com/pybind/pybind11_abseil/refs/heads/master.tar.gz"],
7994
)
8095
```
8196

82-
Then, in your BUILD file:
83-
84-
```
85-
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
86-
```
87-
8897
### CMake
8998

9099
In your project, add a FetchContent for pybind11_abseil. This will also fetch the

0 commit comments

Comments
 (0)