pyrompt.github_integration#
GitHub integration for sharing and discovering prompt collections.
Enables:
Publishing collections to GitHub repositories
Discovering public collections
Syncing collections with GitHub
Functions
|
Clone a GitHub collection to local directory. |
|
Discover public *_pyrompt repositories on GitHub. |
|
Fork a collection to your account or organization. |
Classes
|
Prompt collection backed by GitHub repository. |
- class pyrompt.github_integration.GitHubPromptCollection(repo, *, token=None, readonly=True, branch='main', local_cache=None, collection_type='prompts')[source]#
Bases:
MutableMappingPrompt 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
- sync(message='Update prompts via pyrompt')[source]#
Push local changes to GitHub.
- Parameters:
message (
str) – Commit message- Raises:
PermissionError – If collection is readonly
- pyrompt.github_integration.clone_collection(repo, local_path, token=None)[source]#
Clone a GitHub collection to local directory.
- Parameters:
Example
>>> clone_collection( ... 'thorwhalen/awesome_prompts_pyrompt', ... '/tmp/my_prompts' ... )
- pyrompt.github_integration.discover_prompt_collections(search_term=None, min_stars=0, language='Python', max_results=50)[source]#
Discover public *_pyrompt repositories on GitHub.
- Parameters:
- Return type:
- 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, token, organization=None)[source]#
Fork a collection to your account or organization.
- Parameters:
- Return type:
- Returns:
GitHubPromptCollection for the new fork
Example
>>> forked = fork_collection( ... 'thorwhalen/awesome_prompts_pyrompt', ... token='ghp_...' ... )