-
-
Notifications
You must be signed in to change notification settings - Fork 397
Guidelines
-
public libgit2 structs should be python objects (classes) - Example: git_repository => Repository()
-
naming convention: strip git_
struct_name
_* - Example: git_repository_config() => Repository.config() -
iterations should be implemented as a generator, if this is not possible we need to change libgit2 (other bindings will benefit from this as well)
-
every method should map to one libgit2 function (exceptions are iterations)
-
return values of methods
- no lists use generators instead
- no dictionaries use tuples or objects instead
- no instantiation of objects use strings instead (important for generators) like sha1-hash for objects or names for references. The high-level API can instance them if necessary.
-
Repository() is a facade for _Repository() (basic c api) Here you should add every pythonic sugar like diff()
-
We try to implement everything in the c extension as simple as possible. Therefor please do not put too much abstraction into the c extension layer.
Example: Implement several methods for each type/use case like for Diff:
- Tree.diff_to_tree(),
- Tree.diff_to_workdir()
- Tree.diff_to_index()
To have a user friendly api you can now implement a high-level method in python to abstract these methods like Repository.diff()
-
no return value restrictions