unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Phil <phil@beadling.co.uk>
To: zimoun <zimon.toutoune@gmail.com>, help-guix@gnu.org
Subject: Re: Avoiding PYTHONPATH - latest?
Date: Mon, 30 Nov 2020 15:04:56 +0000	[thread overview]
Message-ID: <85zh2yq413.fsf@beadling.co.uk> (raw)
In-Reply-To: <86pn3vvvt5.fsf@gmail.com>

Hi

zimoun writes:

> Just to understand, is your point to be able to mix both “pip install“
> and “guix install”?  If yes, it appears to me a bad idea, choose one or
> the other.

I suppose my point is - system-level use of PYTHONPATH is ill-advised, because
it's prescribed use in Python is for user-level sys.path modifications. An
example of when this causes surprise is creating an environment using
'pip install -e .' will not give a pure environment if PYTHONPATH is set.

I 100% agree it's a bad idea to mix packagers, but pip install's use-cases go
beyond the need to do fixed installs of package@version, provided by Guix.

The use of 'pip install -e .' to create a development environment is
widely (but not exclusively) used in the python community, and
integrates nicely with many python tools (eg pytest).  It's not
essential of course.

Given that Guix profile's can't be edited from within a Guix profile
(for obvious reasons), if I want to edit my code whilst it is installed,
I see the only way to do this is by having a virtual env on top of a
Guix profile that contains only my own module - with the Guix profile
holding Python and all the imports I depend on.

It's not pretty.  So much so that I'm considering if I can live without
'-e', but the workarounds of using sys.append, PYTHONPATH, or even pth
files are, at least in some people's minds, not as clean.

If anyone has worked-out a better setup with Guix/Python, I'm keen to
get advice (hence me floating the (half-baked) idea of using pyvenv.cfg
to create Guix profiles).

There's a 2 year long discussion on a similar topic for the Poetry package
(which also aims to replace pip, for different reasons than Guix):
https://github.com/python-poetry/poetry/issues/34

Things get a bit heated, which isn't helpful, but it does illustrate how
dearly some python fans take their ability to use pip's developer setup
- I'm more pragmatic and looking for workable solutions, preferably without 
fighting Python stock features just to keep Guix happy ;-)

Perhaps the simple answer here is never mix pip and guix, and setup your
development environment so there is never a requirement on pip.  But this is
a limitation to people used to working this way.

If nothing else, personally, it was a good off-the-deep-end way to get under the
covers of Guix's treatment of python and python packages :-)


  reply	other threads:[~2020-11-30 15:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  0:22 Avoiding PYTHONPATH - latest? Phil
2020-11-30  9:41 ` Phil
2020-12-03 11:06   ` 宋文武
2020-11-30 13:05 ` zimoun
2020-11-30 15:04   ` Phil [this message]
2020-12-01 12:39     ` zimoun
2020-12-01 13:28       ` Phil
2020-12-01 14:54         ` zimoun
2020-12-01 18:46           ` Phil

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=85zh2yq413.fsf@beadling.co.uk \
    --to=phil@beadling.co.uk \
    --cc=help-guix@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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.
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).