pyrompt.github_integration
GitHub integration for sharing and discovering prompt collections.
Enables: - Publishing collections to GitHub repositories - Discovering public collections - Syncing collections with GitHub
- class pyrompt.github_integration.GitHubPromptCollection(repo: str, *, token: str | None = None, readonly: bool = True, branch: str = 'main', local_cache: str | None = None, collection_type: str = 'prompts')[source]
Prompt collection backed by GitHub repository.
Repositories must end with ‘_pyrompt’ suffix for discovery. Contains prompts/ and/or templates/ directories.
Examples
>>> # Publishing a collection >>> gh = GitHubPromptCollection( ... repo='username/my_prompts_pyrompt', ... token='ghp_...', ... readonly=False ... ) >>> gh['greeting'] = "Hello, {name}!" >>> gh.sync() # Commits and pushes to GitHub
- pyrompt.github_integration.clone_collection(repo: str, local_path: str, token: str | None = None)[source]
Clone a GitHub collection to local directory.
- Parameters:
repo – Repository name (user/repo_pyrompt)
local_path – Local directory path
token – Optional GitHub token
Example
>>> clone_collection( ... 'thorwhalen/awesome_prompts_pyrompt', ... '/tmp/my_prompts' ... )
- pyrompt.github_integration.discover_prompt_collections(search_term: str | None = None, min_stars: int = 0, language: str = 'Python', max_results: int = 50) List[dict][source]
Discover public *_pyrompt repositories on GitHub.
- Parameters:
search_term – Search query (e.g., “python data”)
min_stars – Minimum star count
language – Programming language filter
max_results – Maximum number of results
- Returns:
List of dicts with repo info (name, description, stars, url)
Example
>>> collections = discover_prompt_collections( ... search_term='python', ... min_stars=5 ... ) >>> for repo in collections: ... print(f"{repo['name']}: {repo['stars']} stars")
- pyrompt.github_integration.fork_collection(source: str, token: str, organization: str | None = None) GitHubPromptCollection[source]
Fork a collection to your account or organization.
- Parameters:
source – Source repo (user/repo_pyrompt)
token – GitHub token with repo permissions
organization – Optional organization to fork to
- Returns:
GitHubPromptCollection for the new fork
Example
>>> forked = fork_collection( ... 'thorwhalen/awesome_prompts_pyrompt', ... token='ghp_...' ... )