A Python library for managing GitHub Copilot, Rulesets, and Custom Properties
Project description
OctoPy
OctoPy is a Python library that provides a comprehensive interface to GitHub's API, specifically focused on managing GitHub Copilot, Rulesets, and Custom Properties for organizations and repositories.
Features
GitHub Copilot Management
- Get Copilot metrics for enterprises, organizations, and teams
- Retrieve Copilot usage summaries
- Manage Copilot seat assignments for users and teams
- Add/remove users and teams from Copilot subscriptions
Rulesets Management
- Create, read, update, and delete rulesets for organizations
- Manage repository-specific rulesets
- List and query ruleset configurations
Custom Properties Management
- Manage custom properties for organizations and repositories
- Create, update, and delete custom property definitions
- Query custom property configurations
Installation
pip install octopy
Usage
Basic Setup
from octopy import OctoPy
# Initialize with a personal access token
octopy = OctoPy(
token="your_github_token",
org="your_organization",
enterprise="your_enterprise" # Optional
)
GitHub App Authentication
from octopy import OctoPy
# Initialize with GitHub App credentials
octopy = OctoPy(
app_id="your_app_id",
org="your_organization"
)
Examples
Managing Copilot
# Get Copilot metrics for an organization
metrics = octopy.get_copilot_metrics_org()
# Add users to Copilot
octopy.add_users_to_copilot(["username1", "username2"])
# Get usage summary for a team
usage = octopy.get_copilot_usage_team("team-slug")
Managing Rulesets
# List organization rulesets
rulesets = octopy.list_org_rulesets()
# Create a new ruleset
ruleset_data = {
"name": "My Ruleset",
"target": "branch",
"enforcement": "active"
}
octopy.create_org_ruleset(ruleset_data)
Managing Custom Properties
# List organization custom properties
properties = octopy.list_org_custom_properties()
# Create a new custom property
property_data = {
"value_type": "string",
"required": True
}
octopy.create_org_custom_property("property_name", property_data)
Requirements
- Python 3.6+
requestslibrary- GitHub Personal Access Token or GitHub App credentials
- Appropriate GitHub permissions for the operations you want to perform
Authentication
OctoPy supports two authentication methods:
- Personal Access Token (PAT)
- GitHub App authentication
For GitHub App authentication, you'll need:
- App ID
- Private key file (app_key.pem)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details. # Octo-Py
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 evan_octo_py-0.1.0.tar.gz.
File metadata
- Download URL: evan_octo_py-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c3384a4a48e812918a8a44dfcaa081e3f4d7bc87c2311556986a7c226e4a6b3
|
|
| MD5 |
6062c6c5cc32ea6bab1e930ce0245b38
|
|
| BLAKE2b-256 |
e30dfce2579ef288536b3aa18a6dc1ea1687f01b7f54365e37a149e98091c778
|
File details
Details for the file evan_octo_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evan_octo_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11e964fb0389c685375ee313a588dd8e6ee37f31bcdd138132d9fa9c96c66221
|
|
| MD5 |
e40f851351ee9ab93896e7c8c745283d
|
|
| BLAKE2b-256 |
ccc6819a7367ce4544aca0c7b7c8b0b10d62e3b18aab290dc14eb4bcc9e76eea
|