pypa/pip

Modify pip build behavior to better support tools like setuptools_scm

toumorokoshi opened this issue · 6 comments

What's the problem this feature will solve?

Currently, setuptools_scm does not support the ability to detect the version of the package if the package root is nested in the vcs root: pypa/setuptools_scm#357

It would be great if there could be some reconciliation on the pip or setuptools_scm side to better support version-control based version strings.

Describe the solution you'd like

As I understand it currently, pip install copies the contents of the package directory into a temp directory, then uses that to build the package.

setuptools_scm is then unable to retrieve the metadata of the vcs system, as the parent directory contains the configuration for the version control system. e.g. for git, the .git directory does not exist in a child directory.

I don't have a clear approach on a solution, but I'm happy to contribute the needed code. I guess as a starter, if there was a way to hook retrieval of information before the directory copy (e.g. letting setuptools_scm write a file somewhere).

conversely if there was a marker to the original source directory, allowing someone to read that information, then setuptools_scm could resolve the version control directory.

Alternative Solutions

Additional context

If there's a better forum to have this discussion, i'm happy to move the conversation there.

This relates to #3500. You can start reading at #3500 (comment)

This should be resolved by #7882 (build local directories in place).

We have now (per #7951) published a beta release of pip, pip 20.1b1. This release includes #7882, which implemented a solution for this issue.

I hope participants in this issue will help us by testing the beta and checking for new bugs. We'd like to identify and iron out any potential issues before the main 20.1 release on Tuesday.

I also welcome positive feedback along the lines of "yay, it works better now!" as well, since the issue tracker is usually full of "issues". :)

Unfortunately, there have been a number of issues with the implementation of in-place builds (which are being tracked under #7555) which means that for now, we need to revert #7882. As a result, this issue will become a problem again, and we'll therefore be reopening it. Longer-term, we hope to have a solution that addresses the issues that in-place builds solved, but without the impact on other workflows that the current solution had.

Sorry for the disruption that this will cause.

@pradyunsg thanks for the heads up! FWIW I did test the pip beta you posted and it worked for my usecase. So thanks for the trying to make this happen. I may followup later if I'm able to scrounge up some time to contribute a fix.

#7555 is resolved again! :)