Skip to main content

Python + CLI helpers for GitHub Projects task ownership

Project description

gh-task

Python + CLI helpers for taking, moving, and releasing GitHub Project (v2) issues using a lightweight ownership label protocol.

Install (local)

pip install -e .

Prerequisites

gh must be installed and authenticated (the library uses it to fetch a token if no GH_TOKEN/GITHUB_TOKEN is set).

Auth

Uses GH_TOKEN or GITHUB_TOKEN if set, otherwise falls back to gh auth token. Ensure the token has the project scope for Project v2 access.

Python usage

from gh_task import Project

project = Project(
    project="https://github.com/users/yieldthought/projects/3/views/1",
    name="my-name",
    has_label=["bug", "help wanted"],
)

# list status columns (project can be a short ref or full URL)
print(project.list())

# list issue numbers in Backlog
print(project.list("Backlog"))

# take a specific issue (number, URL, or owner/repo#number)
issue_id = project.take(2)

# take the first available issue in Backlog that matches the label filter
issue_id = project.take("Backlog")

# move and release
project.move(2, "In review")
project.release(2)

# context-managed lease (auto-release on exit)
with project.lease("Backlog") as issue:
    print(issue.number)

CLI

# list status columns
 gh-task list -p yieldthought/projects/3 -n my-name

# list issues in Backlog
 gh-task list -p yieldthought/projects/3 -n my-name Backlog

# take a specific issue
 gh-task take -p yieldthought/projects/3 -n my-name -i 2

# take the first available issue in Backlog
 gh-task take -p yieldthought/projects/3 -n my-name -l "bug,help wanted" Backlog

# move and release
 gh-task move -p yieldthought/projects/3 -n my-name -i 2 -s "In review"
 gh-task release -p yieldthought/projects/3 -n my-name -i 2

Label filtering

has_label (or --label/-l) restricts .list() and .take() to issues that carry at least one of the provided labels. When taking a specific issue, a TakeError is raised if it does not match the filter.

Ownership protocol

take() performs the following:

  1. Verify there is no label starting with owner:.
  2. Add a comment Taking: <name>.
  3. Wait 1s (configurable) and fetch all comments beginning with Taking:.
  4. If the earliest Taking: comment is yours, add owner: <name> label.
  5. Remove your Taking: comment (best-effort).

If any step fails, the comment is removed and a TakeError is raised.

Project details


Download files

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

Source Distribution

gh_task-0.1.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_task-0.1.3-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file gh_task-0.1.3.tar.gz.

File metadata

  • Download URL: gh_task-0.1.3.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_task-0.1.3.tar.gz
Algorithm Hash digest
SHA256 97c449dc06125bbd4e75e662cf7f9e0b26301308c1f032cab5618ed4e9ff5d60
MD5 6c740b0fdf0f3cfe374ce11e358cf81d
BLAKE2b-256 4d135920398e26a6c686b0bfd9e3ead02656d5c71c426a282002c92a0a793a4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_task-0.1.3.tar.gz:

Publisher: workflow.yml on yieldthought/gh-task

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gh_task-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: gh_task-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_task-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 baf191673ce651fdd4f1a9c01b2bad263123f349f3513325fdbe6360b1f42489
MD5 358a5dd7b5a7978e4d880bb806700c66
BLAKE2b-256 aedbb4c662c8d9d3ffc48c3be90b827baa9668ee36f41a9534518e61fee622f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_task-0.1.3-py3-none-any.whl:

Publisher: workflow.yml on yieldthought/gh-task

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page