You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.
This library's current definition of Bazel external dependencies makes it awkward to integrate into other projects. There are two main issues:
Defining deps in WORKSPACE prevents them from being imported into other workspaces with load(), so I have to copy-paste a bunch of implementation details. Other downstreams have similar issues, for example rules_docker/container/container.bzl needs full copies of same dep definitions.
Python import path handling gets very confused if the name of the dependency is the same as the library being imported. There are workarounds such as renaming files (as you're doing for six), but a better solution is to give the deps non-conflicting names. A Java-style domain-plus-path format is common among OSS and Google-managed libraries.
Example code:
# containerregistry/build/deps.bzldefdeps():
native.new_http_archive(
name="org_pypi_python_six",
url="https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz",
sha256="e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5",
strip_prefix="six-1.9.0",
build_file_content="""py_library( name = "six", srcs = ["six.py"], visibility = ["//visibility:public"], )""",
)
new_git_repository(
name="com_github_httplib2_httplib2",
remote="https://github.com/httplib2/httplib2",
commit="1ae16e0e8e868e4b81225631ee37c6555493014b", # v0.10.3build_file_content="""py_library( name = "python2_httplib2", srcs = glob(["python2/httplib2/**/*.py"]), data = ["python2/httplib2/cacerts.txt"], imports = ["python2"], visibility = ["//visibility:public"] )""",
)
new_git_repository(
name="com_github_google_oauth2client",
remote="https://github.com/google/oauth2client",
commit="a731be362014d61630044c46495c5b750437ab88", # v4.0.0build_file_content="""py_library( name = "oauth2client", srcs = glob(["oauth2client/**/*.py"]), visibility = ["//visibility:public"], deps = [ "@com_github_httplib2_httplib2//:python2_httplib2", "@org_pypi_python_six//:six", ] )""",
)
# ... and so on
The text was updated successfully, but these errors were encountered:
This kind of encapsulation is really awkward in Bazel (for folks themselves writing libraries) regardless because I cannot load this symbol to call from it's repositories() method.
This is more or less the only reason I'm not using rules_python for this stuff.
This library's current definition of Bazel external dependencies makes it awkward to integrate into other projects. There are two main issues:
Defining deps in
WORKSPACE
prevents them from being imported into other workspaces withload()
, so I have to copy-paste a bunch of implementation details. Other downstreams have similar issues, for examplerules_docker/container/container.bzl
needs full copies of same dep definitions.Python import path handling gets very confused if the name of the dependency is the same as the library being imported. There are workarounds such as renaming files (as you're doing for
six
), but a better solution is to give the deps non-conflicting names. A Java-style domain-plus-path format is common among OSS and Google-managed libraries.Example code:
The text was updated successfully, but these errors were encountered: