Skip to content
This repository was archived by the owner on Oct 20, 2020. It is now read-only.
This repository was archived by the owner on Oct 20, 2020. It is now read-only.

Problem with importing azure.eventhub.extensions.checkpointstoreblob #56

@pjachowi

Description

@pjachowi

I am not sure if the problem should by fixed on Azure package design or can be fixed in this project.

I have a problem with azure.eventhub.extensions.checkpointstoreblob. Attempt to import it ends with an error

$ bazel run :main
INFO: Analyzed target //:main (18 packages loaded, 672 targets configured).
INFO: Found 1 target...
Target //:main up-to-date:
  bazel-bin/main
INFO: Elapsed time: 5.008s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Traceback (most recent call last):
  File "/home/pjachowi/.cache/bazel/_bazel_pjachowi/0be77f5cbe63ebeec7251d4b492b30cb/execroot/example_repo/bazel-out/k8-fastbuild/bin/main.runfiles/example_repo/main.py", line 1, in <module>
    from azure.eventhub.extensions.checkpointstoreblob import BlobCheckpointStore
ModuleNotFoundError: No module named 'azure.eventhub.extensions.checkpointstoreblob'

What I suspect, having limited knowledge about Python packaging machinery, azure-eventhub-checkpointstoreblob has dependency on azure-eventhub. The azure-eventhub contains directory azure/eventhub/extensions consisting only __init__.py which terminates search for azure.eventhub.extensions package:

$ ls ./bazel-bin/main.runfiles/example_repo/external/pip/pypi__azure_eventhub/azure/eventhub/extensions
__init__.py
$ ls ./bazel-bin/main.runfiles/example_repo/external/pip/pypi__azure_eventhub_checkpointstoreblob/azure/eventhub/extensions
checkpointstoreblob  __init__.py

To reproduce the problem one needs four files in the same directory: WORKSPACE, BUILD, requirements.txt, and main.py:
WORKSPACE (same as in the example directory):

workspace(name = "example_repo")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz",
    strip_prefix = "rules_python-0.0.2",
    sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

local_repository(
    name = "rules_python_external",
    path = "../",
)

load("@rules_python_external//:repositories.bzl", "rules_python_external_dependencies")

rules_python_external_dependencies()

load("@rules_python_external//:defs.bzl", "pip_install")

pip_install(
    requirements = "//:requirements.txt",
)

BUILD:

load("@pip//:requirements.bzl", "requirement")

py_binary(
    name = "main",
    srcs = ["main.py"],
    deps = [
        requirement("azure-eventhub-checkpointstoreblob"),
    ],
)

requirements.txt:

azure-eventhub-checkpointstoreblob==1.1.0

main.py:

from azure.eventhub.extensions.checkpointstoreblob import BlobCheckpointStore

if __name__ == "__main__":
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions