GNU bug report logs - #44090
Packaging a python library that is implemented with rust

Previous Next

Package: guix;

Reported by: "Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org>

Date: Tue, 20 Oct 2020 05:11:02 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44090 in the body.
You can then email your comments to 44090 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#44090; Package guix. (Tue, 20 Oct 2020 05:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 20 Oct 2020 05:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org>
To: bug-guix <at> gnu.org
Subject: Packaging a python library that is implemented with rust
Date: Tue, 20 Oct 2020 08:40:19 +0330
Hi,

I'm not expert in rust and python but I need to package a python library, and this python library is a wrapper over the rust library. This library is using the `setuptools_rust` for build/install. 
* python library: https://github.com/etesync/etebase-py
* rust library: https://github.com/etesync/etebase-rs
* `setup.py`: https://github.com/etesync/etebase-py/blob/master/setup.py

Anyway I need to package this python library. Since guix has two different build system for `python` and `rust` I don't know how can I package it. It's a python library but it should install some rust library inside the python system build.

* This is package definition of `python-setuptools-rust`:
```
(define-public python-setuptools-rust
  (package
    (name "python-setuptools-rust")
    (version "0.11.3")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "setuptools-rust" version))
        (sha256
          (base32
            "1p21sw77197m7pciy8g25bwwaakq1675h0x1lis9sypzr46p2s11"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-setuptools" ,python-setuptools)
       ("python-setuptools-scm" ,python-setuptools-scm)
       ("python-wheel" ,python-wheel)))
    (propagated-inputs
      `(("python-semantic-version"
         ,python-semantic-version)
        ("python-toml" ,python-toml)))
    (home-page
      "https://github.com/PyO3/setuptools-rust")
    (synopsis "Setuptools rust extension plugin")
    (description "Setuptools rust extension plugin")
    (license license:expat)))
```


* And this is package definition of `python-etebase`. 
```
(define-public python-etebase
  (package
    (name "python-etebase")
    (version "0.30.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "etebase" version))
        (sha256
          (base32
            "1py635aqnxx3jy4x6zffriqi0l9gc2gk06h0ms91k4rs68h0gb0i"))))
    (build-system python-build-system)
    (native-inputs
      `(("python-msgpack" ,python-msgpack)
        ("python-setuptools-rust" ,python-setuptools-rust)))
    (inputs
      `(("rust-etebase-rs" ,rust-etebase-rs)))
    (home-page
      "https://github.com/etesync/etebase-py")
    (synopsis "Python client library for Etebase")
    (description "Python client library for Etebase")
    (license #f)))
```


This is the error in package building:
```
etebase-0.30.0/src/
etebase-0.30.0/src/lib.rs
etebase-0.30.0/src/glue.rs.in
phase `unpack' succeeded after 0.0 seconds
starting phase `ensure-no-mtimes-pre-1980'                                                                                                                                                                    
phase `ensure-no-mtimes-pre-1980' succeeded after 0.0 seconds
starting phase `enable-bytecode-determinism'                                                                                                                                                                  
phase `enable-bytecode-determinism' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'                                                                                                                                                                           
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'                                                                                                                                                                        
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `patch-generated-file-shebangs'                                                                                                                                                                
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `build'                                                                                                                                                                                        
running "python setup.py" with command "build" and parameters ()
running build
running build_py
creating build
creating build/lib
creating build/lib/etebase
copying etebase/__init__.py -> build/lib/etebase
running build_ext
running build_rust
error: Can not find Rust compiler
command "python" "-c" "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))" "build" failed with status 1
builder for `/gnu/store/45b049cf1k8czxmvwqi3yw6gyk5s7hx5-python-etebase-0.30.0.drv' failed with exit code 1
build of /gnu/store/45b049cf1k8czxmvwqi3yw6gyk5s7hx5-python-etebase-0.30.0.drv failed
View build log at '/var/log/guix/drvs/45/b049cf1k8czxmvwqi3yw6gyk5s7hx5-python-etebase-0.30.0.drv.bz2'.
guix build: error: build of `/gnu/store/45b049cf1k8czxmvwqi3yw6gyk5s7hx5-python-etebase-0.30.0.drv' failed

```



Sorry for duplication, I sent this email here too: https://lists.gnu.org/archive/html/help-guix/2020-10/msg00092.html
then I thought this mailing list is better for asking this type questions.



Regards,
Hamzeh




Information forwarded to bug-guix <at> gnu.org:
bug#44090; Package guix. (Tue, 20 Oct 2020 10:25:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: h.nasajpour <at> pantherx.org
Cc: bug-guix <at> gnu.org
Subject: bug#44090: Packaging a python library that is implemented with rust
Date: Tue, 20 Oct 2020 12:23:54 +0200
Hello Hamzeh,

I think part of the issue here, is that the build system for etebase-py 
tries to also build etebase-rs, which you have already packaged.  There
are two ways you could continue here:

1. Patch the build system of etebase-py, so that it works with your
already built etebase-rs.

2. Pull in the etebase-rs source as input to etebase-py and build
everything as one package.

I am not sure, which option makes more sense here.  I do lean a bit
more towards #1, but others may weigh in on this as well.  I'm pretty
sure you can disregard setuptools-rust if you choose #1.  If you do #2,
you might have to mix some of the rust-build-system phases into python-
etebase.

Regards, Leo





Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Mon, 01 Feb 2021 19:03:02 GMT) Full text and rfc822 format available.

Notification sent to "Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org>:
bug acknowledged by developer. (Mon, 01 Feb 2021 19:03:02 GMT) Full text and rfc822 format available.

Message #13 received at 44090-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: "Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org>
Cc: 44090-done <at> debbugs.gnu.org
Subject: Re: bug#44090: Packaging a python library that is implemented with
 rust
Date: Mon, 01 Feb 2021 14:02:27 -0500
Hello Hamzeh,

"Hamzeh Nasajpour" <h.nasajpour <at> pantherx.org> writes:

> Hi,
>
> I'm not expert in rust and python but I need to package a python library, and this python library is a wrapper over the rust library. This library is using the `setuptools_rust` for build/install. 
> * python library: https://github.com/etesync/etebase-py
> * rust library: https://github.com/etesync/etebase-rs
> * `setup.py`: https://github.com/etesync/etebase-py/blob/master/setup.py
>
> Anyway I need to package this python library. Since guix has two different build system for `python` and `rust` I don't know how can I package it. It's a python library but it should install some rust library inside the python system build.

[...]

> Sorry for duplication, I sent this email here too: https://lists.gnu.org/archive/html/help-guix/2020-10/msg00092.html
> then I thought this mailing list is better for asking this type questions.

The original list was better suited for this kind of question.  This
list is about actual *bugs*, rather than general question.  I see you've
had a reply from Leo; hopefully that answered your question.

Closing.

Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Mar 2021 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.