Incompatibility: rules_poetry and git-based dependencies

XMLWordPrintableJSON

    • DevProd Test Infrastructure
    • Fully Compatible
    • DevProd Test Infra 2026-06-16, DevProd Test Infra 2026-06-30, DevProd Test Infra 2026-07-14, DevProd Test Infra 2026-07-28, DevProd Test Infra 2026-08-11
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      rules_poetry does not seem to work for the kmip dependency, which is specified as a git-based dependency:

      https://github.com/10gen/mongo/blob/2d3859b5d3b89ccbc147d73654ebde16681612e6/pyproject.toml#L155

      PyKMIP = {git = "https://github.com/mongodb-forks/PyKMIP.git", rev = "c48cb01635819e478b573e3245ef840a11d78865"} 

      Try to use in a rule like:

      py_binary(
          name = "kmip_server",
          srcs = ["kmip_server.py"],
          deps = [
              dependency(
                  "pykmip",
                  group = "testing",
              ),
          ],
      ) 

      See error:

      ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/438e730df43f16e18dd90600e6cbe8fb/external/poetry/BUILD: no such target '@@poetry//:library_pykmip': target 'library_pykmip' not declared in package '' defined by /home/ubuntu/.cache/bazel/_bazel_ubuntu/438e730df43f16e18dd90600e6cbe8fb/external/poetry/BUILD (did you mean library_pip, library_pipx, library_pkce, library_psutil, library_py, library_pyasn1, library_pyjwt, library_pynacl, library_pytz, or library_pyyaml?)[ 

      Claude-generated analysis:

      The root cause is clear: rules_poetry explicitly skips git-sourced packages when generating BUILD targets (line 226-229 of poetry.bzl), but dependencies.bzl still maps "pykmip" to the non-existent @poetry//:library_pykmip.

      There are three viable paths to fix this properly:

      Option 1 — http_archive in WORKSPACE.bazel (practical, no source changes)
      Download the PyKMIP commit as a GitHub tarball, define a py_library target, and reference it directly in BUILD.bazel instead of via dependency().

      Option 2 — Patch rules_poetry (principled, fixes the root of the mismatch)
      Extend bazel/rules_poetry/rules_poetry.patch to generate a new_git_repository rule for git-sourced packages so the generated library_pykmip target actually exists.
      Option 3 — Vendor in src/third_party/ (heaviest, most hermetic)
      Copy PyKMIP source (119 files) into src/third_party/pykmip/ with a py_library, like mock_ocsp_responder is handled.

       

      Blocks conversion of replica_sets_with_priority_ports, but likely other suites that include fcbis_with_ese_ocsp.js.

      bazel test //jstests/suites/catalog-and-routing:replica_sets_with_priority_ports --test_sharding_strategy=disabled --test_arg=src/mongo/db/modules/enterprise/jstests/fcbis/fcbis_with_ese_ocsp.js

            Assignee:
            Sean Lyons
            Reporter:
            Sean Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: