Skip to content

pip_library outputs typically contain the none module from PyPI #313

Description

@chrisnovakovic

This happens whenever a pip_library is declared without pip_flags and the PipFlags plugin configuration option is also unset:

$ plz build //third_party/python:wheel_filename
Build finished; total time 40ms, incrementality 50.0%. Outputs:
//third_party/python:wheel_filename:
  plz-out/gen/third_party/python/wheel_filename.whl
$ unzip -l plz-out/gen/third_party/python/wheel_filename.whl
Archive:  plz-out/gen/third_party/python/wheel_filename.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     1175  2001-01-01 00:00   third_party/python/AUTHORS.rst
     6934  2001-01-01 00:00   third_party/python/CONTRIBUTORS.rst
      720  2001-01-01 00:00   third_party/python/none/__init__.py
    20253  2001-01-01 00:00   third_party/python/none/callable.py
      681  2001-01-01 00:00   third_party/python/none/collection/__init__.py
    25229  2001-01-01 00:00   third_party/python/none/collection/a.py
     2314  2001-01-01 00:00   third_party/python/none/collection/i.py
      662  2001-01-01 00:00   third_party/python/none/hash/__init__.py
      656  2001-01-01 00:00   third_party/python/none/hash/cdc/__init__.py
    14141  2001-01-01 00:00   third_party/python/none/hash/cdc/fastcdc.py
    11372  2001-01-01 00:00   third_party/python/none/hash/tree.py
        0  2001-01-01 00:00   third_party/python/none/py.typed
      640  2001-01-01 00:00   third_party/python/none/task/__init__.py
    29149  2001-01-01 00:00   third_party/python/none/task/abc.py
      679  2001-01-01 00:00   third_party/python/none/text/__init__.py
     3470  2001-01-01 00:00   third_party/python/none/text/case.py
     1063  2001-01-01 00:00   third_party/python/none/typeset.py
     5522  2001-01-01 00:00   third_party/python/none/url.py
        4  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/INSTALLER
     1182  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/LICENSE.rst
     3024  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/METADATA
     1827  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/RECORD
        0  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/REQUESTED
       83  2001-01-01 00:00   third_party/python/none-0.1.1.dist-info/WHEEL
     3736  2001-01-01 00:00   third_party/python/wheel_filename/__init__.py
        0  2001-01-01 00:00   third_party/python/wheel_filename/py.typed
        4  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/INSTALLER
     1095  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/LICENSE
     4790  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/METADATA
      778  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/RECORD
        0  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/REQUESTED
       92  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/WHEEL
       15  2001-01-01 00:00   third_party/python/wheel_filename-1.3.0.dist-info/top_level.txt
---------                     -------
   141290                     33 files

It happens because {pip_flags} is stringified as None here:

pip_cmd += f' {repo_flag} {index_flag} {pip_flags} {package_name}'

so the arguments passed to pip end up being none and the name and version of the module to install, and none is actually the name of a module on PyPI so pip installs that as well as the desired module instead of failing.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions