Re: [RFC/PATCH v2] CodingGuidelines: add Python coding guidelines
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Feb 1, 2013, 08:39 UTC
- Message-ID
- <510B7F4B.7040902@alum.mit.edu>
- In-Reply-To
- <20130130203158.GN1342@serenity.lan>
On 01/30/2013 09:31 PM, John Keeping wrote:
Show 34 quoted lines
> On Wed, Jan 30, 2013 at 11:05:10AM +0100, Michael Haggerty wrote: >> [...] maybe we should establish a small Python library of >> compatibility utilities (like a small "six"). [...] >> But I haven't had time to think of where to put such a library, how to >> install it, etc. > > If we want to go that route, I think restructuring the > "git_remote_helpers" directory and re-using its infrastructure for > installing the "Git Python modules" would be the way to go. The > directory structure would become something like this: > > git/ > `-- python/ > |-- Makefile # existing file pulled out of git_remote_helpers > |-- < some new utility library > > |-- git_remote_helpers > | |-- __init__.py > | |-- git > | | |-- __init__.py > | | |-- exporter.py > | | |-- git.py > | | |-- importer.py > | | |-- non_local.py > | | `-- repo.py > | `-- util.py > |-- setup.cfg # existing file pulled out of git_remote_helpers > `-- setup.py # existing file pulled out of git_remote_helpers > > > It looks like the GitPython project[1] as already taken the "git" module > name, so perhaps we should use "git_core" if we do introduce a new > module. > > [1] http://pypi.python.org/pypi/GitPython
This sounds reasonable. But not all Python code will go under the "python" subdirectory, right? For example, I am working on a Python script that fits thematically under contrib/hooks.
OTOH (I'm thinking aloud here) it is probably a bad idea for a hook script to depend on a Python module that is part of git itself. Doing so would make the hook script depend on a particular version of git (or at least a version with a compatible Python module). But users might be reluctant to upgrade git just to install a hook script.
Michael
-- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/