A Python module for managing GitHub Projects (v2), issues, labels, and milestones
Project description
GitHub Project Manager
A Python library for managing GitHub Projects (v2), issues, labels, and milestones.
Features
- Create and manage GitHub Projects (v2)
- Add issues to projects
- Automatically update issue descriptions when they change
- Manage project fields and status options
- Create and update labels across multiple repositories
- Create and update milestones across multiple repositories
Installation
pip install github-project-manager
Requirements
This library depends on:
- Python 3.10+
- requests >= 2.25.0
- python-dotenv >= 0.15.0
Configuration
You need to set the following environment variables:
GITHUB_TOKEN: Your GitHub personal access token with appropriate permissionsGITHUB_ORG: Your GitHub organization name
You can also use a .env file:
GITHUB_TOKEN=your_github_token
GITHUB_ORG=your_org_name
Usage Examples
Initialize the Manager
from github_project_manager import GitHubProjectManager
# Initialize the manager
manager = GitHubProjectManager()
# Initialize with an existing project
manager = GitHubProjectManager("My Existing Project")
# If you need to change the logging level
import logging
logging.getLogger("ghpm").setLevel(logging.DEBUG)
Create a Project and Add Issues
# Create a new project (or use an existing one with the same name)
project_id = manager.create_project("My Project")
# Create an issue (or use an existing one with the same title)
# Method 1: Create issue and add to project separately
issue_node_id = manager.create_issue("my-repo", "Issue Title", "Issue description")
manager.add_issue_to_project(issue_node_id)
# Method 2: Create issue and add to project in one step
issue_node_id = manager.create_issue(
"my-repo",
"Issue Title",
"Issue description",
add_to_project=True
)
# Method 3: Create issue with labels
issue_node_id = manager.create_issue(
"my-repo",
"Issue Title",
"Issue description",
add_to_project=True,
labels=["bug", "high-priority"]
)
Automatic Issue Description Updates
The library will automatically update the description of an existing issue if it has changed:
# If an issue with this title already exists but with a different description,
# the description will be updated automatically
issue_node_id = manager.create_issue(
"my-repo",
"Existing Issue Title",
"Updated description"
)
Manage Project Status Options
from github_project_manager import StatusOption
# Define status options
status_options = [
StatusOption("To Do", "RED"),
StatusOption("In Progress", "YELLOW"),
StatusOption("Done", "GREEN", "Completed work"),
]
# Update the project's status field
manager.update_status_options(status_options)
# Replace all existing options with new ones
manager.update_status_options(status_options, preserve_existing=False)
Manage Labels Across Repositories
from github_project_manager import IssueLabel
# Create a single label
label = IssueLabel("bug", "FF0000", "Something isn't working")
# Create in a single repository
manager.create_labels("my-repo", label)
# Create in multiple repositories
manager.create_labels(["repo1", "repo2"], label)
# Create multiple labels in multiple repositories
labels = [
IssueLabel("bug", "FF0000", "Something isn't working"),
IssueLabel("enhancement", "0000FF", "New feature or request"),
]
manager.create_labels(["repo1", "repo2"], labels)
Manage Milestones Across Repositories
from github_project_manager import IssueMilestone
# Create a milestone with a due date
milestone = IssueMilestone(
"v1.0",
"First stable release",
"2023-12-31T23:59:59Z"
)
# Create in multiple repositories
manager.create_milestones(
["repo1", "repo2"],
milestone
)
License
MIT
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details on how to set up the development environment, run tests, and submit contributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_project_manager-0.2.0.tar.gz.
File metadata
- Download URL: github_project_manager-0.2.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da8854aedf165f618a7cd7bff6461b0365311a9cf6750ca2f1fb1d6257fed6e6
|
|
| MD5 |
dbb6a962657d75135567eb9baee2a338
|
|
| BLAKE2b-256 |
a6c399010fbe54aa1847a7aaa93fb551ca0cd8520aa77cc02f124dc57e0ccf26
|
Provenance
The following attestation bundles were made for github_project_manager-0.2.0.tar.gz:
Publisher:
publish.yml on ezrahill/github-project-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
github_project_manager-0.2.0.tar.gz -
Subject digest:
da8854aedf165f618a7cd7bff6461b0365311a9cf6750ca2f1fb1d6257fed6e6 - Sigstore transparency entry: 199360751
- Sigstore integration time:
-
Permalink:
ezrahill/github-project-manager@5e332b0ad3c4a5b6b029c13d9269edab0a941cf2 -
Branch / Tag:
- Owner: https://github.com/ezrahill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e332b0ad3c4a5b6b029c13d9269edab0a941cf2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file github_project_manager-0.2.0-py3-none-any.whl.
File metadata
- Download URL: github_project_manager-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ffc812f6dfb86f6c6761964a389702e1831f0e3db00d66f6bcf018c529b6b1
|
|
| MD5 |
0792ff25fff3550524d5be568175eca0
|
|
| BLAKE2b-256 |
bfa777375f26ffee87f0f52b7ec18f94a5b9cdf33792302945cddc4ac6ae7fbd
|
Provenance
The following attestation bundles were made for github_project_manager-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on ezrahill/github-project-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
github_project_manager-0.2.0-py3-none-any.whl -
Subject digest:
21ffc812f6dfb86f6c6761964a389702e1831f0e3db00d66f6bcf018c529b6b1 - Sigstore transparency entry: 199360759
- Sigstore integration time:
-
Permalink:
ezrahill/github-project-manager@5e332b0ad3c4a5b6b029c13d9269edab0a941cf2 -
Branch / Tag:
- Owner: https://github.com/ezrahill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e332b0ad3c4a5b6b029c13d9269edab0a941cf2 -
Trigger Event:
release
-
Statement type: