cloud-custodian/cel-python

Problem building wheel from source (tar.gz)

Closed this issue · 2 comments

We are building wheels from source but we are having some issues.

Issues with building from source:

  • missing requirements.txt in tar.gz
  • wrong name in pyproject.toml -> celpy instead of cel-python ...
  • wrong version in pyproject.toml -> 0.0 but should be resolved in tar.gz
  • missing tag 0.1.5 in git
wget https://files.pythonhosted.org/packages/b3/9e/c3af4a83cbe8108cff92b0588b7ac53efc41fcaf1ffd09d07dc68c9b5d27/cel-python-0.1.5.tar.gz
pip wheel cel-python-0.1.5.tar.gz
(.venv) ➜  pip wheel cel-python-0.1.5.tar.gz
Processing ./cel-python-0.1.5.tar.gz
  File was already downloaded /Users/myuser/projects/myproject/cel-python-0.1.5.tar.gz
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      Traceback (most recent call last):
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 396, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/Users/myuser/projects/myproject/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 41, in <module>
        File "/Users/myuser/.pyenv/versions/3.11.2/lib/python3.11/pathlib.py", line 1058, in read_text
          with self.open(mode='r', encoding=encoding, errors=errors) as f:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/myuser/.pyenv/versions/3.11.2/lib/python3.11/pathlib.py", line 1044, in open
          return io.open(self, mode, buffering, encoding, errors, newline)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/l6/nmk965l50gv_90_c4xh5x0_4ctpk94/T/pip-req-build-lvkahb56/requirements.txt'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
kapilt commented

pip wheel isn't for processing source tarballs of a release.

Of course it is ... it works for like 99% even pip install uses it internally. Our company policy is to build and install everything from source. So we can fix wahtever is needed.

Esentially try this and you will get the same error:

pip install --no-binary cel-python --index-url=https://pypi.python.org/simple cel-python==0.1.5
It will crash just the same.

You can try any other project and it will just work. it will download source distribution and build it.
Basically tar.gz should be source distribution (sdist) that you can build a wheel.

More info:
https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-format
https://packaging.python.org/en/latest/glossary/#term-Source-Distribution-or-sdist

Source Distribution (or “sdist”):
A distribution format usually generated using python -m build --sdist) that provides metadata and the 
essential source files needed for installing by a tool like pip,  or for generating a Built Distribution.

What is the point of providing a source that you can not even build it (because it is not complete).

And you ignored the part about missing all the tags for published versions. How to check from what hash wheels were created and published???