Open loic-seguin opened 1 day ago
I have found the problem I think, the paths property is not present in my openapi.yaml because I don't need any APIs for now. I just need the models to be generated. It should also work without paths property in the yaml. Trying to fix the problem in a PR.
Bug Report Checklist
Description
I generate a python client based on my really simple openapi.yaml. But the setup.py that is generated does not contain the setup() method. So it is not possible to import this library with poetry or pip.
openapi-generator version
7.9.0 but it seems to have the same issue on 7.0.0
OpenAPI declaration file content or url
Generation Details
openapi-generator-cli generate -i openapi.yaml -g python -o ./generated-python-client
Steps to reproduce
openapi-generator-cli generate -i openapi.yaml -g python -o ./generated-python-client
[tool.poetry.dependencies] python = "^3.10" openapi-client = {path="../generated-python-client/"}
[build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"
poetry install Updating dependencies Resolving dependencies... (0.5s)
Package operations: 1 install, 0 updates, 0 removals
Installing openapi-client (1.0.0 /home/lseguin/Documents/github_describe_issue/generated-python-client): Failed
ChefBuildError
Backend subprocess exited when trying to invoke build_wheel
Traceback (most recent call last): File "/home/lseguin/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in
main()
File "/home/lseguin/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
File "/home/lseguin/.local/share/pypoetry/venv/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel
return _build_backend().build_wheel(
File "/tmp/tmp8o7fzmxu/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 435, in build_wheel
return _build(['bdist_wheel'])
File "/tmp/tmp8o7fzmxu/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 426, in _build
return self._build_with_temp_dir(
File "/tmp/tmp8o7fzmxu/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 409, in _build_with_temp_dir
result_basename = _file_with_extension(tmp_dist_dir, result_extension)
File "/tmp/tmp8o7fzmxu/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 128, in _file_with_extension
raise ValueError(
ValueError: No distribution was found. Ensure that
setup.py
is not empty and that it callssetup()
.at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare 160│ 161│ error = ChefBuildError("\n\n".join(message_parts)) 162│ 163│ if error is not None: → 164│ raise error from None 165│ 166│ return path 167│ 168│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with openapi-client (1.0.0 /home/lseguin/Documents/github_describe_issue/generated-python-client) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "openapi-client @ file:///home/lseguin/Documents/github_describe_issue/generated-python-client"'.
from setuptools import setup, find_packages
NAME = "openapi-client" VERSION = "1.0.0" PYTHON_REQUIRES = ">=3.7" setup(name=NAME,version=VERSION,python_requires=PYTHON_REQUIRES)