Based on this comment on a GitHub issue, adding the following lines to your pyproject.toml
might solve your problem:
[tool.setuptools]
py-modules = []
(For my case, the other workaround provided in that comment, i.e. adding py_modules=[]
as a keyword argument to the setup() function in setup.py
worked)