unofficial mirror of guix-science@gnu.org 
 help / color / mirror / Atom feed
* packaging python-cyvcf2
@ 2024-03-22  1:03 Alexis Simon
  2024-03-22  1:03 ` Alexis Simon via Guix-Science
  2024-03-22 15:25 ` Simon Tournier
  0 siblings, 2 replies; 8+ messages in thread
From: Alexis Simon @ 2024-03-22  1:03 UTC (permalink / raw)
  To: help-guix, guix-science

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

Hi, I've spent nearly the day on this and it's driving me crazy.

I am trying to package this cyvcf2 [1]
I am attaching the packaging I've tried.

The build is failing with this error:
running build_ext
# cyvcf2: htslib mode is BUILTIN
# cyvcf2: htslib configure options is None
error: [Errno 2] No such file or directory: './configure'
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("./setup.py" 
"build") exit-status: 1 term-signal: #f stop-signal: #f>

What is very disturbing is that it builds fine in a debugging 
environment following the documentation [2]

The .configure file is present in the failed build, so there must be 
something going on with the setup.py not managing to change directory to 
htslib in the build_htslib function.

If anyone has any guidelines to debug this further it would be much 
appreciated.

Thanks,
Alexis

[1] https://github.com/brentp/cyvcf2/
[2] https://guix.gnu.org/manual/en/guix.html#Debugging-Build-Failures

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

(define-module (cyvcf2)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages tls)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system python)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system pyproject))

(define-public python-cyvcf2
  (package
    (name "python-cyvcf2")
    (version "0.30.28")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "cyvcf2" version))
       (sha256
        (base32 "03ycp7php5nzvhgj89k8js8z2xm3i8d1f76jlsfdy472f0apgryx"))))
    (build-system python-build-system)
    (arguments
     `(#:use-setuptools? #f
       #:phases
        (modify-phases %standard-phases
          (add-before 'build 'setenv
             (lambda _
                     (setenv "CYVCF2_HTSLIB_MODE" "BUILTIN")))))) ; unnecessary
    (propagated-inputs (list python-click
                             python-coloredlogs
                             python-numpy))
    (native-inputs (list zlib
                         libdeflate
                         curl
                         openssl
                         autoconf
                         automake
                         ; htslib
                         python-cython))
    (home-page "https://github.com/brentp/cyvcf2/")
    (synopsis "fast vcf parsing with cython + htslib")
    (description "fast vcf parsing with cython + htslib")
    (license license:expat)))


^ permalink raw reply	[flat|nested] 8+ messages in thread

* packaging python-cyvcf2
  2024-03-22  1:03 packaging python-cyvcf2 Alexis Simon
@ 2024-03-22  1:03 ` Alexis Simon via Guix-Science
  2024-03-22 15:25 ` Simon Tournier
  1 sibling, 0 replies; 8+ messages in thread
From: Alexis Simon via Guix-Science @ 2024-03-22  1:03 UTC (permalink / raw)
  To: help-guix, guix-science

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

Hi, I've spent nearly the day on this and it's driving me crazy.

I am trying to package this cyvcf2 [1]
I am attaching the packaging I've tried.

The build is failing with this error:
running build_ext
# cyvcf2: htslib mode is BUILTIN
# cyvcf2: htslib configure options is None
error: [Errno 2] No such file or directory: './configure'
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("./setup.py" 
"build") exit-status: 1 term-signal: #f stop-signal: #f>

What is very disturbing is that it builds fine in a debugging 
environment following the documentation [2]

The .configure file is present in the failed build, so there must be 
something going on with the setup.py not managing to change directory to 
htslib in the build_htslib function.

If anyone has any guidelines to debug this further it would be much 
appreciated.

Thanks,
Alexis

[1] https://github.com/brentp/cyvcf2/
[2] https://guix.gnu.org/manual/en/guix.html#Debugging-Build-Failures

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

(define-module (cyvcf2)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages tls)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system python)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system pyproject))

(define-public python-cyvcf2
  (package
    (name "python-cyvcf2")
    (version "0.30.28")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "cyvcf2" version))
       (sha256
        (base32 "03ycp7php5nzvhgj89k8js8z2xm3i8d1f76jlsfdy472f0apgryx"))))
    (build-system python-build-system)
    (arguments
     `(#:use-setuptools? #f
       #:phases
        (modify-phases %standard-phases
          (add-before 'build 'setenv
             (lambda _
                     (setenv "CYVCF2_HTSLIB_MODE" "BUILTIN")))))) ; unnecessary
    (propagated-inputs (list python-click
                             python-coloredlogs
                             python-numpy))
    (native-inputs (list zlib
                         libdeflate
                         curl
                         openssl
                         autoconf
                         automake
                         ; htslib
                         python-cython))
    (home-page "https://github.com/brentp/cyvcf2/")
    (synopsis "fast vcf parsing with cython + htslib")
    (description "fast vcf parsing with cython + htslib")
    (license license:expat)))


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-03-22  1:03 packaging python-cyvcf2 Alexis Simon
  2024-03-22  1:03 ` Alexis Simon via Guix-Science
@ 2024-03-22 15:25 ` Simon Tournier
  2024-03-22 19:38   ` Alexis Simon
  1 sibling, 1 reply; 8+ messages in thread
From: Simon Tournier @ 2024-03-22 15:25 UTC (permalink / raw)
  To: Alexis Simon, help-guix, guix-science

Hi,

On jeu., 21 mars 2024 at 18:03, Alexis Simon via Guix-Science <guix-science@gnu.org> wrote:

> The build is failing with this error:
> running build_ext
> # cyvcf2: htslib mode is BUILTIN
> # cyvcf2: htslib configure options is None
> error: [Errno 2] No such file or directory: './configure'
> error: in phase 'build': uncaught exception:
> %exception #<&invoke-error program: "python" arguments: ("./setup.py" 
> "build") exit-status: 1 term-signal: #f stop-signal: #f>
>
> What is very disturbing is that it builds fine in a debugging 
> environment following the documentation [2]

Indeed!  Well, another undocumented trick. ;-)

        guix build -L . python-cyvcf2 \
             --with-source=python-cyvcf2=/tmp/cyvcf2-0.30.28 

where /tmp/cyvcf2-0.30.28 is the uncompressed output of “guix build -S”
that I tweak.  Adding this:

--8<---------------cut here---------------start------------->8---
diff -u /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py /tmp/cyvcf2-0.30.28/setup.py
--- /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py	2024-01-30 17:46:32.000000000 +0100
+++ /tmp/cyvcf2-0.30.28/setup.py	2024-03-22 16:15:28.124301350 +0100
@@ -83,7 +83,13 @@
         if htslib_configure_options:
             configure_args.extend(htslib_configure_options.split())
 
-        subprocess.run(configure_args, check=True)
+        print(configure_args,
+              "File exists?", os.path.exists(configure_args[0]),
+              flush=True)
+        try:
+            subprocess.run(configure_args, check=True)
+        except:
+            print("BANG!")
     subprocess.run(["make"], check=True)
 
     os.chdir(current_directory)
--8<---------------cut here---------------end--------------->8---

It leads to this output:

--8<---------------cut here---------------start------------->8---
running build_ext
# cyvcf2: htslib mode is BUILTIN
# cyvcf2: htslib configure options is None
['./configure', 'CFLAGS=-fPIC'] File exists? True
echo '# Default htscodecs.mk generated by Makefile' > htscodecs.mk
echo 'include $(HTSPREFIX)htscodecs_bundled.mk' >> htscodecs.mk
./hts_probe_cc.sh 'gcc' '-g -Wall -O2 -fvisibility=hidden ' '-fvisibility=hidden' >> htscodecs.mk
/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/sh: line 1: ./hts_probe_cc.sh: No such file or directory
Makefile:141: htscodecs.mk: No such file or directory
make: *** [Makefile:124: htscodecs.mk] Error 127
BANG!
Traceback (most recent call last):
[...]
--8<---------------cut here---------------end--------------->8---

Arf, then I have not investigated further.

I think it does not come from ’./configure’ as wrongly reported but from
something triggered by it.

Let me know your progress.  Maybe I could give a closer look next week.

Cheers,
simon



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-03-22 15:25 ` Simon Tournier
@ 2024-03-22 19:38   ` Alexis Simon
  2024-03-22 19:38     ` Alexis Simon via Guix-Science
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alexis Simon @ 2024-03-22 19:38 UTC (permalink / raw)
  To: Simon Tournier, help-guix, guix-science

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


On 22/03/2024 08:25, Simon Tournier wrote:
> Hi,
> 
> On jeu., 21 mars 2024 at 18:03, Alexis Simon via Guix-Science <guix-science@gnu.org> wrote:
> 
>> The build is failing with this error:
>> running build_ext
>> # cyvcf2: htslib mode is BUILTIN
>> # cyvcf2: htslib configure options is None
>> error: [Errno 2] No such file or directory: './configure'
>> error: in phase 'build': uncaught exception:
>> %exception #<&invoke-error program: "python" arguments: ("./setup.py"
>> "build") exit-status: 1 term-signal: #f stop-signal: #f>
>>
>> What is very disturbing is that it builds fine in a debugging
>> environment following the documentation [2]
> 
> Indeed!  Well, another undocumented trick. ;-)
> 
>          guix build -L . python-cyvcf2 \
>               --with-source=python-cyvcf2=/tmp/cyvcf2-0.30.28
> 
> where /tmp/cyvcf2-0.30.28 is the uncompressed output of “guix build -S”
> that I tweak.  Adding this:
> 
> --8<---------------cut here---------------start------------->8---
> diff -u /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py /tmp/cyvcf2-0.30.28/setup.py
> --- /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py	2024-01-30 17:46:32.000000000 +0100
> +++ /tmp/cyvcf2-0.30.28/setup.py	2024-03-22 16:15:28.124301350 +0100
> @@ -83,7 +83,13 @@
>           if htslib_configure_options:
>               configure_args.extend(htslib_configure_options.split())
>   
> -        subprocess.run(configure_args, check=True)
> +        print(configure_args,
> +              "File exists?", os.path.exists(configure_args[0]),
> +              flush=True)
> +        try:
> +            subprocess.run(configure_args, check=True)
> +        except:
> +            print("BANG!")
>       subprocess.run(["make"], check=True)
>   
>       os.chdir(current_directory)
> --8<---------------cut here---------------end--------------->8---
> 
> It leads to this output:
> 
> --8<---------------cut here---------------start------------->8---
> running build_ext
> # cyvcf2: htslib mode is BUILTIN
> # cyvcf2: htslib configure options is None
> ['./configure', 'CFLAGS=-fPIC'] File exists? True
> echo '# Default htscodecs.mk generated by Makefile' > htscodecs.mk
> echo 'include $(HTSPREFIX)htscodecs_bundled.mk' >> htscodecs.mk
> ./hts_probe_cc.sh 'gcc' '-g -Wall -O2 -fvisibility=hidden ' '-fvisibility=hidden' >> htscodecs.mk
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/sh: line 1: ./hts_probe_cc.sh: No such file or directory
> Makefile:141: htscodecs.mk: No such file or directory
> make: *** [Makefile:124: htscodecs.mk] Error 127
> BANG!
> Traceback (most recent call last):
> [...]
> --8<---------------cut here---------------end--------------->8---
> 
> Arf, then I have not investigated further.
> 
> I think it does not come from ’./configure’ as wrongly reported but from
> something triggered by it.
> 
> Let me know your progress.  Maybe I could give a closer look next week.

Thanks a lot for the trick, I was able to finish compiling it, but going 
another route (i.e. unbundling htslib).

I've abandoned running the tests though, I'm hitting a module not found 
error. pytest doesn't manage to load the just built module, probably an 
issue with the paths.

I'm attaching the new version for reference.

Cheers,
Alexis

> 
> Cheers,
> simon
> 

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

(define-module (cyvcf2)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages tls)
  #:use-module (guix packages)
  #: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 cmake)
  #:use-module (guix build-system pyproject))

(define-public python-cyvcf2
  (package
    (name "python-cyvcf2")
    (version "0.30.28")
    (source
     (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/brentp/cyvcf2")
              (commit (string-append "v" version))))
        (sha256
          (base32 "16yhfax509zyip8kkq2b0lflx5bdq5why7d785ayrqyzzq2rxqkk"))
        (modules '((guix build utils)))
        (snippet
         '(begin
            (delete-file-recursively "htslib")))))
    (build-system pyproject-build-system)
    (arguments
     `(#:tests? #f
       #:phases
        (modify-phases %standard-phases
          ; (add-before 'check 'rm-folder
          ;   (lambda _
          ;           (copy-recursively "cyvcf2/tests" "./tests")
          ;           (delete-file-recursively "cyvcf2")
          ;           (mkdir-p "cyvcf2")
          ;           (copy-recursively "tests" "cyvcf2/tests")))
          (add-after 'unpack 'fix-setup
             (lambda* (#:key inputs #:allow-other-keys)
                     (substitute* "setup.py"
                                  ((" or not check_libhts\\(\\)") "")
                                  (("library_dirs=htslib_library_dirs")
                                   (string-append "library_dirs=[\"" (assoc-ref inputs "htslib") "/lib\"]"))
                                  (("\\+ htslib_include_dirs")
                                   (string-append "+ [\"" (assoc-ref inputs "htslib") "/include\"]")))))
          (add-before 'build 'setenv
             (lambda _
                     (setenv "CYTHONIZE" "1")
                     (setenv "CYVCF2_HTSLIB_MODE" "EXTERNAL"))))))
    (inputs (list htslib zlib libdeflate curl openssl python-cython))
    (native-inputs (list python-pytest))
    (propagated-inputs (list python-click
                             python-coloredlogs
                             python-numpy))
    (home-page "https://github.com/brentp/cyvcf2/")
    (synopsis "fast vcf parsing with cython + htslib")
    (description "fast vcf parsing with cython + htslib")
    (license license:expat)))


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-03-22 19:38   ` Alexis Simon
@ 2024-03-22 19:38     ` Alexis Simon via Guix-Science
  2024-03-26 15:47     ` Simon Tournier
  2024-04-18  9:13     ` Ricardo Wurmus
  2 siblings, 0 replies; 8+ messages in thread
From: Alexis Simon via Guix-Science @ 2024-03-22 19:38 UTC (permalink / raw)
  To: Simon Tournier, help-guix, guix-science

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


On 22/03/2024 08:25, Simon Tournier wrote:
> Hi,
> 
> On jeu., 21 mars 2024 at 18:03, Alexis Simon via Guix-Science <guix-science@gnu.org> wrote:
> 
>> The build is failing with this error:
>> running build_ext
>> # cyvcf2: htslib mode is BUILTIN
>> # cyvcf2: htslib configure options is None
>> error: [Errno 2] No such file or directory: './configure'
>> error: in phase 'build': uncaught exception:
>> %exception #<&invoke-error program: "python" arguments: ("./setup.py"
>> "build") exit-status: 1 term-signal: #f stop-signal: #f>
>>
>> What is very disturbing is that it builds fine in a debugging
>> environment following the documentation [2]
> 
> Indeed!  Well, another undocumented trick. ;-)
> 
>          guix build -L . python-cyvcf2 \
>               --with-source=python-cyvcf2=/tmp/cyvcf2-0.30.28
> 
> where /tmp/cyvcf2-0.30.28 is the uncompressed output of “guix build -S”
> that I tweak.  Adding this:
> 
> --8<---------------cut here---------------start------------->8---
> diff -u /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py /tmp/cyvcf2-0.30.28/setup.py
> --- /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py	2024-01-30 17:46:32.000000000 +0100
> +++ /tmp/cyvcf2-0.30.28/setup.py	2024-03-22 16:15:28.124301350 +0100
> @@ -83,7 +83,13 @@
>           if htslib_configure_options:
>               configure_args.extend(htslib_configure_options.split())
>   
> -        subprocess.run(configure_args, check=True)
> +        print(configure_args,
> +              "File exists?", os.path.exists(configure_args[0]),
> +              flush=True)
> +        try:
> +            subprocess.run(configure_args, check=True)
> +        except:
> +            print("BANG!")
>       subprocess.run(["make"], check=True)
>   
>       os.chdir(current_directory)
> --8<---------------cut here---------------end--------------->8---
> 
> It leads to this output:
> 
> --8<---------------cut here---------------start------------->8---
> running build_ext
> # cyvcf2: htslib mode is BUILTIN
> # cyvcf2: htslib configure options is None
> ['./configure', 'CFLAGS=-fPIC'] File exists? True
> echo '# Default htscodecs.mk generated by Makefile' > htscodecs.mk
> echo 'include $(HTSPREFIX)htscodecs_bundled.mk' >> htscodecs.mk
> ./hts_probe_cc.sh 'gcc' '-g -Wall -O2 -fvisibility=hidden ' '-fvisibility=hidden' >> htscodecs.mk
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/sh: line 1: ./hts_probe_cc.sh: No such file or directory
> Makefile:141: htscodecs.mk: No such file or directory
> make: *** [Makefile:124: htscodecs.mk] Error 127
> BANG!
> Traceback (most recent call last):
> [...]
> --8<---------------cut here---------------end--------------->8---
> 
> Arf, then I have not investigated further.
> 
> I think it does not come from ’./configure’ as wrongly reported but from
> something triggered by it.
> 
> Let me know your progress.  Maybe I could give a closer look next week.

Thanks a lot for the trick, I was able to finish compiling it, but going 
another route (i.e. unbundling htslib).

I've abandoned running the tests though, I'm hitting a module not found 
error. pytest doesn't manage to load the just built module, probably an 
issue with the paths.

I'm attaching the new version for reference.

Cheers,
Alexis

> 
> Cheers,
> simon
> 

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

(define-module (cyvcf2)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages tls)
  #:use-module (guix packages)
  #: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 cmake)
  #:use-module (guix build-system pyproject))

(define-public python-cyvcf2
  (package
    (name "python-cyvcf2")
    (version "0.30.28")
    (source
     (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/brentp/cyvcf2")
              (commit (string-append "v" version))))
        (sha256
          (base32 "16yhfax509zyip8kkq2b0lflx5bdq5why7d785ayrqyzzq2rxqkk"))
        (modules '((guix build utils)))
        (snippet
         '(begin
            (delete-file-recursively "htslib")))))
    (build-system pyproject-build-system)
    (arguments
     `(#:tests? #f
       #:phases
        (modify-phases %standard-phases
          ; (add-before 'check 'rm-folder
          ;   (lambda _
          ;           (copy-recursively "cyvcf2/tests" "./tests")
          ;           (delete-file-recursively "cyvcf2")
          ;           (mkdir-p "cyvcf2")
          ;           (copy-recursively "tests" "cyvcf2/tests")))
          (add-after 'unpack 'fix-setup
             (lambda* (#:key inputs #:allow-other-keys)
                     (substitute* "setup.py"
                                  ((" or not check_libhts\\(\\)") "")
                                  (("library_dirs=htslib_library_dirs")
                                   (string-append "library_dirs=[\"" (assoc-ref inputs "htslib") "/lib\"]"))
                                  (("\\+ htslib_include_dirs")
                                   (string-append "+ [\"" (assoc-ref inputs "htslib") "/include\"]")))))
          (add-before 'build 'setenv
             (lambda _
                     (setenv "CYTHONIZE" "1")
                     (setenv "CYVCF2_HTSLIB_MODE" "EXTERNAL"))))))
    (inputs (list htslib zlib libdeflate curl openssl python-cython))
    (native-inputs (list python-pytest))
    (propagated-inputs (list python-click
                             python-coloredlogs
                             python-numpy))
    (home-page "https://github.com/brentp/cyvcf2/")
    (synopsis "fast vcf parsing with cython + htslib")
    (description "fast vcf parsing with cython + htslib")
    (license license:expat)))


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-03-22 19:38   ` Alexis Simon
  2024-03-22 19:38     ` Alexis Simon via Guix-Science
@ 2024-03-26 15:47     ` Simon Tournier
  2024-04-18  9:13     ` Ricardo Wurmus
  2 siblings, 0 replies; 8+ messages in thread
From: Simon Tournier @ 2024-03-26 15:47 UTC (permalink / raw)
  To: Alexis Simon, help-guix, guix-science

Hi Alexis,

On ven., 22 mars 2024 at 12:38, Alexis Simon <alexis.simon@runbox.com> wrote:

> I'm attaching the new version for reference.

Cool!  Well, maybe this package could be part of Guix Science channel or
another.  WDYT?

Cheers,
simon


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-03-22 19:38   ` Alexis Simon
  2024-03-22 19:38     ` Alexis Simon via Guix-Science
  2024-03-26 15:47     ` Simon Tournier
@ 2024-04-18  9:13     ` Ricardo Wurmus
  2024-04-21  1:31       ` Alexis Simon via Guix-Science
  2 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2024-04-18  9:13 UTC (permalink / raw)
  To: Alexis Simon via Guix-Science; +Cc: Simon Tournier, help-guix, Alexis Simon

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

Hi,

> I've abandoned running the tests though, I'm hitting a module not
> found error. pytest doesn't manage to load the just built module,
> probably an issue with the paths.

It's an actual problem with the build.  You need to build the cython
extension first.  I've attached the working package definition.

I'd like to add this to gnu/packages/bioinformatics.scm.  I'd like to
set authorship of the commit to you.  Is the name and email address I
used for attribution correct?  (See the attached commit.)

-- 
Ricardo



[-- Attachment #2: 0001-gnu-Add-python-cyvcf2.patch --]
[-- Type: text/x-patch, Size: 5374 bytes --]

From 12af58e7f29c5a96888ecba7d264669940f1f259 Mon Sep 17 00:00:00 2001
Message-ID: <12af58e7f29c5a96888ecba7d264669940f1f259.1713431532.git.rekado@elephly.net>
From: Alexis Simon <alexis.simon@runbox.com>
Date: Thu, 18 Apr 2024 11:10:22 +0200
Subject: [PATCH] gnu: Add python-cyvcf2.

* gnu/packages/bioinformatics.scm (python-cyvcf2): New variable.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
Change-Id: I0db07e7b5840f5c1f5c68512ffabb3d6b39ab95c
---
 gnu/packages/bioinformatics.scm | 53 +++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 448ea5d6de..d2e0656435 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2022, 2023 Navid Afkhami <navid.afkhami@mdc-berlin.de>
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;; Copyright © 2024 Alexis Simon <alexis.simon@runbox.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1916,6 +1917,58 @@ (define-public python-cmseq
 and sequence consensus.")
     (license license:expat)))
 
+(define-public python-cyvcf2
+  (package
+    (name "python-cyvcf2")
+    (version "0.30.28")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/brentp/cyvcf2")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "16yhfax509zyip8kkq2b0lflx5bdq5why7d785ayrqyzzq2rxqkk"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Delete bundled library
+        '(delete-file-recursively "htslib"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'build-extensions
+            (lambda _
+              ;; Cython extensions have to be built before running the tests.
+              (invoke "python" "setup.py" "build_ext" "--inplace")))
+          (add-after 'unpack 'fix-setup
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "setup.py"
+                (("^htslib_include_dirs =.*")
+                 (string-append "htslib_include_dirs = [\""
+                                #$(this-package-input "htslib") "/include\"]\n"))
+                (("lib_name = \"libhts.so\"")
+                 (string-append "lib_name = \""
+                                (search-input-file inputs "lib/libhts.so.3")
+                                "\"\n")))))
+          (add-before 'build 'use-system-htslib-package
+            (lambda _
+              (setenv "CYTHONIZE" "1")
+              (setenv "CYVCF2_HTSLIB_MODE" "EXTERNAL"))))))
+    (inputs (list curl htslib libdeflate openssl zlib))
+    (native-inputs (list python-cython python-pytest))
+    (propagated-inputs
+     (list python-click
+           python-coloredlogs
+           python-numpy))
+    (home-page "https://github.com/brentp/cyvcf2/")
+    (synopsis "Fast vcf file parsing with Cython and htslib")
+    (description "Cyvcf2 is a Cython wrapper around htslib built for fast
+parsing of Variant Call Format (VCF) files.")
+    (license license:expat)))
+
 (define-public python-decoupler-py
   ;; This latest commit fixes a bug in test_omnip.py.
   (let ((commit "459b235348ddd9135217a3722d9dd1caa9a14ace")

base-commit: 7bed290fdfd830d690daf065de6d2ecab73309d9
prerequisite-patch-id: 5da8ef187becff2c53ea5f2031e8825db623eb65
prerequisite-patch-id: 13be25d244e0bf4742f2713c79b657a10206fd4a
prerequisite-patch-id: 5eac5ecb9efd0643ee72851a87db05636faadb22
prerequisite-patch-id: c991e73ae60aab13d5b364946213cd75acff1787
prerequisite-patch-id: 88eb87c18d5e09956462a19515d2efb22d508cb4
prerequisite-patch-id: 6af49e118b9dbcc75d410d97c1a6f6e13d81bafe
prerequisite-patch-id: 5444dc17e9de17cdd39e24c969589e5a94488076
prerequisite-patch-id: b3e368fe34327e828bc15d07383f9adf2e54102a
prerequisite-patch-id: 1cbd95e12fd254f4d301786938e3734106949d1e
prerequisite-patch-id: fc39a6a4a400c1d4b094cd1d3029ecfbe2f70e6d
prerequisite-patch-id: 02cc7b0f2140f6342ed1d32a1f09cd7b2e61d2dd
prerequisite-patch-id: b0c59b60fcda7ce3c4b76a2f679db0403ac4b1a5
prerequisite-patch-id: 2104d5a932eeb3def4e438643469c97f8d5703ac
prerequisite-patch-id: 98982539329a10f4947ae1e412b9543ad15fdc3d
prerequisite-patch-id: 577d37113f5124f1bfc50df84021190ed7d75edf
prerequisite-patch-id: e049fd1dac3aac5fc727237642b6d385fd6bf33f
prerequisite-patch-id: 98608c3b9c9f927167b0aad70567e6ee42fef7e5
prerequisite-patch-id: 4627ef56075e71c4eeb975c4a26ee1e749ee69b0
prerequisite-patch-id: e43d1ce95f721374308a3f05dc436e801e96cf37
prerequisite-patch-id: 51c0cfd16f8214e059d05a8576842f902fced7c4
prerequisite-patch-id: 5bb19f2748c376544fc69aafb74e2c5f192e5426
prerequisite-patch-id: 894cce561d9bdddf0c81d80b419544cdd2d8142b
prerequisite-patch-id: aeca519cc08fb04843001e32fa8b69eb2b082548
prerequisite-patch-id: 5e9a637f0716105f3d00d44d1d8c24436f5cbb4f
prerequisite-patch-id: e5bf09d839ad19c3d13a81f3a26751663f8766c0
prerequisite-patch-id: eb002e03793d80ee3e13a6f03340bd107ec3a3ea
prerequisite-patch-id: d9c2389f4ec6e9899d5456853cb40fa2be1cc22d
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: packaging python-cyvcf2
  2024-04-18  9:13     ` Ricardo Wurmus
@ 2024-04-21  1:31       ` Alexis Simon via Guix-Science
  0 siblings, 0 replies; 8+ messages in thread
From: Alexis Simon via Guix-Science @ 2024-04-21  1:31 UTC (permalink / raw)
  To: Ricardo Wurmus, Alexis Simon via Guix-Science; +Cc: Simon Tournier, help-guix

Hi,

this is great, thanks for fixing the tests and improving the packaging.

On 18/04/2024 02:13, Ricardo Wurmus wrote:
> Hi,
> 
>> I've abandoned running the tests though, I'm hitting a module not
>> found error. pytest doesn't manage to load the just built module,
>> probably an issue with the paths.
> 
> It's an actual problem with the build.  You need to build the cython
> extension first.  I've attached the working package definition.
> 
> I'd like to add this to gnu/packages/bioinformatics.scm.  I'd like to
> set authorship of the commit to you.  Is the name and email address I
> used for attribution correct?  (See the attached commit.)
> 

Yes those info are correct, thanks for including it!

Cheers,
Alexis


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-21  1:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22  1:03 packaging python-cyvcf2 Alexis Simon
2024-03-22  1:03 ` Alexis Simon via Guix-Science
2024-03-22 15:25 ` Simon Tournier
2024-03-22 19:38   ` Alexis Simon
2024-03-22 19:38     ` Alexis Simon via Guix-Science
2024-03-26 15:47     ` Simon Tournier
2024-04-18  9:13     ` Ricardo Wurmus
2024-04-21  1:31       ` Alexis Simon via Guix-Science

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).