Reliably accessing/finding the origin source dist/egg-info folder pip creates when doing out of tree builds

when pip does out of tree builds, i am observing acute lack of metadata for setuptools_scm,
and i wonder if there is a reliable way to get the correct metadata folder to get the version that was generated for the original source folder to the unpacked source folder.

With experimentation o found a few potential names, but within the pip source code i found no good way to gather al of the possible locations (and users sometimes end up with bad metadata due to pip simply destroying access to it)

so i’m looking for suggestions or a known good way to look the metadata up

I don’t understand the issue - can you clarify? I don’t know anything about setuptools_scm,so I’m not clear what metadata you’re referring to, or how out of tree builds make a difference here.

Presumably this is a problem that has existed for a long time, as pip has always done out of tree builds?

in certain situations the folder pip is using disappears or is not available
before i used a hack to find the folder relative to the setup.py file,
but i obtained the name with experiment, and in recent pip version users hit situations where it wont exist like that and thus get no metadata

when i skimmed the code on git i didn’t find a good indication of what folder names will be used, so im unable to fetch the metadata in cases i cant even replicate in experiments

@RonnyPfannschmidt pip 20.1 now calls setup.py egg_info with the --egg-base option to generate metadata into a temporary directory. Does that relate?

Potentially, is there any reliable way to access it?