[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Improve Python package quality

From: Hartmut Goebel
Subject: Re: [RFC] Improve Python package quality
Date: Sun, 3 Jan 2021 11:48:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

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:


+ (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?

Hartmut Goebel

| Hartmut Goebel          |               |
| | compilers which you thought are impossible |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]