Re: Profiles for Python projects

2020-06-18 Thread Marius Bakke
Hi Zelphir,

Zelphir Kaltstahl  writes:

> I create a profile with that and it works fine:
>
> guix package --manifest="manifest.scm" 
> --profile="${GUIX_EXTRA_PROFILES}"/my-env/my-env
>
> Then I do the sourcing:
>
> GUIX_PROFILE="${GUIX_EXTRA_PROFILES}/my-env/my-env"; source 
> "${GUIX_PROFILE}/etc/profile"

[...]

> I also get a path in the profile I created. So far all seems to just
> work. However, then I hit a snag when trying to run the tests of the
> project:
>
> LOG_LEVEL="DEBUG" PYTHONPATH="$(pwd)/my_project" python3 -m pytest -m 
> "my_test_marker" -s -vvv
>
> I now get the error:
>
> No module named pytest

This is because you are overriding PYTHONPATH.  If you run it as ...

  LOG_LEVEL="DEBUG" PYTHONPATH="$(pwd)/my_project:$PYTHONPATH" python3 -m 
pytest -m "my_test_marker" -s -vvv

... you might have better luck.  Guix relies on PYTHONPATH to make
Python modules available because there is no single site-packages
directory like in some other distributions.

HTH!
Marius


signature.asc
Description: PGP signature


Profiles for Python projects

2020-06-18 Thread Zelphir Kaltstahl
Hi Guix Users!

Today I experimented a little with creating profiles from manifest.scm
file for Python projects. I have the following manifest.scm:

(specifications->manifest
 '("python@3.8.2"
   "python-falcon@2.0.0"
   "python-levenshtein@0.12.0"
   "python-jsonschema@3.2.0"
   "python-pytest@5.3.5"))

I create a profile with that and it works fine:

guix package --manifest="manifest.scm" 
--profile="${GUIX_EXTRA_PROFILES}"/my-env/my-env

Then I do the sourcing:

GUIX_PROFILE="${GUIX_EXTRA_PROFILES}/my-env/my-env"; source 
"${GUIX_PROFILE}/etc/profile"

This also works fine and when I do:

which python3
#
which pytest

I also get a path in the profile I created. So far all seems to just
work. However, then I hit a snag when trying to run the tests of the
project:

LOG_LEVEL="DEBUG" PYTHONPATH="$(pwd)/my_project" python3 -m pytest -m 
"my_test_marker" -s -vvv

I now get the error:

No module named pytest

So it seems, that somehow modules mentioned with

-m 

Are not found. If I use PyTest without

python3 -m

in front, it also does not find libraries and I get errors for the
dependencies of the actual project.

Perhaps there is an easy fix for this. Has anyone used a Guix profile
like this before and knows how to make it work?

Regards,
Zelphir



Re: Testing a new font

2020-06-18 Thread Simen Endsjø



Tobias Geerinckx-Rice  writes:


Efraim Flashner 写道:
You only need to run 'fc-cache -frv', no need for the sudo or 
the path.


Pay close attention to its output the first time, since running 
’$ sudo
fc-cache’ earlier might have created root-owned caches that foul 
things up and
will need to be manually removed (with ‘$ sudo rm’) before 
running ‘$ fc-cache

-rv’ a second time.


Thanks for the heads up. I didn't get any errors or warnings that 
I see, so I

guess everything is fine.



Re: guix build python2 --with-source fails?

2020-06-18 Thread zimoun
Hi Tobias,

On Thu, 18 Jun 2020 at 13:39, Tobias Geerinckx-Rice  wrote:

> Guix expects the source directory to start with the package NAME.

Ah, I did not know.  Thank you.  Now it fails as expected. :-)

> There's a very recent bug report asking to support arbitrary 
> --with-source=NAME=FILE.

I missed it.  Thanks for the pointer.

Well, it was even expecting that it works as
'--with-source=https://example.org/foo.tgz'.


All the best,
simon



Re: Testing a new font

2020-06-18 Thread Tobias Geerinckx-Rice

Efraim Flashner 写道:
You only need to run 'fc-cache -frv', no need for the sudo or 
the path.


Pay close attention to its output the first time, since running ’$ 
sudo fc-cache’ earlier might have created root-owned caches that 
foul things up and will need to be manually removed (with ‘$ sudo 
rm’) before running ‘$ fc-cache -rv’ a second time.


Actually all of 'frv' aren't needed but it's the combination of 
flags I

use.


It's remarkably common.  ‘-r’ already implies ‘-f’ and stands for 
‘really f[orce]’, which is my guess as to why so many brains 
remember ‘-rf’ instead.


Kind regards,

T G-R


signature.asc
Description: PGP signature


Re: Testing a new font

2020-06-18 Thread Simen Endsjø



Efraim Flashner  writes:


On Thu, Jun 18, 2020 at 02:08:49PM +0200, Simen Endsjø wrote:


Hi, I'm new to Guix (still running in VM) trying to add a new 
font, but it

doesn't show up in gnome-tweaks or other places.

I added the font the font to fonts.scm, and ran
$ ./pre-inst-env guix install font-iosevka-aile

I can see the fonts in ~/.guix-profile/share/fonts/truetype, 
but it doesn't

seem
like they're available anywhere.

Tried running
$ sudo fc-cache -f ~/.guix-profile/share/fonts/truetype

but that didn't help either. Any idea what I'm doing wrong?


You only need to run 'fc-cache -frv', no need for the sudo or 
the path.
Actually all of 'frv' aren't needed but it's the combination of 
flags I

use.


Thanks! Works like a charm :) Next up is trying to submit patches.


Re: Testing a new font

2020-06-18 Thread Efraim Flashner
On Thu, Jun 18, 2020 at 02:08:49PM +0200, Simen Endsjø wrote:
> 
> Hi, I'm new to Guix (still running in VM) trying to add a new font, but it
> doesn't show up in gnome-tweaks or other places.
> 
> I added the font the font to fonts.scm, and ran
> $ ./pre-inst-env guix install font-iosevka-aile
> 
> I can see the fonts in ~/.guix-profile/share/fonts/truetype, but it doesn't
> seem
> like they're available anywhere.
> 
> Tried running
> $ sudo fc-cache -f ~/.guix-profile/share/fonts/truetype
> 
> but that didn't help either. Any idea what I'm doing wrong?

You only need to run 'fc-cache -frv', no need for the sudo or the path.
Actually all of 'frv' aren't needed but it's the combination of flags I
use.

-- 
Efraim Flashner  אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted


signature.asc
Description: PGP signature


Testing a new font

2020-06-18 Thread Simen Endsjø



Hi, I'm new to Guix (still running in VM) trying to add a new 
font, but it

doesn't show up in gnome-tweaks or other places.

I added the font the font to fonts.scm, and ran
$ ./pre-inst-env guix install font-iosevka-aile

I can see the fonts in ~/.guix-profile/share/fonts/truetype, but 
it doesn't seem

like they're available anywhere.

Tried running
$ sudo fc-cache -f ~/.guix-profile/share/fonts/truetype

but that didn't help either. Any idea what I'm doing wrong?


Re: guix build python2 --with-source fails?

2020-06-18 Thread Tobias Geerinckx-Rice

Simon,

zimoun 写道:
Why is it not possible to use '--with-source' with the package 
python2?


λ mv tmp/{Python,python2}-2.5.2
λ guix build python2 --with-source=/tmp/python2-2.5.2
substitute: updating substitutes from 
'https://guix.tobias.gr'... 100.0%
substitute: updating substitutes from 
'https://ci.guix.gnu.org'... 100.0%

^C

Guix expects the source directory to start with the package NAME. 
There's a very recent bug report asking to support arbitrary 
--with-source=NAME=FILE.


Kind regards,

T G-R


signature.asc
Description: PGP signature


guix build python2 --with-source fails?

2020-06-18 Thread zimoun
Dear,

As an exercise about rebuilding old versions (e.g. used by old
scientific paper), I have tried to rebuild say the very old Python 2.5.

My naive attempt is to start with:

--8<---cut here---start->8---
wget https://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
tar -xzvf Python-2.5.2.tgz

guix build python2 --with-source=/tmp/Python-2.5.2
guix build: warning: transformation 'with-source' had no effect on 
python2@2.7.17
The following graft will be made:
   /gnu/store/ck7swzbk6h7mc7splsih93xsixc6z4ni-python2-2.7.17.drv
[...]
--8<---cut here---end--->8---

Why is it not possible to use '--with-source' with the package python2?
I was expecting fail to build, not fail to apply the transformation.

I mean, I thought that "guix build foo --with-source" was somehow
equivalent to:

--8<---cut here---start->8---
cd /tmp/Python-2.5.2
guix environment -C python2
./configure
make
--8<---cut here---end--->8---

which works.  Is it not?


Thank you in advance.

All the best,
simon