transition-zero / tz-client

A client repository for accessing FEO data programmatically.
https://docs.feo.transitionzero.org
Apache License 2.0
21 stars 4 forks source link

feat: Nix development shell #126

Closed silky closed 4 months ago

silky commented 4 months ago

Description

This adds a simple Nix development shell based on pyproject.nix using direnv.

I've added this to allow development on NixOS/nix.

Note that there are a couple of quirks that, perhaps, are solvable, and I've opened as issues:

I also made some very small fixes in a couple of spots I noticed them; a missing link here or typo.

The main code change I had to make was to allow setting the __version__ attribute to fail; which is does in the nix environment. Hopefully this isn't too controversial as it should only affect nix. I opened https://github.com/nix-community/pyproject.nix/issues/66 to track this and hopefully there is an answer. As a bit of trivia, it might be more idiomatic (for nix, anyway) to have the version as a hard-coded file in the repository; then at least the nix package installation could also be made correct (see the flake.nix for a comment explaining this situation.)

For Nix people, note that I opted not to use pre-commit-hooks.nix (because it would mean moving the configuration of the hooks to Nix, which basically means you'd need to use nix to change them, which I didn't want to require), so you will need to run pre-commit install when entering the shell for the first time.

Let me know if there are any concerns/thoughts/extra things to do :)

If you wish to try this yourself, you would need to simply:

  1. Install nix-the-package manager - https://nixos.org/download.html
  2. From the folder with the flake run nix develop
  3. Confirm it works by running pytest from the resulting shell! :)

Potential extensions:

Checklist

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feo-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2024 9:22am
silky commented 4 months ago

Closing in favour of keeping Nix out of the repository for the time being :)