bryanyang0528 / ksql-python

A python wrapper for the KSQL REST API.
MIT License
158 stars 64 forks source link

Incompatibility with pep517 and Installation Failure #124

Open shahinism opened 1 year ago

shahinism commented 1 year ago

Description: The ksql-python package encounters compatibility issues with pep517 during installation using tools where this pep is considered the default, resulting in the following error:

❯ python -m pip wheel --use-pep517 .
Processing /home/shahin/projects/oss/ksql-python
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/nix/store/dm99mzlng40fq8cccq3vdlkam98i1v6n-devenv-profile/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/nix/store/dm99mzlng40fq8cccq3vdlkam98i1v6n-devenv-profile/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/nix/store/dm99mzlng40fq8cccq3vdlkam98i1v6n-devenv-profile/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-vuq_mqb9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-vuq_mqb9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-vuq_mqb9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-vuq_mqb9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'pip'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip

As a result of this issue, package managers compatible with pep517, such as poetry and pdm, are unable to install the ksql-python package, displaying the aforementioned error message.

Upon further investigation, I have identified the root cause of the problem. The setup.py file includes an unused import statement:

import pip

if LooseVersion(pip.__version__) >= "10.0.0":
    from pip._internal.req import parse_requirements
else:
    from pip.req import parse_requirements

Will open a PR to address it.

michaeljoseph commented 1 year ago

Duplicate of #117.

sheinbergon commented 4 months ago

Hello @shahinism @michaeljoseph

I've forked the code, modernized it (replaced hyper with HTTPX, bumped all dependencies, updated to Python 3.9 as the minimal version, and fixed all the tests to behave with latest KSQL DB behavior. I've also fixed this issue along the way, I believe.

https://github.com/sheinbergon/ksql-python-ng

I'll be making a PYPI release soon enough. In the meanwhile, you can test it by running

pipx install git+https://github.com/sheinbergon/ksql-python-ng.git --include-deps

or

pip install git+https://github.com/sheinbergon/ksql-python-ng.git