-
Notifications
You must be signed in to change notification settings - Fork 1k
Nix development environment? #8568
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
Conversation
VIKTORVAV99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting on this one as it contains all the changes:
Overall we do want to use UV and we plan on migrating to it, maybe even now in January as a part of a bigger refractor and use workspaces.
So that part is mostly okay, just need to ensure our package publishing still works if we merge it.
However there are some things I need clarity around and these are:
- Why does this use hatchling as the build backend instead of UVs build backend?
- Why do we need Nix? That is seemingly a whole other package system on top of UV, not sure we want to or can maintain that for a very limited usecase.
Great! I'll close the other PR then.
Not sure; that must just be the default that the tool migrate-to-uv picked; I didn't do anything special there.
Yes, very reasonable question. I'll provide perhaps too much information in response to this, and assume no prior knowledge of Nix. Why Nix (on top of
|
|
In theory that is very nice and I like the general idea, I'm just not sure if that is the right tool for us. We already have a devContainer (albeit very limited and slim) in this repo that integrates well with VSCode and GitHub Codespaces. I'm thinking it's probably better to expand on that than introducing other tools into the mix. This is not a final say by any means but It's something I would have to discuss internally if we where to implement and support it, devContainers we could simply expand on if needed. We will also be reducing the scope of this repo to focus on pure python (and Yaml config files). So multi language will be less of a concern soon. |
Do note that Nix is not instead of devContainers; as mentioned you can use Nix to build docker images. The problem with docker for development is that the iteration time on rebuilding a container is extremely slow. With Nix/caching, it's effectively zero; i.e. it only does work in proportion to the new dependency that is added.
👍🏻 |
|
My main concern is that it's yet another tool that needs to be installed vs tools that are more likely to already be installed (docker). |
Yeah; I can see this perspective. On the other side of the fence, once you have Nix installed, you never need to install another package manager again :) I.e. note that in the Nix devShell you don't need to install uv; it is already present (in the same way as tesseract).
Cool! :) |
So we talked this over and we decided that in principle this is a very good idea but we won't be using Nix for it for the reasons I listed above. (Although it got a lot of love from the team). We will however try and improve our existing Dev Container / Docker setup so it's easier to get started for everyone that wants to contribute. I hope this makes sense! |
|
Hey @VIKTORVAV99 ; yes, I understand your hesitance. In fact, this interaction inspired me to write up some thoughts more clearly: Why should my project adopt Nix? and also put together a python-uv template; if you ever want to get into it feel free to reach out :) |
Issue
Goal is to get a full reproducible development environment using Nix; this will install all necessary system packages and dependencies at the correct versions.
This is a follow-up to #8565 .
Again, this PR serves mostly as a discussion piece/a way for Nix(OS) users to contribute to this project. Notably, this is built on top of the #8565 branch, so it at least proves that moving to uv seems to have no impact on the project at large; i.e. all the python dependencies installed correctly.
Description
This is an attempt to use uv2nix to define a Python development environment. It also includes tesseract.
Install Nix and configure flakes.
To start using it, either use direnv, or run:
this opens the default "devShell". If you use direnv, it will automatically open when you
cdinto the folder.From there, you can either run the scripts as pure binaries:
> test_parser --helpOr you can run linting, say, with
> uv run lintTodo/Notes
pytestto see. They are:The second one is likely due to a missing expectation on tesseract version. I'm using 5.5.1. The first one, I'm not sure yet.
test_parserworks; seems like I need to create some tokens to even test thatcapacity_updatefails:Seems like it is just a codepath that hasn't been tested recently?
If adopted
If the maintainers wish to move to Nix, we would also like to: