Phabricator Integration

This is a module providing optional connection between a ballpark and Phabricator “Maniphest” tasks in a project. Most useful at project start, to populate the workboard from the ballpark estimate.

To persist association between ballpark tasks and Phabricator tasks, the description of tasks in Python is modified. However, since the task tree is defined in your own Python code, we cannot update it for you: please use the ballparker.types.Task.to_dsl() method to retrieve a representation of your updated tree as Ballparker DSL.

Needs arcanist install and configured:

sudo apt install php-curl
mkdir -p ~/apps/arcanist  # or other directory of your choice
cd ~/apps/arcanist
git clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.git
ln -s ~/apps/arcanist/arcanist/bin/arc ~/.local/bin/
# or other target directory on your path

Create an ~/.arcrc file (or .arcconfig in current directory) with the following contents, modified as required:

{
  "phabricator.uri": "https://phabricator.example.com/"
}

then run:

arc install-certificate

and follow the prompts to get a token, etc.

Note

You will need the phabricator PyPI package installed to use this module.

class ballparker.phab.PhabSync(project_slug, phab=None)[source]

Class to sync some aspects of a ballpark with Phabricator.

query_tasks(root_task)[source]

Initialize extra members of the provided task and its children.

If a task description is of the form "T{task_num}: {desc}", it extracts the task num and sets it as a member of the task.

Then, for all tasks with a task_num member but either no phid member or no phab_fields member, query Phabricator to retrieve all that data.

Can be run multiple times on the same ballpark without harm.

create_tasks(root_task)[source]

Create Phabricator tasks for each task that lacks one.

The task number gets added to the task description: you should output root_task.to_dsl() after this (see ballparker.types.Task.to_dsl()) and update your ballpark definition.

You can run this more than once in a single execution, but don’t run it in a second execution unless you’ve updated your ballpark from to_dsl() or you’ll create duplicate tasks.

Tasks that are top-level below project() are considered epics, and named accordingly in Phabricator. Tasks are created in the same space as the project, and leaf tasks have their “points” set from the ballpark.

Subtask/parent task relationships are replicated from the ballpark to Phabricator.

Returns the task description of all tasks created.