Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to poetry and make reuse (pretty much) reproducible #509

Merged
merged 7 commits into from
May 9, 2022

Conversation

linozen
Copy link
Contributor

@linozen linozen commented Apr 6, 2022

This should close #289. More generally, this is a big step towards better reproducibility of both the development environment and the resulting binaries. This is the case as poetry captures the entire dependency tree of reuse in poetry.lock.

In addition, it also adds some files that ensure full reproducibility (basically by pinning everything, incl. compilers etc.) via Nix, a purely functional package manager. It's easy to install on any operating system. For more information about Nix flakes (a newish feature and soon-to-standard of the Nix ecosystem), this blog post might be helpful.

For more information about why reproducibility matters, see the docs of reproducible-builds.org

For now, this entire PR (if pushed to master) can co-exist happily with the build/dev/publish infrastructure we have in place currently. I can commit to keeping this branch up-to-date until we have everything in place for the merge - but as I said, there will be no conflict. Feel free to ping me if you have questions/reservations re: this PR, the switch to poetry or reproducible builds (with Nix) more generally.

linozen added 3 commits April 6, 2022 10:56
This commit adds everything needed to switch dependency management over
to poetry. This has the potential to streamline the
development/publishing workflows quite a bit. Here is poetry's
documentation:

https://python-poetry.org/docs/
@linozen linozen marked this pull request as draft April 6, 2022 09:16
@linozen linozen self-assigned this Apr 6, 2022
@linozen linozen added the dependencies Pull requests that update a dependency file label Apr 6, 2022
@linozen linozen changed the title Switch to poetry Switch to poetry and make reuse (almost) reproducible Apr 6, 2022
@linozen linozen changed the title Switch to poetry and make reuse (almost) reproducible Switch to poetry and make reuse (pretty much) reproducible Apr 6, 2022
linozen added 3 commits April 6, 2022 11:21
This adds compatibility with Nix, the purely functional package manager.
This gives us a declarative development environment with `reuse` in
editable mode and a fully reproducible build of `reuse` and its entire
dependency tree across multiple architectures. As a cherry on top, it
can also build a fully reproducible docker image. If you are curious
about Nix, the package manager, check out the manual:

https://nixos.org/manual/nix/stable/

For more information about Flakes, this blog post is helpful:

https://www.tweag.io/blog/2020-05-25-flakes/
@linozen linozen marked this pull request as ready for review April 6, 2022 09:54
@carmenbianca
Copy link
Member

This is awesome! I need to find some time to review this.

@mxmehl
Copy link
Member

mxmehl commented Apr 22, 2022

@carmenbianca did you already find time to review this or is this good to go for you? It's a bit of a blocker for further steps :)

Copy link
Member

@carmenbianca carmenbianca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally got the chance to review this. I can't speak to the Nix scrips—the syntax is completely foreign to me, and all my exposure to Nix is a single super interesting talk.

The poetry config makes perfect sense to me.

Some notes:

  • Basic usage should probably be documented. CONTRIBUTING.md is probably a good destination for this. As a matter of fact, there's some stuff in the README that should probably be moved to that destination, but we can delay that.
  • There is currently no feature parity between the poetry config and the setuptools config.
    • Translations aren't included in the built package.
    • The long description is not included in the built package.
    • The license files are not included in the built package.

However, none of these things are blockers if we want to maintain this as a parallel project until we deprecate the setuptools methods. If we do deprecate the setuptools methods, I think it'd be nice to get rid of the custom Makefile as well. It's a bit clunky and awkward here and there.

LGTM, thanks a lot @linozen, and sorry for the long wait!

edit: When this is merged, it's a good idea to create an issue for feature paritry.

@floriansnow
Copy link
Contributor

@linozen LGTM! Is the plan to completely switch to this as a build system at some point or does it mean we have to maintain two separate setups forever? Sorry if that is a silly question, but I'm not familiar enough with this new part yet.

@linozen
Copy link
Contributor Author

linozen commented May 6, 2022

@linozen LGTM! Is the plan to completely switch to this as a build system at some point or does it mean we have to maintain two separate setups forever? Sorry if that is a silly question, but I'm not familiar enough with this new part yet.

Thanks for approving. So, I think it would be beneficial to commit fully to poetry in the medium term. However, there is still some work left to do until we can abandon the old build/publish system based on setup.py. After this PR merged, I'll create a new issue for this migration.

The Nix* stuff is mainly there for me so I can develop effectively. Furthermore, it also allows other Nix users to spin up a development environment in no time. More generally, IMHO efforts like Nix or Guix that focus on reproducibility, declarativeness and reliability to be the future of packaging any application. For now, I'd just be very happy if the two files ending in .nix could live on master so I don't have to worry about keeping them in sync across my development machines. And as I mentioned, they are not completely without use for a potentially relevant subset of outside contributors.

@mxmehl mxmehl added this to the v1.0.0 milestone May 6, 2022
@linozen linozen merged commit db85ea5 into master May 9, 2022
@linozen linozen deleted the switch-to-poetry branch May 9, 2022 14:20
@linozen linozen mentioned this pull request May 9, 2022
@floriansnow
Copy link
Contributor

Furthermore, it also allows other Nix users to spin up a development environment in no time.
I find Nix, especially the language, still a bit scary, but I can see that I need to find the time to try it, even if not as my main system. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fully migrate to poetry
4 participants