all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexis Simon <alexis.simon@runbox.com>
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Python package with some rust dependency
Date: Sat, 17 Feb 2024 11:25:04 -0800	[thread overview]
Message-ID: <18d28c9d-195b-4b3c-a473-84d95051af3d@runbox.com> (raw)
In-Reply-To: <badd97d2-8b48-471b-b80d-80f32cadb13b@runbox.com>

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

for reference, I finally managed to get this working.
See attached file.
Thanks for the help
Alexis

On 17/02/2024 08:46, Alexis Simon wrote:
> 
> 
> On 17/02/2024 03:50, Carlo Zancanaro wrote:
>> Hi Alexis,
>>
>> On Fri, Feb 16 2024, Alexis Simon wrote:
>>> ```
>>> error: in phase 'check-python-module': uncaught exception:
>>> wrong-type-arg "apply" "Apply to non-list: ~S" (#f) (#f)
>>> phase `check-python-module' failed after 0.0 seconds
>>> ...
>>> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
>>> In procedure apply: Apply to non-list: #f
>>> ```
>>
>> This error sounds like you're trying to call #f as a function. Since
>> this is happening in the 'check-python-module phase, we can look at this
>> code:
>>
>>>              (add-after 'install-python-module 'check-python-module
>>>                (lambda* (#:key inputs #:allow-other-keys #:rest args)
>>>                  (apply (assoc-ref py:%standard-phases 'check) args)))
>>
>> I assume that (assoc-ref py:%standard-phases 'check) is returning #f,
>> which is causing the error. Given you don't use inputs, you could try
>> the same thing as you've done for the other phases like:
>>
>>      (add-after 'install-python-module 'check-python-module
>>        (assoc-ref py:%standard-phases 'check))
>>
>> But I'm not sure that will help you if the assoc-ref is really returning
>> #f. I guess in the worst case you could just leave out the check phase
>> entirely.
> 
> Thanks that makes a bit more sense I think.
> 
>>
>> Also, as an aside, I'm not sure where the 'prepare-python-module phase
>> is coming from. Does it actually exist?
> 
> This is a very good question I had myself and to which I couldn't find 
> the answer. I found examples such as those [1] in the repo and couldn't 
> find where this phase was specified. But it seems to work.
> 
>>
>> Carlo
> 
> Alexis
> 
> [1] 
> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/python-xyz.scm#n3453
> 

[-- Attachment #2: fwdpy11.scm --]
[-- Type: text/x-scheme, Size: 7851 bytes --]

(define-module (packages fwdpy11)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages rust)
  #:use-module (gnu packages crates-io)
  #:use-module (gnu packages rust-apps)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages autotools)
  #:use-module (packages popgen)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix build-system python)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system pyproject))

(define-public rust-demes-0.5
  (package
    (name "rust-demes")
    (version "0.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (crate-uri "demes" version))
       (file-name (string-append name "-" version ".tar.gz"))
       (sha256
        (base32 "0mg78a9f16fayqpg8vkbr0209rj05svppxcfk0ldgn125mw81b11"))))
    (build-system cargo-build-system)
    (arguments
     `(#:skip-build? #t
       #:cargo-inputs (("rust-regex" ,rust-regex-1)
                       ("rust-serde" ,rust-serde-1)
                       ("rust-serde-json" ,rust-serde-json-1)
                       ("rust-serde-yaml" ,rust-serde-yaml-0.9)
                       ("rust-thiserror" ,rust-thiserror-1))))
    (home-page "https://github.com/molpopgen/demes-rs")
    (synopsis "rust implementation of demes specification")
    (description "rust implementation of demes specification")
    (license license:expat)))

(define-public rust-demes-forward-0.4
  (package
    (name "rust-demes-forward")
    (version "0.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (crate-uri "demes-forward" version))
       (file-name (string-append name "-" version ".tar.gz"))
       (sha256
        (base32 "1awhy8vgmj24241vl304f0m17jdqhrw78wm5gn0q3w8y1432mclm"))))
    (build-system cargo-build-system)
    (arguments
     `(#:cargo-inputs (("rust-demes" ,rust-demes-0.5)
                       ("rust-thiserror" ,rust-thiserror-1))
       #:cargo-development-inputs (("rust-anyhow" ,rust-anyhow-1))))
    (home-page "https://github.com/molpopgen/demes-rs")
    (synopsis "rust API for iterating demes models forwards in time")
    (description "rust API for iterating demes models forwards in time")
    (license license:expat)))

(define-public rust-demes-forward-capi-0.4
  (package
    (name "rust-demes-forward-capi")
    (version "0.4.1")
    (source
     (origin
       (method url-fetch)
       (uri (crate-uri "demes-forward-capi" version))
       (file-name (string-append name "-" version ".tar.gz"))
       (sha256
        (base32 "1b3aq2wjw6sr9nqlr8v71hi9kjj4wq48k39irgvlwyipnj74ws7s"))))
    (build-system cargo-build-system)
    (arguments
     `(#:cargo-inputs (("rust-demes-forward" ,rust-demes-forward-0.4)
                       ("rust-libc" ,rust-libc-0.2))))
    (home-page "https://github.com/molpopgen/demes-rs")
    (synopsis "C API to demes-forward crate")
    (description "C API to demes-forward crate")
    (license license:expat)))

(define-public fwdpy11
  (package
    (name "fwdpy11")
    (version "0.21.6")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "fwdpy11" version))
       (sha256
        (base32 "1mgs7fcda3cr7a7kbnk0x50993131453rlrkq7nv4pxqw53lnrv3"))))
    (build-system cargo-build-system)
    (arguments
      (list
        #:imported-modules `(,@%cargo-build-system-modules
                           ,@%pyproject-build-system-modules)
        #:modules '((guix build cargo-build-system)
                    ((guix build pyproject-build-system) #:prefix py:)
                    (guix build utils))
        #:phases
        #~(modify-phases %standard-phases
            (delete 'package)
            (delete 'check)
            (add-after 'unpack 'chdir-rust
                (lambda _
                  (chdir "rust/fp11rust")))
            (replace 'unpack-rust-crates
                ;; This is to avoid the non-crate source from being erroneously
                ;; unpacked by this phase, causing an error.
                (lambda* (#:key inputs #:allow-other-keys #:rest args)
                  (apply (assoc-ref %standard-phases 'unpack-rust-crates)
                         (append args
                                 (list #:inputs (alist-delete "source" inputs))))))
            (replace 'configure
                (lambda* (#:key inputs #:allow-other-keys #:rest args)
                  (apply (assoc-ref %standard-phases 'configure)
                         (append args
                                 (list #:inputs (alist-delete "source" inputs))))))            
            (add-after 'patch-cargo-checksums 'chdir-python
                        (lambda _ (chdir "../..")))
            (add-after 'chdir-python 'enable-bytecode-determinism
              (assoc-ref py:%standard-phases 'enable-bytecode-determinism))
            (replace 'build
              (assoc-ref py:%standard-phases 'build))
            (replace 'install
              (assoc-ref py:%standard-phases 'install))
            (add-after 'install 'add-install-to-pythonpath
              (assoc-ref py:%standard-phases 'add-install-to-pythonpath))
            (add-after 'add-install-to-pythonpath 'check-python-module
              (lambda* (#:key tests? #:allow-other-keys)
                (when tests?
                  (invoke "pytest" "-vv" "tests")))))
       #:cargo-inputs
        `(("rust-autocfg", rust-autocfg-1)
          ("rust-demes", rust-demes-0.5)
          ("rust-demes-forward", rust-demes-forward-0.4)
          ("rust-demes-forward-capi", rust-demes-forward-capi-0.4)
          ("rust-hashbrown", rust-hashbrown-0.12)
          ("rust-indexmap", rust-indexmap-1.8)
          ("rust-itoa", rust-itoa-1)
          ("rust-libc", rust-libc-0.2)
          ("rust-proc-macro2", rust-proc-macro2-1)
          ("rust-quote", rust-quote-1)
          ("rust-regex", rust-regex-1)
          ("rust-regex-syntax", rust-regex-syntax-0.6)
          ("rust-ryu", rust-ryu-1)
          ("rust-serde", rust-serde-1)
          ("rust-serde-derive", rust-serde-derive-1)
          ("rust-serde-yaml", rust-serde-yaml-0.9)
          ("rust-syn", rust-syn-1)
          ("rust-thiserror", rust-thiserror-1)
          ("rust-thiserror-impl", rust-thiserror-impl-1)
          ("rust-unicode-ident", rust-unicode-ident-1)
          ("rust-unsafe-libyaml", rust-unsafe-libyaml-0.2)
          )
      ))
    (native-inputs
     (list python-wrapper
           cmake
           rust-cbindgen
           gsl
           pybind11
           python-wheel
           python-setuptools
           python-setuptools-scm
           python-pytest
           python-pytest-xdist
           python-hypothesis
           python-msprime))
    (propagated-inputs (list python-attrs
                             python-deprecated
                             python-black
                             python-demes
                             python-numpy
                             python-scipy
                             python-tskit))
    (home-page "https://github.com/molpopgen/fwdpy11")
    (synopsis "Forward-time population genetic simulation in Python")
    (description "Forward-time population genetic simulation in Python")
    (license license:gpl3))
)

  reply	other threads:[~2024-02-17 19:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  1:49 Python package with some rust dependency Alexis Simon
2024-02-12 23:29 ` Carlo Zancanaro
2024-02-13 19:36   ` Alexis Simon
2024-02-13 21:46     ` Carlo Zancanaro
2024-02-13 21:55       ` Alexis Simon
2024-02-16  6:08         ` Alexis Simon
2024-02-17  0:02           ` Alexis Simon
2024-02-17 11:50             ` Carlo Zancanaro
2024-02-17 16:46               ` Alexis Simon
2024-02-17 19:25                 ` Alexis Simon [this message]
2024-02-18  3:03                 ` Carlo Zancanaro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18d28c9d-195b-4b3c-a473-84d95051af3d@runbox.com \
    --to=alexis.simon@runbox.com \
    --cc=carlo@zancanaro.id.au \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.