Skip to content

py_console_script_binary fails mypy [func-returns-value] #3126

@tpudlik

Description

@tpudlik

🐞 bug report

Affected Rule

The issue is caused by the rule: py_console_script_binary

Is this a regression?

I don't believe so.

Description

When running mypy on a py_console_script_binary wrapping a pip package (in this case, black), I get an error:

bazel-out/k8-fastbuild/bin/[path in my repo]/rules_python_entry_point_black.py:19: error: "patched_main" does not return a value (it only ever returns None)  [func-returns-value]

The issue is basically that the {entry_point} being wrapped here may not have a return value.

🔬 Minimal Reproduction

I don't know if this is minimal enough for you, but:

git clone https://pigweed.googlesource.com/pigweed/pigweed
cd pigweed
git fetch https://pigweed.googlesource.com/pigweed/pigweed refs/changes/73/309473/1 && git checkout -b change-309473 FETCH_HEAD
bazelisk build --config=mypy //pw_presubmit/py:black

🔥 Exception or Error

bazel-out/k8-fastbuild/bin/[path in my repo]/rules_python_entry_point_black.py:19: error: "patched_main" does not return a value (it only ever returns None)  [func-returns-value]

🌍 Your Environment

Operating System:

  
Linux
  

Output of bazel version:

  
8.1.0
  

Rules_python version:

  
0.40.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions