Hi Alexis,

I'm out of my depth too, but what I would try to do is package those npm
packages first, and add them as input (probably propagated-inputs ?) to
your package, hoping that the npm call in your build process would see
them installed and not try to download them.

The above is assuming npm tried to download stuff, which may not
actually be the problem.

To get access to the npm logs, add a phase before build changing $HOME
to point somewhere else than /homeless-shelter. This is ugly and should
be removed after but for debugging it'll let you access the logs:

    (arguments
       '(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'dont-do-this
             (lambda _
                      (setenv "HOME" ".")  ;; untested
                            )))))

If downloading is not the problem, I solved a similar problem (it was
not python + npm, but Golang + C IIRC, can't find it right now) by
creating two packages with the same source, one with one build system,
and one with the other, the second one depending on the first.

So you could create npm-panel, and then make python-panel depend on
npm-panel, both using the same source.

All of this is quite hacky and untested, maybe somebody else can provide
actual guidance.

Best of luck,

Edouard.


Alexis Simon <alexis.si...@runbox.com> writes:

> Hi,
>
> I'm trying to work on a python package depending on python-panel but I'm out 
> of
> my depth trying to package this one.
>
> python-panel is depending on npm compilation and I don't know how to proceed
> from there.
>
> So I have two questions:
> - Do anyone know any similar cases that I could take as an example for the
>  package definition?
> - Is anyone experienced in both python and npm packaging and could help me?
>
> Here is my current attempt [1]
>
> which fails with:
>
> starting phase `build'
> Using 'hatchling.build' to build wheels, auto-detected 'hatchling.build',
> override '#f'.
> Prepending '[]' to sys.path, auto-detected '#f', override '#f'.
> [PANEL] Starting building custom models
> Using nodejs v22.14.0 and npm 10.9.2
> Working directory: /tmp/guix-build-python-panel-1.6.3.drv-0/panel-1.6.3/panel
> Using different version of bokeh, rebuilding from scratch.
> Running npm install.
> npm error Exit handler never called!
> npm error This is an error with npm itself. Please report this error at:
> npm error   <https://github.com/npm/cli/issues>
> npm error Log files were not written due to an error writing to the directory:
> /homeless-shelter/.npm/_logs
> npm error You can rerun the command with `--loglevel=verbose` to see the logs 
> in
> your terminal
> npm install failed with exit code 1.
>
> I guess npm is trying to download some stuff and I should have a phase to
> compile manually those parts but I don't know where to start.
>
> Thanks for any help you could provide
>
> Best,
> Alexis
>
> [1]
> https://codeberg.org/alxsim/guix-tsverse/src/commit/df5d0a55d00dc47471cf5a8e6cb787675dcfba7e/modules/packages/tsbrowse.scm#L358

Reply via email to