unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: Lars-Dominik Braun <lars@6xq.net>, guix-devel <guix-devel@gnu.org>
Subject: Re: [RFC] Improve Python package quality
Date: Sun, 3 Jan 2021 11:48:09 +0100	[thread overview]
Message-ID: <11b7fa96-1ae8-bc1f-6c11-58f4abfb57b7@crazy-compilers.com> (raw)
In-Reply-To: <X/GV2JXi/iOU2oAZ@noor.fritz.box>

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

Hi Lars,

this is a good idea. (Since you where mentioning setuptools, I first was 
afraid your solution would be tightened to setuptools, but it is not. 
Well done!)

Some comments (most of which are nit-picking):

> +;; Python 2 support.
>
> +"from __future__ import print_function"
>
This comment should go behind the line of code, as it only related to 
that single line.

> +" req = str (dist.as_requirement ())"
>
> +;; dist.activate() is not enough to actually check requirements, we 
> have to
>
> +;; .require() it.
>
> +" pkg_resources.require (req)"
>
I suggest putting the comments into the python source. This would allow 
to indent them according the the python code, which would make it easier 
to understand. This would also allow to use a single multi-line 
guile-string, which allows to easiyl copy the script out and in from the 
guile-source for testing it.


> +" except Exception as e:"
>
> +" print (req, e)"
>
> +" sys.exit (1)"
>
raise SystemExit(1)


> +" print ('...trying to load endpoint', group, name)"

Please follow PEP8 (no space before opening parentheses) - also at other 
places.


> +" for name in dist.get_metadata_lines ('top_level.txt'):"
>
> +" print ('...trying to load module', name)"
>
Add `end=""`, thus the "result" can be printed on the same line.

> +" except ModuleNotFoundError:"
>
> +" print ('......WARNING: module', name, 'not found, continuing')"
>
Print result terse, on same line, without repeating the name:

   print (' WARNING: not found')

> +" continue")
>
Add printing success:

     else:
        print("passed")

> + (add-installed-pythonpath inputs outputs)
>
> + ;; Make sure the working directory is empty (i.e. no Python modules 
> in it)
>
> + (with-directory-excursion "/tmp"
>
Would is be better to use mkdtemp here to ge a fresh, empty directory?


-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |


[-- Attachment #2: Type: text/html, Size: 5277 bytes --]

  reply	other threads:[~2021-01-03 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 10:00 [RFC] Improve Python package quality Lars-Dominik Braun
2021-01-03 10:48 ` Hartmut Goebel [this message]
2021-01-05  9:19   ` Lars-Dominik Braun
2021-01-03 15:04 ` Tobias Geerinckx-Rice
2021-01-05  9:31 ` Vincent Legoll
2021-01-05 10:20   ` Lars-Dominik Braun
2021-01-05 10:48     ` Vincent Legoll
2021-01-06 16:09       ` Hartmut Goebel
2021-01-07 13:31 ` Lars-Dominik Braun

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=11b7fa96-1ae8-bc1f-6c11-58f4abfb57b7@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=guix-devel@gnu.org \
    --cc=lars@6xq.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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