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
(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))
)