Add override for Pendulum version 3.0.0 with Rust #1739
Merged
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.
Hi maintainers,
I recently came across build problems when trying to use
poetry2nix
on a Python project that depends on Pendulum. The build error was because this was the first Pendulum release that has parts of its source re-written in Rust. Previous versions have been pure Python.This PR fixes that issue by adding an override for Pendulum that includes the Rust build hook. The override is only applied if the version is at least 3.0.0 (still the most recent version at the time of writing).
The changeset of this PR works locally and I have also included a test for this, to confirm also that builds of previous versions are not broken. That said, I did encounter an issue where I found out the
version
attribute of the autogeneratedCargo.lock
in pendulum's source tree is actually3.0.0-beta-1
. This introduced some conflict when building.Furthermore, I found out that the commit on
master
on which the GitHub release was done is actually different from the3.0.0
-tagged commit. One of the difference being, that the[project].version
value inpyproject.toml
of those two commits differ (3.0.0
vs3.0.0b1
). I suspect this was the cause of the differingversion
value in theCargo.lock
file.These differences, as noted in the code, led me to the use offetchCargoTarball
instead ofimportCargoLock
. The latter would require some manual string replacemend (e.g. inprePatch
phase), which I think complicates the override too much.EDIT: Apparently
fetchCargoTarball
still produces the same error (hash mismatch). My local builds were passing, but it seemed to be caused by some intermediate derivation not required for the final build. CI says otherwise, and when I run garbage collection, I bumped on the same error again. So now, I am usingimportCargoLock
with an explicitCargo.lock
file added as part of this MR. Turns out this simplifies the build, in that we do not need to download and patch the source tree anymore.Anyway, I hope this is useful ~ and feel free to critique, this is my first contribution to the repo 🙂.
Contribution checklist (recommended but not always applicable/required):