Fix package installation in Nox sessions with non-final release versions#487
Merged
Fix package installation in Nox sessions with non-final release versions#487
Conversation
added 3 commits
August 1, 2020 19:21
Extract the basename of the wheel from the output of `poetry build`. Poetry writes the name of the wheel to stdout, as the last item when splitting by whitespace.
This was referenced Aug 1, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Locate the wheel using Poetry's build output when installing the package into Nox sessions.
This resolves an issue with the previous implementation, which constructed the wheel name using the output of
poetry version. As Poetry uses semver-style versions (0.0.1-alpha.0) instead of PEP 440 (0.0.1a0), this breaks for non-final releases such as pre-releases.Closes #470
Rejected Ideas
Install the package using
pip install .Using
session.install(".")to build and install the package would have been the preferred approach. Unfortunately, this would have slowed down Nox runs at lot, both due to out-of-tree builds and the necessity to install Poetry as the build backend on each invocation.Using the
build_wheelAPIAnother option might have been to use Poetry's implementation of the interface specified by PEP 517. The
build_wheelAPI returns the basename of the.whlfile. However, this would have required to import the Poetry libraries, which are not installed in the Nox session.Wipe out the
distdirectory beforehand and take whatever wheel we find.While a simple way out, this comes at the cost of deleting build artifacts without user consent.
Perform (enough of) the version-style conversion ourselves.
This would have bloated the noxfile or added a global dependency for users.