sapling: init at 0.1.20221118-210929-cfbb68aa#201798
sapling: init at 0.1.20221118-210929-cfbb68aa#201798thoughtpolice merged 2 commits intoNixOS:masterfrom pbar1:sapling
Conversation
|
Did some personal testing here's everything that I've tested that works:
Safe to say, I believe this works 😛 |
|
Here's my attempt at building Sapling from source: https://gist.github.com/pbar1/dfdcce442306e70f7bddabe3403276c8 Using the package definition in this gist, I was almost able to get the Adding each of those as dependencies to Didn't pursue it any further after seeing that error; these builds take quite a long time. Also had to generate a I left a TODO comment in this PR's package definition to the effect of: building Sapling is somewhat hard. Solving for building Finally, looks like It's unfortunate that there's only a deb for |
|
Alright - I got it to build from source! It was similar to the tokenizer example. Since a new version was also released since the last commit, I also updated the version and pushed a new commit, rather than squashing, for posterity of the original work done with the deb. There's a fair amount of pinning going on here. I started making an |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1448 |
Did you add pkg-config to nativeBuildInputs? |
SuperSandro2000
left a comment
There was a problem hiding this comment.
There is no crate by chance so we can avoid vendoring the cargo.lock?
There was a problem hiding this comment.
How hard would it be to rip this all out and use our pythonPackages?
In the current state this is unmaintainable and we can't merge it like this.
There was a problem hiding this comment.
Agreed, wanted to automate this part with a script; it's hard to tell what they're doing with these deps, but the setup.py logic depends on the actual archive instead of the source within. I mostly mimicked the example for tokenizer in doing this, to get it working. Are there any alternatives to generating these (and the associated items in the let block`)?
There was a problem hiding this comment.
My current plan is to generate a deps.nix file using an update script that can be imported by this file, to abstract away all the crud currently here. Is there a way to calculate the sha256 of a derivation that would be generated from fetchurl beforehand, rather than attempting with a fake hash and then correcting it?
There was a problem hiding this comment.
Ok, I've done the above and made a usable script for automating asset fetching, plus discovered nix-prefetch-url. Will integrate the latter into said script and push tomorrow or so, as it's gotten late here.
There was a problem hiding this comment.
Why do we need the exact versions at all? Can't we just use any version?
There was a problem hiding this comment.
I suspect there is a needless amount of debate which distracts from the end goal. I know Nix is a build paltform and everyone feels good when they know builds better than the other guy but end of the day a project needs working binaries, and sapling binary works.
Perhaps, just perhaps, building in the most ideal way isn't the priority for fb team right now? Maybe 6 months down the line they'd be using the latest and best, maybe ship a default.nix and flake.nix?
I know I sound very bitter but I see this attitude repeatedly where PR creators are punished for their attempts. OP has a working binary, great, lets go with it. I am all for maintainability but hey, there are no spaces at the end of newline so that should be good enough!
There was a problem hiding this comment.
I suspect
Your suspicions are wrong.
Perhaps, just perhaps, building in the most ideal way isn't the priority for fb team right now?
Where did someone say it should be their priority? I'm getting pretty tired of people who aren't maintainers, or do not contribute actively to maintaining nixpkgs, constantly shoving words in the mouths of developers, all because they're in a rush to complain we aren't doing free work for them fast enough. Sapling was released a week ago. We're lucky someone even stepped up to try this early given my initial glance at the complexity of the package. And you still complaining that we still haven't merged this fast enough, still?
The Sapling team is not obligated to make changes we need; in fact if they said "No" to everything we wanted here, that would still be informative for our purposes so we know what to expect. This is good! This is literally completely self-evident to anyone who has had to work between teams before! Literally this happens all the time in open source. These are relevant things to maintainers who are responsible for delivering the software to Nix users.
Again: The current expression works. It basically looks fine, too, assuming we're on board with all this. I never said I wasn't. I think we should have communication with them to make it easy as possible to maintain this in the future, especially wrt concerns like Cargo.lock. In my experience communicating with upstreams, I think this will in turn give the Sapling developers a little insight into what we and others will need. None of this is in conflict.
I know I sound very bitter but I see this attitude repeatedly where PR creators are punished for their attempts.
Let me get this straight: you aren't writing the patches, you aren't maintaining the package, you aren't writing the software. The only thing you seem to be doing is posting in a text box about how we aren't doing this to your personal liking and at the speed which personally makes you happy — yet you're the one who is bitter and whose feelings need to be assuaged? Sorry, but that sounds like a "You" problem entirely.
There was a problem hiding this comment.
I've definitely contributed and stopped only because of this attitude of Devs like you to casually veer into intellectual self pleasure and losing sight of the goal
Theres a reason a human looks at these PRs, because humans are supposed to factor in situations.
There was a problem hiding this comment.
Good, because luckily we have hundreds of amazing and talented contributors who aren't afraid to roll up their sleeves and do what it takes to be part of a community, and part of that means doing dirty work, sometimes. It's never too late to know this feeling, if you want to really participate. But until then, don't bother or offer any more "help" or "suggestions" like this.
There was a problem hiding this comment.
Part of the problem is that we're going to need continuous integration and testing with upstream's builds in order to make sure this works,
Yes, like for any other program in nixpkgs which is not using upstreams vendored dependencies (which no program should) and where upstream does not have really tight version ranges which has its own problems.
I know Nix is a build paltform
yes and nixpkgs is a package collection that is comparable to the ones used by apt and rpm and using such hacks would be completely unacceptable for the main repository.
If you need something that "just works" then upstreaming to nixpkgs might not be the option you are searching for for packages like sapling that have such a horrible build process.
I know I sound very bitter but I see this attitude repeatedly where PR creators are punished for their attempts. OP has a working binary, great, lets go with it. I am all for maintainability but hey, there are no spaces at the end of newline so that should be good enough!
nixpkgs has a higher standard then things working. Otherwise managing security patches would be impossible. If this is the best solution we have right now then I'd rather not have sapling.
I just skimmed through @thoughtpolice posts but this PR should have not be merged in this state and I am voting for reverting it rather than having this compromise.
I did have pkg-config in nativeBuildInputs at that time. That comment though was in the context of a prior iteration where I was just building the rust binary, whereas this latest build that succeeds is the full packge. Upstream builds the tool with Python, even though its entrypoint is Rust. |
|
I've finished |
Following up with this, the latest commit also works as expected, with one notable exception being Everything else works as expected! P.S.: Great job on the package! Excited to see these final kinks worked out and Sapling officially available in Nixpkgs :) |
thoughtpolice
left a comment
There was a problem hiding this comment.
Basically looks good to me, assuming we're all on board with the Rust and Python stuff going on here. I could make one or two minor nits but it isn't worth it honestly.
It would also be nice to support Darwin but I suspect that will just add even more complexity, so we'll just save it for when we need it and someone adds it.
Ugh, actually this is rough and worth fixing IMO. The web interface is literally the best part of the whole thing, it's incredible. Maybe I can patch this in myself... If it's ridiculously complex to add to the package I guess we can hold off. But if it's a little complex, it might be worth it now. The web interface really is that good. |
Hard agree! It's fantastic, I've grown to love it myself! I'm personally worried that if this is merged without it working people might think it's a bug and not intended - especially when the web interface is such a large selling point for Sapling I understand however that this is already a very complex derivation - and my best wishes go to everyone who's already put time and effort into packaging it 😁 |
I agree that it may seem like an unintentional bug. FWIW, if we can't fix We can just file a bug separately for that last part. |
|
Hi, author of the Python dependencies in Sapling's setup.py here. I can provide some context about the current implementation:
I'm not an expert in the Python dependency management world and haven't fully explored choices like poetry and others. If there is a format to declare the dependencies (requirements.txt?) more formally, I think we can support that. Note we also have native dependencies. I wonder if something like a check-in |
@thoughtpolice Nit away! I'd love the feedback, part of the learning process and I'd like this package to be as maintainable as possible.
This should be fixed for sure before merging - it was working in the initial iteration of this package (when I used re: Darwin support - yeah, I also really want to get this working as there is an official macOS build (Homebrew) which would be nice to have parity with. I believe the issue (and fix) is the same as is referenced in this PR comment: PyO3/setuptools-rust#106 (comment). If someone knows how to inject these build flags into the derivation, that may help get the macOS build off the ground. |
@quark-zju Thanks for the context! So the zip files built by setup.py are not needed unless it's the Windows build? Snooping in the deb they are there, but if they're not needed for the Unix builds we can filter them out in this package derivation. Regarding your last comment about checking in something to Sapling upstream - this could be a Nix Flake (which is like a module/crate/etc in the Nix ecosystem). |
|
@pbar1 The dependencies are the same for all platforms. The zip used on Windows is an optimization since reading too many small files are slower on Windows' filesystem. On other platforms, we use |
|
I've looked at Darwin. Darwin build logIndeed, it is probably that comment you found in Cryptography. Notably, it is not being given the link flag to link to cpython, which is obviously why it's unresolved, due to being built in "extension module" mode (https://github.com/dgrunwald/rust-cpython/blob/master/python3-sys/build.rs#L347). But if it's expected to be built with those symbols expected to be unresolved, that now makes sense to me. I would support merging this as-is and fix up macOS setup later unless it's obviously easy. |
It would seem that's expected (unresolved) on macOS targets - believe I saw them in the setuptools_rust or PyO3 docs mentioned, but it was somewhat buried. The Sapling source does pass the right config in its file |
|
Ok - with this latest amend I've gotten
The results of the above are then copied into the final complete derivation. |
@quark-zju Good to know - that means we can filter out the zips in the Nix builds if they're only needed on Windows. As for the pyassets mainly being used for IPython - do you think any of them will be used not for IPython in the future? In any case, I'm in favor of keeping the functionality as is in this pr (we've got the generated python deps, |
|
This is looking great and the I'm got things to attend to at this exact second, but unless anyone else has objections, I plan on taking this branch for a short spin and merging it later tonight. |
|
I ran several tests and ported several patches from my own repositories, rebased and used |
|
I've root caused the Darwin issues. They're related to the cargo config that nixpkgs puts in overriding the cargo config that sapling adds, making its rust flags get ignored. Going to write a PR. Update: PR written but it doesn't work at runtime so it's marked draft: #202754 |
As someone who has its sleeves really deep into nixpkgs python ecosystem the merged solution here is not acceptable from the view of python packages. If something is broken from the python side because of the non standard vendoring here then you are most likely out of luck and need to solve it yourself.
nixpkgs supports setup.py/setuptools, requirements.txt, pyproject, flit, hatchling and probably some more. Anything would be better for us than directly downloading things from pypi and vendoring them.
We do not have support for python on windows out of the box or target that, so nothing to worry about yet. Most of python build systems support making dependencies platform specific. If you need this package a week after its release and are fine with using such workarounds, then having the nix file out of tree would be a better solution than having major compromises. I am not happy that this got merged at this stage. |
OK, I might have been wrong here, but — my understanding here was that generally it's ok if Python code is vendored from upstream to some extent, but it can't be exposed as any sort of package for downstream Python package consumers; i.e. you shouldn't be able to import But Sapling is not a python package, really, it's an application written in python which depends on a fixed set of Python dependencies, which we do not have, but nothing more than that. The problem I had with the previous version was hardcoding tons of stuff that would need to be tediously updated. The fact that they pick some specific dependencies is otherwise not a big deal, IMO. Another way of putting it is like this — if they instead simply checked all the "python dependencies" into a directory under However, in a twist of fate, it is a python package in the sense it also contains a I might not understand all the specific criteria the maintainers of the Python infrastructure have, though. Presumably it's somewhere in-between "duplicate every dependency willy nilly" — which would be bad — vs "literally never duplicate anything ever in history even if it's inside something that isn't really Python package" — which, I mean, if we can't leverage one of the actual major benefits of Nix existing, we might as well just give up. We might want to discuss this in another issue or a revert PR if you're willing to file it, since this one is getting pretty long in the tooth. |
|
Actually, disregard that last comment; I guess my eyes glazed over this part:
If this is the crux of the matter, something like a |
This would definitely cause issues due to how bad pip handles this and is not allowed to be done.
If someone would have checked the upstream repo and found this probably, too because as a Distro we don't favor vendoring
Add cases like "upstream version pinning cannot be trusted because it pins 2 year old cryptography versions because they require rust to build now" which is not an issue for us. |
Description of changes
Add Sapling (ie,
sl) to Nixpkgs.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes