Skip to content

Fix package installation in Nox sessions with non-final release versions#487

Merged
cjolowicz merged 3 commits intomasterfrom
retrocookie-pr/fix-nox-prerelease
Aug 1, 2020
Merged

Fix package installation in Nox sessions with non-final release versions#487
cjolowicz merged 3 commits intomasterfrom
retrocookie-pr/fix-nox-prerelease

Conversation

@cjolowicz
Copy link
Owner

@cjolowicz cjolowicz commented Aug 1, 2020

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_wheel API

    Another option might have been to use Poetry's implementation of the interface specified by PEP 517. The build_wheel API returns the basename of the .whl file. However, this would have required to import the Poetry libraries, which are not installed in the Nox session.

  • Wipe out the dist directory 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.

Claudio Jolowicz 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.
@cjolowicz cjolowicz added the bug Something isn't working label Aug 1, 2020
@cjolowicz cjolowicz added this to the 2020.8.15 milestone Aug 1, 2020
@cjolowicz cjolowicz merged commit 0e620e4 into master Aug 1, 2020
@cjolowicz cjolowicz deleted the retrocookie-pr/fix-nox-prerelease branch August 1, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected behaviour with beta version numbers

1 participant