Skip to content

Commit a66cd97

Browse files
committed
add llms txt
1 parent 66a5c1a commit a66cd97

File tree

4 files changed

+246
-2
lines changed

4 files changed

+246
-2
lines changed

_quarto.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
project:
22
type: website
3+
pre-render:
4+
- pysym2md --output_file apilist.txt ghapi
5+
post-render:
6+
- llms_txt2ctx llms.txt --optional true --save_nbdev_fname llms-ctx-full.txt
7+
- llms_txt2ctx llms.txt --save_nbdev_fname llms-ctx.txt
8+
resources:
9+
- "*.txt"
10+
preview:
11+
navigate: false
12+
port: 3000
313

414
format:
515
html:
@@ -16,6 +26,9 @@ website:
1626
navbar:
1727
background: primary
1828
search: true
29+
right:
30+
- icon: github
31+
href: "https://github.com/answerDotAI/ghapi"
1932
sidebar:
2033
style: floating
2134

apilist.txt

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# ghapi Module Documentation
2+
3+
## ghapi.actions
4+
5+
> Functionality for helping to create GitHub Actions workflows in Python
6+
7+
- `def user_repo()`
8+
List of `user,repo` from `env_github.repository
9+
10+
- `def create_workflow_files(fname, workflow, build_script, prebuild)`
11+
Create workflow and script files in suitable places in `github` folder
12+
13+
- `def fill_workflow_templates(name, event, run, context, script, opersys, prebuild)`
14+
Function to create a simple Ubuntu workflow that calls a Python `ghapi` script
15+
16+
- `def env_contexts(contexts)`
17+
Create a suitable `env:` line for a workflow to make a context available in the environment
18+
19+
- `def create_workflow(name, event, contexts, opersys, prebuild)`
20+
Function to create a simple Ubuntu workflow that calls a Python `ghapi` script
21+
22+
- `@call_parse def gh_create_workflow(name, event, contexts)`
23+
Supports `gh-create-workflow`, a CLI wrapper for `create_workflow`.
24+
25+
- `def example_payload(event)`
26+
Get an example of a JSON payload for `event`
27+
28+
- `def github_token()`
29+
Get GitHub token from `GITHUB_TOKEN` env var if available, or from `github` context
30+
31+
- `def actions_output(name, value)`
32+
Print the special GitHub Actions `::set-output` line for `name::value`
33+
34+
- `def actions_debug(message)`
35+
Print the special `::debug` line for `message`
36+
37+
- `def actions_warn(message, details)`
38+
Print the special `::warning` line for `message`
39+
40+
- `def actions_error(message, details)`
41+
Print the special `::error` line for `message`
42+
43+
- `@contextmanager def actions_group(title)`
44+
Context manager to print the special `::group`/`::endgroup` lines for `title`
45+
46+
- `def actions_mask(value)`
47+
Print the special `::add-mask` line for `value`
48+
49+
- `def set_git_user(api)`
50+
Set git user name/email to authenticated user (if `api`) or GitHub Actions bot (otherwise)
51+
52+
## ghapi.auth
53+
54+
> Helpers for creating GitHub API tokens
55+
56+
- `def scope_str(*scopes)`
57+
Convert `scopes` into a comma-separated string
58+
59+
- `class GhDeviceAuth`
60+
Get an oauth token using the GitHub API device flow
61+
62+
- `def __init__(self, client_id, *scopes)`
63+
64+
- `@patch def url_docs(self)`
65+
Default instructions on how to authenticate
66+
67+
- `@patch def open_browser(self)`
68+
Open a web browser with the verification URL
69+
70+
- `@patch def auth(self)`
71+
Return token if authentication complete, or `None` otherwise
72+
73+
- `@patch def wait(self, cb, n_polls)`
74+
Wait up to `n_polls` times for authentication to complete, calling `cb` after each poll, if passed
75+
76+
- `def github_auth_device(wb, n_polls)`
77+
Authenticate with GitHub, polling up to `n_polls` times to wait for completion
78+
79+
## ghapi.build_lib
80+
81+
- `def build_funcs(nm, url, docurl)`
82+
Build module metadata.py from an Open API spec and optionally filter by a path `pre`
83+
84+
## ghapi.cli
85+
86+
> Access to the GitHub API from the command line
87+
88+
- `def ghapi()`
89+
Python backend for the `ghapi` command, which calls an endpoint by operation name
90+
91+
- `def ghpath()`
92+
Python backend for the `ghpath` command, which calls an endpoint by path
93+
94+
- `def ghraw()`
95+
Python backend for the `ghraw` command, which calls a fully-specified endpoint
96+
97+
- `def completion_ghapi()`
98+
Python backend for `completion-ghapi` command
99+
100+
## ghapi.core
101+
102+
> Detailed information on the GhApi API
103+
104+
- `def print_summary(req)`
105+
Print `Request.summary` with the token (if any) removed
106+
107+
- `class GhApi`
108+
- `def __init__(self, owner, repo, token, jwt_token, debug, limit_cb, gh_host, authenticate, **kwargs)`
109+
- `def __call__(self, path, verb, headers, route, query, data, timeout, decode)`
110+
Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`
111+
112+
- `def __dir__(self)`
113+
- `def __getattr__(self, k)`
114+
- `def __getitem__(self, k)`
115+
Lookup and call an endpoint by path and verb (which defaults to 'GET')
116+
117+
- `def full_docs(self)`
118+
119+
- `def date2gh(dt)`
120+
Convert `dt` (which is assumed to be in UTC time zone) to a format suitable for GitHub API operations
121+
122+
- `def gh2date(dtstr)`
123+
Convert date string `dtstr` received from a GitHub API operation to a UTC `datetime`
124+
125+
- `@patch def create_gist(self, description, content, filename, public)`
126+
Create a gist containing a single file
127+
128+
- `@patch def delete_release(self, release)`
129+
Delete a release and its associated tag
130+
131+
- `@patch def upload_file(self, rel, fn)`
132+
Upload `fn` to endpoint for release `rel`
133+
134+
- `@patch def create_release(self, tag_name, branch, name, body, draft, prerelease, files)`
135+
Wrapper for `GhApi.repos.create_release` which also uploads `files`
136+
137+
- `@patch def list_tags(self, prefix)`
138+
List all tags, optionally filtered to those starting with `prefix`
139+
140+
- `@patch def list_branches(self, prefix)`
141+
List all branches, optionally filtered to those starting with `prefix`
142+
143+
- `@patch def delete_tag(self, tag)`
144+
Delete a tag
145+
146+
- `@patch def delete_branch(self, branch)`
147+
Delete a branch
148+
149+
- `@patch def enable_pages(self, branch, path)`
150+
Enable or update pages for a repo to point to a `branch` and `path`.
151+
152+
## ghapi.event
153+
154+
> Helpers for getting GitHub API events
155+
156+
- `@patch @delegates(_list_events) def list_events(self, per_page, page, **kwargs)`
157+
Fetch public events for repo network, org, user, or all
158+
159+
- `@patch @delegates(_list_events) def list_events_parallel(self, per_page, n_pages, **kwargs)`
160+
Fetch as many events from `list_events` in parallel as available
161+
162+
- `class GhEvent`
163+
Class for events returned from `fetch_events
164+
165+
166+
- `@patch @delegates(_list_events) def fetch_events(self, n_pages, pause, per_page, types, incl_bot, **kwargs)`
167+
Generate an infinite stream of events, optionally filtered to `types, with `pause` seconds between requests
168+
169+
- `def load_sample_events()`
170+
Load sample events, downloading if needed
171+
172+
- `def save_sample_events(n)`
173+
Save the most recent `n` events as compressed JSON
174+
175+
- `@patch(as_prop=True) def full_type(self)`
176+
Concatenation of `type` and `payload.action` (if available)
177+
178+
- `@patch(as_prop=True) def description(self)`
179+
Description of event
180+
181+
- `@patch(as_prop=True) def emoji(self)`
182+
Emoji for event from `evt_emojis`
183+
184+
- `@patch(as_prop=True) def text(self)`
185+
Text (e.g. body or title) of event, if exists
186+
187+
## ghapi.page
188+
189+
> Parallel and serial pagination
190+
191+
- `def paged(oper, *args, **kwargs)`
192+
Convert operation `oper(*args,**kwargs)` into an iterator
193+
194+
- `def parse_link_hdr(header)`
195+
Parse an RFC 5988 link header, returning a `dict` from rels to a `tuple` of URL and attrs `dict`
196+
197+
- `@patch def last_page(self)`
198+
Parse RFC 5988 link header from most recent operation, and extract the last page
199+
200+
- `def pages(oper, n_pages, *args, **kwargs)`
201+
Get `n_pages` pages from `oper(*args,**kwargs)`
202+

llms.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ghapi
2+
> A complete Python interface to GitHub's REST API that is always 100% up to date.
3+
4+
`ghapi` provides 100% always-updated coverage of the entire GitHub API. This is done dynamically by converting the OpenAPI spec to a Pythonic API. Using `ghapi`, you can automate nearly anything that you can do through the GitHub web interface or through the `git` client, such as:
5+
6+
- Open, list, comment on, or modify [issues](https://docs.github.com/en/rest/issues) or [pull requests](https://docs.github.com/en/rest/pulls)
7+
- Create, list, or modify [git tags](https://docs.github.com/en/rest/git/tags) or [GitHub releases](https://docs.github.com/en/rest/releases), including uploading release assets
8+
- Configure and run GitHub [Actions](https://docs.github.com/en/rest/actions) and [webhooks](https://docs.github.com/en/rest/webhooks)
9+
- Set up GitHub [users](https://docs.github.com/en/rest/users) and [organizations](https://docs.github.com/en/rest/orgs)
10+
- Manage your [deployments](https://docs.github.com/en/rest/guides/delivering-deployments)
11+
- …and much, much more.
12+
13+
There is a one-to-one mapping between the GitHub REST API and the `ghapi` API, which you can find in the [FullAPI Reference](https://ghapi.fast.ai/fullapi.html.md).
14+
15+
## Tutorials
16+
17+
- [Blog Post](https://github.blog/developer-skills/programming-languages-and-frameworks/learn-about-ghapi-a-new-third-party-python-client-for-the-github-api/)
18+
- [GitHub Actions](https://ghapi.fast.ai/actions.html.md): Functionality for helping to create GitHub Actions workflows in Python
19+
- [GitHub API Tokens](https://ghapi.fast.ai/auth.html.md): Helpers for creating GitHub API tokens
20+
- [Pagination](https://ghapi.fast.ai/page.html.md): Helpers for paginating through GitHub API results
21+
- [Events](https://ghapi.fast.ai/event.html.md): Helpers for working with GitHub Events
22+
23+
## Examples
24+
25+
- [Home Page](https://ghapi.fast.ai/index.html.md): A list of examples of how to use `ghapi`.
26+
27+
## Optional
28+
29+
- [FullAPI Reference](https://ghapi.fast.ai/fullapi.html.md): A detailed reference of all methods in `ghapi`, with links to the corresponding GitHub API documentation.
30+
- [Additional API Reference](https://ghapi.fast.ai/apilist.txt): A list of methods in `ghapi` that do not correspond to any GitHub REST API paths, but are useful for automating GitHub.

settings.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ custom_sidebar = False
1717
license = apache2
1818
status = 5
1919
requirements = fastcore>=1.7.2
20-
dev_requirements = jsonref matplotlib
20+
dev_requirements = jsonref matplotlib nbclassic nbdev pysymbol_llm llms-txt
2121
console_scripts = ghapi=ghapi.cli:ghapi
2222
ghpath=ghapi.cli:ghpath
2323
ghraw=ghapi.cli:ghraw
@@ -38,7 +38,6 @@ allowed_metadata_keys =
3838
allowed_cell_metadata_keys =
3939
jupyter_hooks = True
4040
clean_ids = True
41-
custom_quarto_yml = False
4241
conda_user = fastai
4342
clear_all = False
4443
put_version_in_init = True

0 commit comments

Comments
 (0)