ghapi 2.1.4__tar.gz → 2.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {ghapi-2.1.4/ghapi.egg-info → ghapi-2.1.6}/PKG-INFO +6 -8
  2. ghapi-2.1.6/ghapi/__init__.py +8 -0
  3. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/_modidx.py +144 -133
  4. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/build_lib.py +3 -1
  5. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/core.py +38 -12
  6. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/gh_spec.py +1120 -306
  7. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/gql_spec.py +105 -52
  8. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/graphql.py +3 -1
  9. ghapi-2.1.6/ghapi/skill.py +80 -0
  10. {ghapi-2.1.4 → ghapi-2.1.6/ghapi.egg-info}/PKG-INFO +6 -8
  11. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi.egg-info/requires.txt +3 -7
  12. {ghapi-2.1.4 → ghapi-2.1.6}/pyproject.toml +9 -5
  13. ghapi-2.1.4/ghapi/__init__.py +0 -8
  14. ghapi-2.1.4/ghapi/skill.py +0 -80
  15. {ghapi-2.1.4 → ghapi-2.1.6}/CONTRIBUTING.md +0 -0
  16. {ghapi-2.1.4 → ghapi-2.1.6}/LICENSE +0 -0
  17. {ghapi-2.1.4 → ghapi-2.1.6}/MANIFEST.in +0 -0
  18. {ghapi-2.1.4 → ghapi-2.1.6}/README.md +0 -0
  19. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/actions.py +0 -0
  20. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/all.py +0 -0
  21. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/auth.py +0 -0
  22. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/cli.py +0 -0
  23. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/event.py +0 -0
  24. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/page.py +0 -0
  25. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/py.typed +0 -0
  26. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi/templates.py +0 -0
  27. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi.egg-info/SOURCES.txt +0 -0
  28. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi.egg-info/dependency_links.txt +0 -0
  29. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi.egg-info/entry_points.txt +0 -0
  30. {ghapi-2.1.4 → ghapi-2.1.6}/ghapi.egg-info/top_level.txt +0 -0
  31. {ghapi-2.1.4 → ghapi-2.1.6}/setup.cfg +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghapi
3
- Version: 2.1.4
3
+ Version: 2.1.6
4
4
  Summary: A python client for the GitHub API
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/fastai/ghapi
8
8
  Project-URL: Documentation, https://ghapi.fast.ai/
9
9
  Keywords: github,api
@@ -12,22 +12,20 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Requires-Python: >=3.10
15
+ Requires-Python: >=3.11
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: fastcore>=2.2.23
19
- Requires-Dist: fastspec>=0.2.5
19
+ Requires-Dist: fastspec>=0.2.12
20
20
  Requires-Dist: fasttransport>=0.0.2
21
- Requires-Dist: tomli; python_version < "3.11"
22
21
  Provides-Extra: dev
23
22
  Requires-Dist: fastgit; extra == "dev"
24
23
  Requires-Dist: matplotlib; extra == "dev"
25
24
  Requires-Dist: nbclassic; extra == "dev"
26
- Requires-Dist: nbdev; extra == "dev"
25
+ Requires-Dist: nbdev>=3.3.32; extra == "dev"
27
26
  Requires-Dist: pyyaml; extra == "dev"
28
- Requires-Dist: pysym2md>=0.0.6; extra == "dev"
29
- Requires-Dist: llms-txt>=0.0.6; extra == "dev"
30
27
  Requires-Dist: pyskills>=0.0.30; extra == "dev"
28
+ Requires-Dist: pycachy>=0.0.21; extra == "dev"
31
29
  Dynamic: license-file
32
30
 
33
31
  # ghapi
@@ -0,0 +1,8 @@
1
+ """A python client for the GitHub API
2
+
3
+ Modules:
4
+
5
+ - `ghapi.graphql`: Query GitHub's GraphQL API with schema-aware chaining, batched requests and raw GraphQL
6
+ - `ghapi.skill`: GitHub REST (`GhApi`) and GraphQL (`GhGql`), plus local git via `fastgit` (`Git`). Read before working with GitHub issues, PRs, CI, releases, branches, or gists, or any repo-local git operations."""
7
+
8
+ __version__ = "2.1.6"
@@ -1,180 +1,191 @@
1
1
  # Autogenerated by nbdev
2
2
 
3
- d = { 'settings': { 'branch': 'main',
4
- 'doc_baseurl': '/',
5
- 'doc_host': 'https://ghapi.fast.ai',
6
- 'git_url': 'https://github.com/fastai/ghapi',
7
- 'lib_path': 'ghapi'},
8
- 'syms': { 'ghapi.actions': { 'ghapi.actions._create_file': ('actions.html#_create_file', 'ghapi/actions.py'),
3
+ d = { 'syms': { 'ghapi.actions': { 'ghapi.actions.user_repo': ('actions.html#user_repo', 'ghapi/actions.py'),
4
+ 'ghapi.actions._create_file': ('actions.html#_create_file', 'ghapi/actions.py'),
9
5
  'ghapi.actions._replace': ('actions.html#_replace', 'ghapi/actions.py'),
10
- 'ghapi.actions.actions_debug': ('actions.html#actions_debug', 'ghapi/actions.py'),
11
- 'ghapi.actions.actions_error': ('actions.html#actions_error', 'ghapi/actions.py'),
12
- 'ghapi.actions.actions_group': ('actions.html#actions_group', 'ghapi/actions.py'),
13
- 'ghapi.actions.actions_mask': ('actions.html#actions_mask', 'ghapi/actions.py'),
14
- 'ghapi.actions.actions_output': ('actions.html#actions_output', 'ghapi/actions.py'),
15
- 'ghapi.actions.actions_warn': ('actions.html#actions_warn', 'ghapi/actions.py'),
16
- 'ghapi.actions.create_workflow': ('actions.html#create_workflow', 'ghapi/actions.py'),
17
6
  'ghapi.actions.create_workflow_files': ('actions.html#create_workflow_files', 'ghapi/actions.py'),
18
- 'ghapi.actions.env_contexts': ('actions.html#env_contexts', 'ghapi/actions.py'),
19
- 'ghapi.actions.example_payload': ('actions.html#example_payload', 'ghapi/actions.py'),
20
7
  'ghapi.actions.fill_workflow_templates': ('actions.html#fill_workflow_templates', 'ghapi/actions.py'),
8
+ 'ghapi.actions.env_contexts': ('actions.html#env_contexts', 'ghapi/actions.py'),
9
+ 'ghapi.actions.create_workflow': ('actions.html#create_workflow', 'ghapi/actions.py'),
21
10
  'ghapi.actions.gh_create_workflow': ('actions.html#gh_create_workflow', 'ghapi/actions.py'),
11
+ 'ghapi.actions.example_payload': ('actions.html#example_payload', 'ghapi/actions.py'),
22
12
  'ghapi.actions.github_token': ('actions.html#github_token', 'ghapi/actions.py'),
23
- 'ghapi.actions.set_git_user': ('actions.html#set_git_user', 'ghapi/actions.py'),
24
- 'ghapi.actions.user_repo': ('actions.html#user_repo', 'ghapi/actions.py')},
25
- 'ghapi.all': {},
26
- 'ghapi.auth': { 'ghapi.auth.GhDeviceAuth': ('auth.html#ghdeviceauth', 'ghapi/auth.py'),
13
+ 'ghapi.actions.actions_output': ('actions.html#actions_output', 'ghapi/actions.py'),
14
+ 'ghapi.actions.actions_debug': ('actions.html#actions_debug', 'ghapi/actions.py'),
15
+ 'ghapi.actions.actions_warn': ('actions.html#actions_warn', 'ghapi/actions.py'),
16
+ 'ghapi.actions.actions_error': ('actions.html#actions_error', 'ghapi/actions.py'),
17
+ 'ghapi.actions.actions_group': ('actions.html#actions_group', 'ghapi/actions.py'),
18
+ 'ghapi.actions.actions_mask': ('actions.html#actions_mask', 'ghapi/actions.py'),
19
+ 'ghapi.actions.set_git_user': ('actions.html#set_git_user', 'ghapi/actions.py')},
20
+ 'ghapi.auth': { 'ghapi.auth.scope_str': ('auth.html#scope_str', 'ghapi/auth.py'),
21
+ 'ghapi.auth.GhDeviceAuth': ('auth.html#ghdeviceauth', 'ghapi/auth.py'),
27
22
  'ghapi.auth.GhDeviceAuth.__init__': ('auth.html#ghdeviceauth.__init__', 'ghapi/auth.py'),
28
23
  'ghapi.auth.GhDeviceAuth._getattr': ('auth.html#ghdeviceauth._getattr', 'ghapi/auth.py'),
29
- 'ghapi.auth.GhDeviceAuth.auth': ('auth.html#ghdeviceauth.auth', 'ghapi/auth.py'),
30
- 'ghapi.auth.GhDeviceAuth.open_browser': ('auth.html#ghdeviceauth.open_browser', 'ghapi/auth.py'),
31
24
  'ghapi.auth.GhDeviceAuth.url_docs': ('auth.html#ghdeviceauth.url_docs', 'ghapi/auth.py'),
25
+ 'ghapi.auth.GhDeviceAuth.open_browser': ('auth.html#ghdeviceauth.open_browser', 'ghapi/auth.py'),
26
+ 'ghapi.auth.GhDeviceAuth.auth': ('auth.html#ghdeviceauth.auth', 'ghapi/auth.py'),
32
27
  'ghapi.auth.GhDeviceAuth.wait': ('auth.html#ghdeviceauth.wait', 'ghapi/auth.py'),
33
- 'ghapi.auth.github_auth_device': ('auth.html#github_auth_device', 'ghapi/auth.py'),
34
- 'ghapi.auth.scope_str': ('auth.html#scope_str', 'ghapi/auth.py')},
35
- 'ghapi.build_lib': { 'ghapi.build_lib.build_gql_spec': ('build_lib.html#build_gql_spec', 'ghapi/build_lib.py'),
36
- 'ghapi.build_lib.build_spec': ('build_lib.html#build_spec', 'ghapi/build_lib.py')},
37
- 'ghapi.cli': { 'ghapi.cli._api': ('cli.html#_api', 'ghapi/cli.py'),
28
+ 'ghapi.auth.github_auth_device': ('auth.html#github_auth_device', 'ghapi/auth.py')},
29
+ 'ghapi.build_lib': { 'ghapi.build_lib.build_spec': ('build_lib.html#build_spec', 'ghapi/build_lib.py'),
30
+ 'ghapi.build_lib.build_gql_spec': ('build_lib.html#build_gql_spec', 'ghapi/build_lib.py')},
31
+ 'ghapi.cli': { 'ghapi.cli._parse_args': ('cli.html#_parse_args', 'ghapi/cli.py'),
32
+ 'ghapi.cli._api': ('cli.html#_api', 'ghapi/cli.py'),
38
33
  'ghapi.cli._call_api': ('cli.html#_call_api', 'ghapi/cli.py'),
39
34
  'ghapi.cli._ghapi': ('cli.html#_ghapi', 'ghapi/cli.py'),
40
- 'ghapi.cli._ghpath': ('cli.html#_ghpath', 'ghapi/cli.py'),
41
- 'ghapi.cli._parse_args': ('cli.html#_parse_args', 'ghapi/cli.py'),
42
- 'ghapi.cli.completion_ghapi': ('cli.html#completion_ghapi', 'ghapi/cli.py'),
43
35
  'ghapi.cli.ghapi': ('cli.html#ghapi', 'ghapi/cli.py'),
36
+ 'ghapi.cli._ghpath': ('cli.html#_ghpath', 'ghapi/cli.py'),
44
37
  'ghapi.cli.ghpath': ('cli.html#ghpath', 'ghapi/cli.py'),
45
- 'ghapi.cli.ghraw': ('cli.html#ghraw', 'ghapi/cli.py')},
46
- 'ghapi.core': { 'ghapi.core.CheckRun': ('core.html#checkrun', 'ghapi/core.py'),
47
- 'ghapi.core.CheckRun.__repr__': ('core.html#checkrun.__repr__', 'ghapi/core.py'),
48
- 'ghapi.core.CommitStatus': ('core.html#commitstatus', 'ghapi/core.py'),
49
- 'ghapi.core.CommitStatus.__repr__': ('core.html#commitstatus.__repr__', 'ghapi/core.py'),
38
+ 'ghapi.cli.ghraw': ('cli.html#ghraw', 'ghapi/cli.py'),
39
+ 'ghapi.cli.completion_ghapi': ('cli.html#completion_ghapi', 'ghapi/cli.py')},
40
+ 'ghapi.core': { 'ghapi.core.print_summary': ('core.html#print_summary', 'ghapi/core.py'),
41
+ 'ghapi.core.GhTransport': ('core.html#ghtransport', 'ghapi/core.py'),
42
+ 'ghapi.core.GhSyncTransport': ('core.html#ghsynctransport', 'ghapi/core.py'),
43
+ 'ghapi.core.GhTransport.__init__': ('core.html#ghtransport.__init__', 'ghapi/core.py'),
44
+ 'ghapi.core.GhTransport._decode': ('core.html#ghtransport._decode', 'ghapi/core.py'),
45
+ 'ghapi.core.GhTransport._pre': ('core.html#ghtransport._pre', 'ghapi/core.py'),
46
+ 'ghapi.core.GhTransport._post': ('core.html#ghtransport._post', 'ghapi/core.py'),
47
+ 'ghapi.core.GhTransport.request': ('core.html#ghtransport.request', 'ghapi/core.py'),
48
+ 'ghapi.core.GhSyncTransport.request': ('core.html#ghsynctransport.request', 'ghapi/core.py'),
49
+ 'ghapi.core._LiveDefaults': ('core.html#_livedefaults', 'ghapi/core.py'),
50
+ 'ghapi.core.gh_patch': ('core.html#gh_patch', 'ghapi/core.py'),
51
+ 'ghapi.core._LiveDefaults.items': ('core.html#_livedefaults.items', 'ghapi/core.py'),
52
+ 'ghapi.core._LiveDefaults.__contains__': ('core.html#_livedefaults.__contains__', 'ghapi/core.py'),
53
+ 'ghapi.core._LiveDefaults.get': ('core.html#_livedefaults.get', 'ghapi/core.py'),
50
54
  'ghapi.core.GhApi': ('core.html#ghapi', 'ghapi/core.py'),
51
- 'ghapi.core.GhApi.__call__': ('core.html#ghapi.__call__', 'ghapi/core.py'),
52
- 'ghapi.core.GhApi.__getitem__': ('core.html#ghapi.__getitem__', 'ghapi/core.py'),
53
55
  'ghapi.core.GhApi.__init__': ('core.html#ghapi.__init__', 'ghapi/core.py'),
54
- 'ghapi.core.GhApi._get_repo_files': ('core.html#ghapi._get_repo_files', 'ghapi/core.py'),
55
- 'ghapi.core.GhApi._repr_markdown_': ('core.html#ghapi._repr_markdown_', 'ghapi/core.py'),
56
- 'ghapi.core.GhApi.create_gist': ('core.html#ghapi.create_gist', 'ghapi/core.py'),
57
56
  'ghapi.core.GhApi.debug': ('core.html#ghapi.debug', 'ghapi/core.py'),
58
- 'ghapi.core.GhApi.get_file_content': ('core.html#ghapi.get_file_content', 'ghapi/core.py'),
59
- 'ghapi.core.GhApi.get_repo_contents': ('core.html#ghapi.get_repo_contents', 'ghapi/core.py'),
60
- 'ghapi.core.GhApi.get_repo_files': ('core.html#ghapi.get_repo_files', 'ghapi/core.py'),
61
- 'ghapi.core.GhApi.gist_file': ('core.html#ghapi.gist_file', 'ghapi/core.py'),
62
57
  'ghapi.core.GhApi.limit_rem': ('core.html#ghapi.limit_rem', 'ghapi/core.py'),
63
- 'ghapi.core.GhApi.load_gist': ('core.html#ghapi.load_gist', 'ghapi/core.py'),
64
58
  'ghapi.core.GhApi.recv_hdrs': ('core.html#ghapi.recv_hdrs', 'ghapi/core.py'),
65
- 'ghapi.core.GhApi.update_gist': ('core.html#ghapi.update_gist', 'ghapi/core.py'),
66
- 'ghapi.core.GhApi.upload_file': ('core.html#ghapi.upload_file', 'ghapi/core.py'),
59
+ 'ghapi.core.GhApi._repr_markdown_': ('core.html#ghapi._repr_markdown_', 'ghapi/core.py'),
60
+ 'ghapi.core.GhApi.__call__': ('core.html#ghapi.__call__', 'ghapi/core.py'),
61
+ 'ghapi.core.GhApi.__getitem__': ('core.html#ghapi.__getitem__', 'ghapi/core.py'),
62
+ 'ghapi.core.call_gh': ('core.html#call_gh', 'ghapi/core.py'),
63
+ 'ghapi.core.date2gh': ('core.html#date2gh', 'ghapi/core.py'),
64
+ 'ghapi.core.gh2date': ('core.html#gh2date', 'ghapi/core.py'),
67
65
  'ghapi.core.GhRows': ('core.html#ghrows', 'ghapi/core.py'),
68
66
  'ghapi.core.GhRows.__repr__': ('core.html#ghrows.__repr__', 'ghapi/core.py'),
69
- 'ghapi.core.GhSyncTransport': ('core.html#ghsynctransport', 'ghapi/core.py'),
70
- 'ghapi.core.GhSyncTransport.request': ('core.html#ghsynctransport.request', 'ghapi/core.py'),
71
- 'ghapi.core.GhTransport': ('core.html#ghtransport', 'ghapi/core.py'),
72
- 'ghapi.core.GhTransport.__init__': ('core.html#ghtransport.__init__', 'ghapi/core.py'),
73
- 'ghapi.core.GhTransport._decode': ('core.html#ghtransport._decode', 'ghapi/core.py'),
74
- 'ghapi.core.GhTransport._post': ('core.html#ghtransport._post', 'ghapi/core.py'),
75
- 'ghapi.core.GhTransport._pre': ('core.html#ghtransport._pre', 'ghapi/core.py'),
76
- 'ghapi.core.GhTransport.request': ('core.html#ghtransport.request', 'ghapi/core.py'),
67
+ 'ghapi.core._run_subp': ('core.html#_run_subp', 'ghapi/core.py'),
68
+ 'ghapi.core.GhApi.create_gist': ('core.html#ghapi.create_gist', 'ghapi/core.py'),
69
+ 'ghapi.core.GhApi.load_gist': ('core.html#ghapi.load_gist', 'ghapi/core.py'),
70
+ 'ghapi.core.GhApi.gist_file': ('core.html#ghapi.gist_file', 'ghapi/core.py'),
71
+ 'ghapi.core.GhApi.update_gist': ('core.html#ghapi.update_gist', 'ghapi/core.py'),
72
+ 'ghapi.core.GhApi.upload_file': ('core.html#ghapi.upload_file', 'ghapi/core.py'),
73
+ 'ghapi.core.create_release': ('core.html#create_release', 'ghapi/core.py'),
74
+ 'ghapi.core.delete_release': ('core.html#delete_release', 'ghapi/core.py'),
75
+ 'ghapi.core.list_tags': ('core.html#list_tags', 'ghapi/core.py'),
76
+ 'ghapi.core.list_branches': ('core.html#list_branches', 'ghapi/core.py'),
77
+ 'ghapi.core.create_branch_empty': ('core.html#create_branch_empty', 'ghapi/core.py'),
78
+ 'ghapi.core.delete_tag': ('core.html#delete_tag', 'ghapi/core.py'),
79
+ 'ghapi.core.delete_branch': ('core.html#delete_branch', 'ghapi/core.py'),
80
+ 'ghapi.core.get_branch': ('core.html#get_branch', 'ghapi/core.py'),
81
+ 'ghapi.core.commit_tree': ('core.html#commit_tree', 'ghapi/core.py'),
82
+ 'ghapi.core.list_files': ('core.html#list_files', 'ghapi/core.py'),
83
+ 'ghapi.core.get_content': ('core.html#get_content', 'ghapi/core.py'),
84
+ 'ghapi.core.create_or_update_file': ('core.html#create_or_update_file', 'ghapi/core.py'),
85
+ 'ghapi.core.create_file': ('core.html#create_file', 'ghapi/core.py'),
86
+ 'ghapi.core.delete_file': ('core.html#delete_file', 'ghapi/core.py'),
87
+ 'ghapi.core.update_contents': ('core.html#update_contents', 'ghapi/core.py'),
88
+ 'ghapi.core._include': ('core.html#_include', 'ghapi/core.py'),
89
+ 'ghapi.core.GhApi._get_repo_files': ('core.html#ghapi._get_repo_files', 'ghapi/core.py'),
90
+ 'ghapi.core.GhApi.get_repo_files': ('core.html#ghapi.get_repo_files', 'ghapi/core.py'),
91
+ 'ghapi.core.GhApi.get_file_content': ('core.html#ghapi.get_file_content', 'ghapi/core.py'),
92
+ 'ghapi.core.GhApi.get_repo_contents': ('core.html#ghapi.get_repo_contents', 'ghapi/core.py'),
93
+ 'ghapi.core.enable_pages': ('core.html#enable_pages', 'ghapi/core.py'),
94
+ 'ghapi.core._IssueInfo': ('core.html#_issueinfo', 'ghapi/core.py'),
95
+ 'ghapi.core.read_issue': ('core.html#read_issue', 'ghapi/core.py'),
96
+ 'ghapi.core._IssueInfo._repr_markdown_': ('core.html#_issueinfo._repr_markdown_', 'ghapi/core.py'),
97
+ 'ghapi.core._filter_diff': ('core.html#_filter_diff', 'ghapi/core.py'),
98
+ 'ghapi.core._reduce_ctx': ('core.html#_reduce_ctx', 'ghapi/core.py'),
99
+ 'ghapi.core._fmt_replies': ('core.html#_fmt_replies', 'ghapi/core.py'),
100
+ 'ghapi.core.read_pr': ('core.html#read_pr', 'ghapi/core.py'),
101
+ 'ghapi.core.pr_file_diff': ('core.html#pr_file_diff', 'ghapi/core.py'),
102
+ 'ghapi.core._age': ('core.html#_age', 'ghapi/core.py'),
103
+ 'ghapi.core._pr_mark': ('core.html#_pr_mark', 'ghapi/core.py'),
77
104
  'ghapi.core.PullRow': ('core.html#pullrow', 'ghapi/core.py'),
78
105
  'ghapi.core.PullRow.line': ('core.html#pullrow.line', 'ghapi/core.py'),
79
106
  'ghapi.core.PullRows': ('core.html#pullrows', 'ghapi/core.py'),
107
+ 'ghapi.core.list_prs': ('core.html#list_prs', 'ghapi/core.py'),
80
108
  'ghapi.core.PullRows.__init__': ('core.html#pullrows.__init__', 'ghapi/core.py'),
81
109
  'ghapi.core.PullRows.__repr__': ('core.html#pullrows.__repr__', 'ghapi/core.py'),
82
- 'ghapi.core._CheckStatus': ('core.html#_checkstatus', 'ghapi/core.py'),
83
- 'ghapi.core._CheckStatus._repr_markdown_': ('core.html#_checkstatus._repr_markdown_', 'ghapi/core.py'),
84
- 'ghapi.core._IssueInfo': ('core.html#_issueinfo', 'ghapi/core.py'),
85
- 'ghapi.core._IssueInfo._repr_markdown_': ('core.html#_issueinfo._repr_markdown_', 'ghapi/core.py'),
86
- 'ghapi.core._LiveDefaults': ('core.html#_livedefaults', 'ghapi/core.py'),
87
- 'ghapi.core._LiveDefaults.__contains__': ('core.html#_livedefaults.__contains__', 'ghapi/core.py'),
88
- 'ghapi.core._LiveDefaults.get': ('core.html#_livedefaults.get', 'ghapi/core.py'),
89
- 'ghapi.core._LiveDefaults.items': ('core.html#_livedefaults.items', 'ghapi/core.py'),
90
- 'ghapi.core._age': ('core.html#_age', 'ghapi/core.py'),
91
- 'ghapi.core._dur': ('core.html#_dur', 'ghapi/core.py'),
92
- 'ghapi.core._filter_diff': ('core.html#_filter_diff', 'ghapi/core.py'),
93
- 'ghapi.core._fmt_replies': ('core.html#_fmt_replies', 'ghapi/core.py'),
94
- 'ghapi.core._include': ('core.html#_include', 'ghapi/core.py'),
95
- 'ghapi.core._listed': ('core.html#_listed', 'ghapi/core.py'),
96
- 'ghapi.core._load_tmpl': ('core.html#_load_tmpl', 'ghapi/core.py'),
97
110
  'ghapi.core._parse_section': ('core.html#_parse_section', 'ghapi/core.py'),
98
111
  'ghapi.core._parse_tmpl': ('core.html#_parse_tmpl', 'ghapi/core.py'),
99
- 'ghapi.core._pr_mark': ('core.html#_pr_mark', 'ghapi/core.py'),
100
- 'ghapi.core._reduce_ctx': ('core.html#_reduce_ctx', 'ghapi/core.py'),
101
- 'ghapi.core._run_subp': ('core.html#_run_subp', 'ghapi/core.py'),
102
- 'ghapi.core._transdeps': ('core.html#_transdeps', 'ghapi/core.py'),
103
- 'ghapi.core.call_gh': ('core.html#call_gh', 'ghapi/core.py'),
112
+ 'ghapi.core._load_tmpl': ('core.html#_load_tmpl', 'ghapi/core.py'),
113
+ 'ghapi.core.issue_template': ('core.html#issue_template', 'ghapi/core.py'),
114
+ 'ghapi.core.issue_body': ('core.html#issue_body', 'ghapi/core.py'),
115
+ 'ghapi.core._dur': ('core.html#_dur', 'ghapi/core.py'),
116
+ 'ghapi.core.CheckRun': ('core.html#checkrun', 'ghapi/core.py'),
117
+ 'ghapi.core.CommitStatus': ('core.html#commitstatus', 'ghapi/core.py'),
118
+ 'ghapi.core.CheckRun.__repr__': ('core.html#checkrun.__repr__', 'ghapi/core.py'),
119
+ 'ghapi.core.CommitStatus.__repr__': ('core.html#commitstatus.__repr__', 'ghapi/core.py'),
120
+ 'ghapi.core._CheckStatus': ('core.html#_checkstatus', 'ghapi/core.py'),
104
121
  'ghapi.core.check_status': ('core.html#check_status', 'ghapi/core.py'),
105
- 'ghapi.core.commit_tree': ('core.html#commit_tree', 'ghapi/core.py'),
106
- 'ghapi.core.create_branch_empty': ('core.html#create_branch_empty', 'ghapi/core.py'),
107
- 'ghapi.core.create_file': ('core.html#create_file', 'ghapi/core.py'),
108
- 'ghapi.core.create_or_update_file': ('core.html#create_or_update_file', 'ghapi/core.py'),
109
- 'ghapi.core.create_release': ('core.html#create_release', 'ghapi/core.py'),
110
- 'ghapi.core.date2gh': ('core.html#date2gh', 'ghapi/core.py'),
111
- 'ghapi.core.delete_branch': ('core.html#delete_branch', 'ghapi/core.py'),
112
- 'ghapi.core.delete_file': ('core.html#delete_file', 'ghapi/core.py'),
113
- 'ghapi.core.delete_release': ('core.html#delete_release', 'ghapi/core.py'),
114
- 'ghapi.core.delete_tag': ('core.html#delete_tag', 'ghapi/core.py'),
115
- 'ghapi.core.dep_closure': ('core.html#dep_closure', 'ghapi/core.py'),
116
- 'ghapi.core.dep_dependents': ('core.html#dep_dependents', 'ghapi/core.py'),
117
- 'ghapi.core.dep_graph': ('core.html#dep_graph', 'ghapi/core.py'),
118
- 'ghapi.core.dep_key': ('core.html#dep_key', 'ghapi/core.py'),
119
- 'ghapi.core.dep_order': ('core.html#dep_order', 'ghapi/core.py'),
120
- 'ghapi.core.enable_pages': ('core.html#enable_pages', 'ghapi/core.py'),
122
+ 'ghapi.core.pr_status': ('core.html#pr_status', 'ghapi/core.py'),
123
+ 'ghapi.core._CheckStatus._repr_markdown_': ('core.html#_checkstatus._repr_markdown_', 'ghapi/core.py'),
124
+ 'ghapi.core._step_lines': ('core.html#_step_lines', 'ghapi/core.py'),
125
+ 'ghapi.core._fold_groups': ('core.html#_fold_groups', 'ghapi/core.py'),
121
126
  'ghapi.core.failed_step_log': ('core.html#failed_step_log', 'ghapi/core.py'),
122
- 'ghapi.core.get_branch': ('core.html#get_branch', 'ghapi/core.py'),
123
- 'ghapi.core.get_content': ('core.html#get_content', 'ghapi/core.py'),
124
- 'ghapi.core.gh2date': ('core.html#gh2date', 'ghapi/core.py'),
125
- 'ghapi.core.gh_patch': ('core.html#gh_patch', 'ghapi/core.py'),
126
- 'ghapi.core.issue_body': ('core.html#issue_body', 'ghapi/core.py'),
127
- 'ghapi.core.issue_template': ('core.html#issue_template', 'ghapi/core.py'),
128
- 'ghapi.core.list_branches': ('core.html#list_branches', 'ghapi/core.py'),
129
- 'ghapi.core.list_files': ('core.html#list_files', 'ghapi/core.py'),
130
- 'ghapi.core.list_prs': ('core.html#list_prs', 'ghapi/core.py'),
131
- 'ghapi.core.list_tags': ('core.html#list_tags', 'ghapi/core.py'),
127
+ 'ghapi.core.dep_key': ('core.html#dep_key', 'ghapi/core.py'),
132
128
  'ghapi.core.local_dep_graph': ('core.html#local_dep_graph', 'ghapi/core.py'),
133
- 'ghapi.core.pr_file_diff': ('core.html#pr_file_diff', 'ghapi/core.py'),
134
- 'ghapi.core.pr_status': ('core.html#pr_status', 'ghapi/core.py'),
135
- 'ghapi.core.print_summary': ('core.html#print_summary', 'ghapi/core.py'),
136
- 'ghapi.core.read_issue': ('core.html#read_issue', 'ghapi/core.py'),
137
- 'ghapi.core.read_pr': ('core.html#read_pr', 'ghapi/core.py'),
138
- 'ghapi.core.update_contents': ('core.html#update_contents', 'ghapi/core.py')},
139
- 'ghapi.event': { 'ghapi.event.GhApi.fetch_events': ('event.html#ghapi.fetch_events', 'ghapi/event.py'),
129
+ 'ghapi.core.dep_closure': ('core.html#dep_closure', 'ghapi/core.py'),
130
+ 'ghapi.core._transdeps': ('core.html#_transdeps', 'ghapi/core.py'),
131
+ 'ghapi.core._listed': ('core.html#_listed', 'ghapi/core.py'),
132
+ 'ghapi.core.dep_order': ('core.html#dep_order', 'ghapi/core.py'),
133
+ 'ghapi.core.dep_dependents': ('core.html#dep_dependents', 'ghapi/core.py'),
134
+ 'ghapi.core.dep_graph': ('core.html#dep_graph', 'ghapi/core.py')},
135
+ 'ghapi.event': { 'ghapi.event._list_events': ('event.html#_list_events', 'ghapi/event.py'),
136
+ 'ghapi.event._id2int': ('event.html#_id2int', 'ghapi/event.py'),
140
137
  'ghapi.event.GhApi.list_events': ('event.html#ghapi.list_events', 'ghapi/event.py'),
141
138
  'ghapi.event.GhApi.list_events_parallel': ('event.html#ghapi.list_events_parallel', 'ghapi/event.py'),
139
+ 'ghapi.event._want_evt': ('event.html#_want_evt', 'ghapi/event.py'),
142
140
  'ghapi.event.GhEvent': ('event.html#ghevent', 'ghapi/event.py'),
143
- 'ghapi.event.GhEvent.description': ('event.html#ghevent.description', 'ghapi/event.py'),
144
- 'ghapi.event.GhEvent.emoji': ('event.html#ghevent.emoji', 'ghapi/event.py'),
145
- 'ghapi.event.GhEvent.full_type': ('event.html#ghevent.full_type', 'ghapi/event.py'),
146
- 'ghapi.event.GhEvent.text': ('event.html#ghevent.text', 'ghapi/event.py'),
147
- 'ghapi.event._action': ('event.html#_action', 'ghapi/event.py'),
148
141
  'ghapi.event._cast_evt': ('event.html#_cast_evt', 'ghapi/event.py'),
149
- 'ghapi.event._id2int': ('event.html#_id2int', 'ghapi/event.py'),
150
- 'ghapi.event._list_events': ('event.html#_list_events', 'ghapi/event.py'),
142
+ 'ghapi.event.GhApi.fetch_events': ('event.html#ghapi.fetch_events', 'ghapi/event.py'),
143
+ 'ghapi.event.load_sample_events': ('event.html#load_sample_events', 'ghapi/event.py'),
144
+ 'ghapi.event.save_sample_events': ('event.html#save_sample_events', 'ghapi/event.py'),
145
+ 'ghapi.event.GhEvent.full_type': ('event.html#ghevent.full_type', 'ghapi/event.py'),
151
146
  'ghapi.event._ref': ('event.html#_ref', 'ghapi/event.py'),
152
147
  'ghapi.event._ref_detl': ('event.html#_ref_detl', 'ghapi/event.py'),
153
- 'ghapi.event._want_evt': ('event.html#_want_evt', 'ghapi/event.py'),
154
- 'ghapi.event.load_sample_events': ('event.html#load_sample_events', 'ghapi/event.py'),
155
- 'ghapi.event.save_sample_events': ('event.html#save_sample_events', 'ghapi/event.py')},
156
- 'ghapi.gh_spec': {},
157
- 'ghapi.gql_spec': {},
148
+ 'ghapi.event._action': ('event.html#_action', 'ghapi/event.py'),
149
+ 'ghapi.event.GhEvent.description': ('event.html#ghevent.description', 'ghapi/event.py'),
150
+ 'ghapi.event.GhEvent.emoji': ('event.html#ghevent.emoji', 'ghapi/event.py'),
151
+ 'ghapi.event.GhEvent.text': ('event.html#ghevent.text', 'ghapi/event.py')},
158
152
  'ghapi.graphql': { 'ghapi.graphql.GhGql': ('graphql.html#ghgql', 'ghapi/graphql.py'),
159
153
  'ghapi.graphql.GhGql.__init__': ('graphql.html#ghgql.__init__', 'ghapi/graphql.py'),
160
154
  'ghapi.graphql.GhGql.repo': ('graphql.html#ghgql.repo', 'ghapi/graphql.py')},
161
- 'ghapi.page': { 'ghapi.page.GhApi.last_page': ('page.html#ghapi.last_page', 'ghapi/page.py'),
162
- 'ghapi.page.GhApi.mark_done': ('page.html#ghapi.mark_done', 'ghapi/page.py'),
163
- 'ghapi.page.NotifRow': ('page.html#notifrow', 'ghapi/page.py'),
164
- 'ghapi.page.NotifRow.__repr__': ('page.html#notifrow.__repr__', 'ghapi/page.py'),
165
- 'ghapi.page.NotifRows': ('page.html#notifrows', 'ghapi/page.py'),
166
- 'ghapi.page.NotifRows.__repr__': ('page.html#notifrows.__repr__', 'ghapi/page.py'),
155
+ 'ghapi.page': { 'ghapi.page.paged': ('page.html#paged', 'ghapi/page.py'),
167
156
  'ghapi.page._Scanner': ('page.html#_scanner', 'ghapi/page.py'),
168
- 'ghapi.page._Scanner.__getitem__': ('page.html#_scanner.__getitem__', 'ghapi/page.py'),
169
157
  'ghapi.page._Scanner.__init__': ('page.html#_scanner.__init__', 'ghapi/page.py'),
158
+ 'ghapi.page._Scanner.__getitem__': ('page.html#_scanner.__getitem__', 'ghapi/page.py'),
170
159
  'ghapi.page._Scanner.scan': ('page.html#_scanner.scan', 'ghapi/page.py'),
171
- 'ghapi.page._notif_mark': ('page.html#_notif_mark', 'ghapi/page.py'),
172
160
  'ghapi.page._parse_link_hdr': ('page.html#_parse_link_hdr', 'ghapi/page.py'),
173
- 'ghapi.page.gh_notifs': ('page.html#gh_notifs', 'ghapi/page.py'),
174
- 'ghapi.page.paged': ('page.html#paged', 'ghapi/page.py'),
175
- 'ghapi.page.pages': ('page.html#pages', 'ghapi/page.py'),
176
161
  'ghapi.page.parse_link_hdr': ('page.html#parse_link_hdr', 'ghapi/page.py'),
162
+ 'ghapi.page.GhApi.last_page': ('page.html#ghapi.last_page', 'ghapi/page.py'),
163
+ 'ghapi.page.pages': ('page.html#pages', 'ghapi/page.py'),
177
164
  'ghapi.page.sync_paged': ('page.html#sync_paged', 'ghapi/page.py'),
178
- 'ghapi.page.sync_pages': ('page.html#sync_pages', 'ghapi/page.py')},
179
- 'ghapi.skill': {},
180
- 'ghapi.templates': {}}}
165
+ 'ghapi.page.sync_pages': ('page.html#sync_pages', 'ghapi/page.py'),
166
+ 'ghapi.page.NotifRow': ('page.html#notifrow', 'ghapi/page.py'),
167
+ 'ghapi.page.NotifRows': ('page.html#notifrows', 'ghapi/page.py'),
168
+ 'ghapi.page._notif_mark': ('page.html#_notif_mark', 'ghapi/page.py'),
169
+ 'ghapi.page.gh_notifs': ('page.html#gh_notifs', 'ghapi/page.py'),
170
+ 'ghapi.page.NotifRow.__repr__': ('page.html#notifrow.__repr__', 'ghapi/page.py'),
171
+ 'ghapi.page.NotifRows.__repr__': ('page.html#notifrows.__repr__', 'ghapi/page.py'),
172
+ 'ghapi.page.GhApi.mark_done': ('page.html#ghapi.mark_done', 'ghapi/page.py')}},
173
+ 'settings': { 'branch': 'main',
174
+ 'git_url': 'https://github.com/fastai/ghapi',
175
+ 'doc_host': 'https://ghapi.fast.ai',
176
+ 'doc_baseurl': '/',
177
+ 'lib_path': 'ghapi'}}
178
+
179
+ docs = { 'Docs': [ 'ghapi.core',
180
+ 'ghapi.actions',
181
+ 'ghapi.auth',
182
+ 'ghapi.page',
183
+ 'ghapi.event',
184
+ 'ghapi.graphql',
185
+ 'ghapi.cli',
186
+ ('Full GitHub API reference', 'fullapi.html.md', 'All operations available through the GitHub API'),
187
+ 'ghapi.build_lib',
188
+ ( 'Blog Post',
189
+ 'https://github.blog/developer-skills/programming-languages-and-frameworks/learn-about-ghapi-a-new-third-party-python-client-for-the-github-api/',
190
+ 'Official GitHub blog announcement')],
191
+ 'Tutorials': [('Getting started with GitHub Actions', 'tutorials/tutorial_actions.html.md', '')]}
@@ -1,4 +1,6 @@
1
- """Docs: https://ghapi.fast.ai/build_lib.html.md"""
1
+ """Regenerate bundled GitHub REST and GraphQL specs from OpenAPI and introspection
2
+
3
+ Docs: https://ghapi.fast.ai/build_lib.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/90_build_lib.ipynb.
4
6
 
@@ -32,8 +32,7 @@ from datetime import datetime, timezone
32
32
  import os, shutil, tempfile, subprocess, fnmatch, html, io, zipfile
33
33
  import asyncio
34
34
 
35
- try: import tomllib
36
- except ModuleNotFoundError: import tomli as tomllib
35
+ import tomllib
37
36
 
38
37
  # %% ../nbs/00_core.ipynb #ed04302a
39
38
  _all_ = ['APIError']
@@ -145,7 +144,8 @@ class GhApi(OpenAPIClient):
145
144
  self.token,self.gh_host = token,gh_host or GH_HOST
146
145
  tcls,fcls = (GhSyncTransport,SyncOpFunc) if sync else (GhTransport,OpFunc)
147
146
  self.transport = tcls(debug=debug, limit_cb=limit_cb, timeout=timeout, base_headers=self.headers)
148
- self.ops = [fcls(o, self.transport, self.gh_host, defaults=_LiveDefaults(kwargs)) for o in pspec.ops]
147
+ defs = _LiveDefaults(kwargs)
148
+ self.ops = [fcls(o, self.transport, self.gh_host, defaults=defs) for o in pspec.ops]
149
149
  self.func_dict = {f'{o.path}:{o.verb.upper()}':o for o in self.ops}
150
150
  self.groups = mk_groups(self.ops)
151
151
  for k,v in self.groups.items(): setattr(self, k, v)
@@ -232,9 +232,7 @@ async def create_gist(self:GhApi, description, content, filename='gist.txt', pub
232
232
  @patch
233
233
  def load_gist(self:GhApi, gist_id:str):
234
234
  "Retrieve a gist by id, or by `user/id` (as it appears in gist URLs); coro if async client"
235
- if '/' in gist_id: *_,user,gist_id = gist_id.split('/')
236
- else: user = None
237
- return self.gists.get(gist_id, user=user)
235
+ return self.gists.get(gist_id.split('/')[-1])
238
236
 
239
237
  @patch
240
238
  def gist_file(self:GhApi, gist_id:str):
@@ -420,9 +418,10 @@ async def enable_pages(self:GhApi, branch=None, path="/"):
420
418
  r = await self.repos.get()
421
419
  branch = branch or r.default_branch
422
420
  source = {"branch": branch, "path": path}
423
- if r.has_pages: return # await self.repos.update_information_about_pages_site(source=source)
424
421
  if len(await self.list_branches(branch))==0: await self.create_branch_empty(branch)
425
- return await self.repos.create_pages_site(source=source)
422
+ if not r.has_pages: return await self.repos.create_pages_site(source=source)
423
+ await self.repos.update_information_about_pages_site(source=source)
424
+ return await self.repos.get_pages()
426
425
 
427
426
  # %% ../nbs/00_core.ipynb #519ec71c
428
427
  class _IssueInfo(AttrDict):
@@ -647,20 +646,47 @@ async def pr_status(self:GhApi, pull_number:int):
647
646
  "Combined status and check-run results for a PR's head commit"
648
647
  return await self.check_status((await self.pulls.get(pull_number)).head.sha)
649
648
 
649
+ # %% ../nbs/00_core.ipynb #40f5c88a
650
+ def _step_lines(zf, job, s):
651
+ "Timestamped log lines for step `s` of `job`. They come from the step's own archive file, or else from the job's combined log, cut to the step's time window and its last `##[error]` line."
652
+ names = zf.namelist()
653
+ if name := first(n for n in names if n.startswith(f'{job.name}/{s.number}_')): return zf.read(name).decode().splitlines()
654
+ name = first(n for n in names if re.fullmatch(rf'\d+_{re.escape(job.name)}\.txt', n))
655
+ lines = [l for l in zf.read(name).decode('utf-8-sig').splitlines() if s.started_at[:19] <= l[:19] <= s.completed_at[:19]]
656
+ last = max((i for i,l in enumerate(lines) if l.split(' ', 1)[-1].startswith('##[error]')), default=len(lines)-1)
657
+ return lines[:last+1]
658
+
659
+ # %% ../nbs/00_core.ipynb #fd5e2942
660
+ def _fold_groups(lines, n=20):
661
+ "Fold each finished `##[group]` of more than `n` lines, unless it holds an error or warning. An unfinished group stays whole, since the step died inside it."
662
+ res, start = [], None
663
+ for l in lines:
664
+ res.append(l)
665
+ if l.startswith('##[group]'): start = len(res)
666
+ elif l.startswith('##[endgroup]') and start is not None:
667
+ body = res[start:-1]
668
+ if len(body) > n and not any(o.startswith(('##[error]', '##[warning]')) for o in body): res[start:-1] = [f'… {len(body)} lines folded']
669
+ start = None
670
+ return res
671
+
650
672
  # %% ../nbs/00_core.ipynb #569864f5
651
673
  @gh_patch
652
- async def failed_step_log(self:GhApi, job_id:int):
674
+ async def failed_step_log(
675
+ self:GhApi,
676
+ job_id:int, # Workflow job id, which is also its check run id
677
+ fold:bool=True, # Fold long finished `##[group]` blocks that hold no error or warning?
678
+ ):
653
679
  """Return the failed steps' log sections, each headed by its step name.
654
680
 
655
- An Actions check run's id is its job id. Pass that id from `check_status` or `pr_status`. The returned text's display is truncated at 8,000 characters. GitHub can expire or delete stored logs.
681
+ An Actions check run's id is its job id. Pass that id from `check_status` or `pr_status`. The returned text's display is truncated at 8,000 characters. Long finished `##[group]` blocks with no error or warning are folded to a line count. GitHub can expire or delete stored logs.
656
682
  """
657
683
  job = await self.actions.get_job_for_workflow_run(job_id=job_id)
658
684
  zf = zipfile.ZipFile(io.BytesIO(await self.actions.download_workflow_run_logs(run_id=job.run_id)))
659
685
  res = []
660
686
  for s in job.steps:
661
687
  if s.conclusion!='failure': continue
662
- name = first(n for n in zf.namelist() if n.startswith(f'{job.name}/{s.number}_'))
663
- lines = [strip_ansi(l.split(' ', 1)[-1]) for l in zf.read(name).decode().splitlines()]
688
+ lines = [strip_ansi(l.split(' ', 1)[-1]) for l in _step_lines(zf, job, s)]
689
+ if fold: lines = _fold_groups(lines)
664
690
  res.append(f'# {s.name}\n' + '\n'.join(lines))
665
691
  return TruncatedString('\n\n'.join(res), 8_000)
666
692