Skip to content

Cannot depend on apache-airflow with extras (e.g. [kubernetes] or [postgres,statsd,kubernetes] ) #439

@thekyz

Description

@thekyz

🐞 bug report

Affected Rule

The issue is caused by the rule: pip_install

Is this a regression?

Tried on older versions, issue was there already.

Description

Cannot install apache-airflow

🔬 Minimal Reproduction

Code available in the repo here: https://github.com/thekyz/snippets/tree/master/rule_python_issue_with_apache-airflow

Specifically the issue is with the requirement function in here : https://github.com/thekyz/snippets/blob/b34ef1b6dcd54c26a698b0286edaed165ec4a872/rule_python_issue_with_apache-airflow/BUILD#L31

py_binary(
    name = "hello",
    srcs = [
        "hello.py",
    ],
    deps = [
        requirement("apache-airflow[postgres,statsd,kubernetes]"),
    ],
)

🔥 Exception or Error

ERROR: /home/thekyz/dev/snippets/rule_python_issue_with_apache-airflow/BUILD:25:10: no such package '@pip//pypi__apache_airflow[postgres,statsd,kubernetes]': BUILD file not found in directory 'pypi__apache_airflow[postgres,statsd,kubernetes]' of external repository @pip. Add a BUILD file to a directory to mark it as a package. and referenced by '//:hello'

🌍 Your Environment

Operating System:

Ubuntu 20.04

Output of bazel version:

Build label: 4.0.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Jan 21 07:33:24 2021 (1611214404)
Build timestamp: 1611214404
Build timestamp as int: 1611214404

Rules_python version:

0.1.0, tried with master as well, same issue

Anything else relevant?

If I get rid of the extras in the BUILD file requirement (replace requirement("apache-airflow[postgres,statsd,kubernetes]") with `requirement("apache-airflow") I get this instead:

ERROR: /home/thekyz/.cache/bazel/_bazel_thekyz/1db85497883e553a1d95bd5ce881c422/external/pip/pypi__apache_airflow/BUILD:5:11: in py_library rule @pip//pypi__apache_airflow:pypi__apache_airflow: cycle in dependency graph:
    //:hello
.-> @pip//pypi__apache_airflow:pypi__apache_airflow
|   @pip//pypi__apache_airflow_providers_cncf_kubernetes:pypi__apache_airflow_providers_cncf_kubernetes
`-- @pip//pypi__apache_airflow:pypi__apache_airflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions