Skip to content

Pyblish for Git

Marcus Ottosson edited this page Aug 29, 2014 · 1 revision

Pyblish for Git is about running validations upon each commit, push, pull or merge, either directly after or before.

Git already has a mechanism for running tests at certain points during commit, push or pull called "hooks". Hooks can be both a shell or Python script and could potentially run any number of tests upon the code being committed.

The Problem

However, it doesn't provide any one particular method of writing tests. This can make it tricky to expand upon the technique with for example a GUI. Using Pyblish, tests can be written into the plug-in architecture and thus provide users with some additional benefits:

  1. Mandatory or optional tests controlled by each user.
  2. A graphical overview of how things are going.
  3. Help and auto-corrects when things go wrong.
  4. The construction of tests via our Node graph.
  5. As validations conform to a given interface, they are natively shareable

Architecture

Each validation would take the form of a Validation and would run at each pull, push, commit or merge, either before or after.

class ValidateLatestCommit(Validator):
    # Ensure user has the latest commit
    families = ['before-push']
    hosts = ['git']

class ValidateCommit(Validator):
    # Ensure code passes standard Python tests and Pyblish validations
    families = ['before-commit']
    hosts = ['git']

class ValidateMerge(Validator):
    # Ensure merge went as it should
    families = ['before-commit', 'after-commit']
    hosts = ['git']
Clone this wiki locally