Skip to content
Bernardo Heynemann edited this page May 18, 2013 · 7 revisions

Basic API (low-level)

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

High-Level API

  • Repository() is a facade for _Repository() (basic c api) Here you should add every pythonic sugar like diff()

  • type checking - example: diff _Repository.Diff.tree_to_tree(), _Repository.Diff.tree_to_workdir() _Repository.tree_to_index()

    should combined to Repository.diff()

  • no return value restrictions

Clone this wiki locally