Skip to main content

A framework for automating Asana projects and workflows.

Project description

Archie

Archie, the Golden Re-triager

A framework for automating Asana projects and workflows.

Package version Pipeline status Supported Python versions Code style

This repository is canonically hosted on GitLab and mirrored to GitHub. Please direct all issues and contributions to the GitLab repository.

Installation

Archie is published on PyPI under the name asana-archie, and can be installed with Pip or your favorite package manager: python -m pip install asana-archie.

Configuration

First, create a Triager that will run your rules. You’ll need the GID of the Asana project you’re working with, as well as a personal access token for the Asana API.

from archie import Triager
from archie.sources import PollingSource

project = PollingSource("<project-gid>")
archie = Triager(access_token="<access-token>", task_source=project)

Triaging

With that, you can begin defining triage rules that will be applied to incomplete tasks in the project:

from archie.predicates import DueWithin, Overdue, Unassigned
from archie.actions import AddComment, AddFollower

@archie.when(Overdue())
def comment_on_overdue(task):
    return [AddComment("This task is overdue!"), AddFollower("user1@domain.com")]

@archie.when(Unassigned() & DueWithin("2d"))
def comment_on_due_soon(task):
    return [AddComment("This is due soon and needs an owner."), AssignTo("user2@domain.com")]

archie.triage()

Sorting

Archie will also sort the tasks in your project on multiple levels. Each section in your project can have different sorts defined.

from archie.sorters import DueDateSorter, EnumCustomFieldSorter, LikeSorter

priority = EnumCustomFieldSorter("Priority", ["High", "Medium", "Low"])
due_date = DueDateSorter()

archie.order("Backlog", by=priority.and_then(due_date))
archie.order("Feature Requests", by=LikeSorter())
archie.sort()

Workflows

For more complex processes, you can define a multi-stage workflow and have the triager push tasks through it. Stages are defined by their name, entry criteria, and actions. A task will automatically be moved between sections or have its custom fields changed to reflect its stage in the workflow.

from archie.actions import AddComment, AssignTo
from archie.predicates import AlwaysTrue, Assigned, HasComment, IsComplete
from archie.workflows import SectionWorkflow, WorkflowStage

stages = [
    WorkflowStage(
      name="Inbox",
      to_enter=AlwaysTrue(),
      on_enter=[],
    ),
    WorkflowStage(
      name="In Progress",
      to_enter=Assigned(),
      on_enter=[],
    ),
    WorkflowStage(
      name="In Review",
      to_enter=HasComment("github.com/org/repo/pull/"),
      on_enter=[AssignTo("someone@domain.com")],
    ),
    WorkflowStage(
      name="Done",
      to_enter=IsComplete(),
      on_enter=[AddComment("Good work! 🎉")],
    ),
]

workflow = SectionWorkflow("My process", stages)
triager.apply(workflow)

Running

Once your rules are defined, simply run your file as any other script with python.

Caveats

  • This framework will only operate correctly on projects that can be viewed as a board—it will not work correctly on old-style list projects.
  • Some components of this framework rely on inspecting tasks’ stories. Deleting stories on tasks may result in incorrect behavior of the predicates.
  • You may run into issues in projects that have a large number of incomplete tasks. In mild cases, there will be performance issues where it will take a significant amount of time to sort sections and triage tasks. In extreme cases, components may time out and raise exceptions.

Documentation

Full documentation is hosted on GitLab Pages.

Feature requests and bug reports

Please create issues on GitLab to request features or report bugs. Maintenance and improvements are provided on a best effort basis. Contributions in the form of new ideas, additional use cases/examples, and merge requests are welcome!

Project details


Release history Release notifications

This version

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for asana-archie, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size asana_archie-0.1.0-py3-none-any.whl (32.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size asana-archie-0.1.0.tar.gz (28.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page