flit icon indicating copy to clipboard operation
flit copied to clipboard

requirementslib/pipenv not getting name of requirement from flint_core.buildapi

Open matteius opened this issue 2 years ago • 1 comments

Hi there, I am not super familiar with flit, but I was triaging an issue report on pipenv that brought me here. The issue that was reported (https://github.com/pypa/pipenv/issues/5142) has an example reproduction repository (https://github.com/gitpushdashf/pipenv-flit-monorepo-example) that uses flint_core.buildapi for the package build. At first I thought the failure of resolving the interdependent local editable packages had to do with the existence of a pyprojecct.toml because when I deleted it and had just a setup.py, I saw that the issue was not present. However I then noticed from a diff with the test repository that pipenv/setuptools generated a pyproject.toml file anyway, just a different build_system:

+++ b/packages/foo-cli/pyproject.toml
@@ -1,9 +1,3 @@
 [build-system]
-requires = ["flit_core >=3.2,<4"]
-build-backend = "flit_core.buildapi"
-
-[project]
-name = "foo_cli"
-authors = [{name = "me", email = "me@me"}]
-dynamic = ["version", "description"]
-dependencies = ["fooy"]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta:__legacy__"

So I had done some debugging on the pipenv code enough to realize that what is missing on the parsed Requirement (which is a requirementslib thing) that it is missing the name attribute, and quite a lot is dependent on that being in the Metadata. At this phase of my investigation, I can only assume that flit is generating metadata differently than setuptools.build_meta:__legacy__ and that the data isn't all there. I tried a search of the flit issues reports and I did not quite see one like this, and wanted to see if anyone else could shed some light on this one for me. In an ideal world anyone could use the flit build system with pipenv just fine, and so it would be nice to get to the bottom of what/where actually needs to be fixed.

matteius avatar Jun 25 '22 11:06 matteius

Where should this metadata come from? I wonder if the name attribute could be read from [project] but not sure if that's the right behavior.

Edit: Looks like it might come from here? https://github.com/pypa/flit/blob/ec6e6b7c8994d5e79d0fd951d9e4c26a7c5d9977/flit_core/flit_core/common.py#L394

gitpushdashf avatar Jun 30 '22 18:06 gitpushdashf