-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
General infrastructure for packaging Python packages that use PyO3 / maturin to build native Rust extensions #83614
Comments
In the Python world it is common that a back-end or build tool (often I'm unfamiliar with the packages in question. I suppose it's some extension modules, and then some Python code. Ideally a build tool is used that can build a wheel. If not, it indeed becomes hacky. |
So orjson has a |
@FRidh any ideas why I get Should I try to add it to EDIT: feel free to ping me on #nixos if you want me to test anything. default.nix let
nixpkgs = import <nixpkgs> {};
in
nixpkgs.python3Packages.buildPythonPackage rec {
name = "something-${version}";
version = "0.0.1";
format = "pyproject";
nativeBuildInputs = [ nixpkgs.maturin ];
src = ./.;
} pyproject.toml [build-system]
requires = ["maturin"]
build-backend = "maturin" log
|
Hi @bbigras. I'm working on anki update (#78449), and since there is a Cargo.toml/Cargo.lock I found it easier to package that with Here's what it (currently) looks like: https://github.com/martinetd/nixpkgs/blob/anki/pkgs/games/anki/rspy/default.nix Now I'm finally done with that, I just noticed I actually need orjson next, so if I publish my work on anki so our interests might coincide a bit. Comments/yells/whatever welcome -- I'll probably open a PR just for orjson to test the water :P |
gah, orjson requires rust nightly! I don't think we can package anything using nightly? And the common workarounds I found don't work... ugh.. I guess it's about time I gave up on an up to date version of anki as well -_- Sorry for the noise, keep going, nothing to see here! |
Had a go at this in #101771. |
I still have the same message with the same default.nix and pyproject.toml, without any python files. I wonder if that could be the cause. |
I haven't completely analyzed the situation yet but this will likely be required for Nixpkgs soon as Unfortunately it also looks like it needs to fetch some Rust dependencies which might be pretty tricky in Nixpkgs:
I'm not yet familiar with PyO3 and maturin but at least PyO3 and PEP 517 seem to be relevant for Cryptography. |
There is also #108447 |
Upstream cryptography issue pyca/cryptography#5771.
|
Opened a topic on the |
Example from @danieldk packaging a Python package using maturin https://github.com/danieldk/nix-packages/blob/81b8444e6864c546cd8f41f393d65fe693c27ca0/pkgs/python-modules/alpino-tokenizer/default.nix#L13 If the wheel would be moved to |
|
I have made the cargo vendor handling a hook and I can now build the |
Great, thank you @danieldk ! |
Draft PR: #112500 |
Closing this as done. |
I've encountered two separate (not currently provided by nixpkgs) python packages that are built with maturin in the last week - orjson and tokenizers - and I can only imagine both that there are more out there, and that more are coming. I have orjson packaged very jankily by building it as a Rust crate directly using naersk, then stripping off the env vars from the resulting derivation and throwing them unceremoniously into
buildPythonPackage
. That works, but not in a way that I'd even dream of submitting it to nixpkgs - now that I've encountered my second package built using maturin it really is beginning to feel like this is something thatbuildPythonPackage
should "just" handle transparently, the way it does Python packages with C extensions built-in. Anyone have any thoughts?The text was updated successfully, but these errors were encountered: