ghapi 2.1.1__tar.gz → 2.1.2__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 (29) hide show
  1. {ghapi-2.1.1/ghapi.egg-info → ghapi-2.1.2}/PKG-INFO +3 -3
  2. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/__init__.py +1 -1
  3. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/core.py +18 -15
  4. {ghapi-2.1.1 → ghapi-2.1.2/ghapi.egg-info}/PKG-INFO +3 -3
  5. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi.egg-info/requires.txt +2 -2
  6. {ghapi-2.1.1 → ghapi-2.1.2}/pyproject.toml +1 -1
  7. {ghapi-2.1.1 → ghapi-2.1.2}/CONTRIBUTING.md +0 -0
  8. {ghapi-2.1.1 → ghapi-2.1.2}/LICENSE +0 -0
  9. {ghapi-2.1.1 → ghapi-2.1.2}/MANIFEST.in +0 -0
  10. {ghapi-2.1.1 → ghapi-2.1.2}/README.md +0 -0
  11. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/_modidx.py +0 -0
  12. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/actions.py +0 -0
  13. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/all.py +0 -0
  14. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/auth.py +0 -0
  15. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/build_lib.py +0 -0
  16. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/cli.py +0 -0
  17. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/event.py +0 -0
  18. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/gh_spec.py +0 -0
  19. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/gql_spec.py +0 -0
  20. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/graphql.py +0 -0
  21. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/page.py +0 -0
  22. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/py.typed +0 -0
  23. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/skill.py +0 -0
  24. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi/templates.py +0 -0
  25. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi.egg-info/SOURCES.txt +0 -0
  26. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi.egg-info/dependency_links.txt +0 -0
  27. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi.egg-info/entry_points.txt +0 -0
  28. {ghapi-2.1.1 → ghapi-2.1.2}/ghapi.egg-info/top_level.txt +0 -0
  29. {ghapi-2.1.1 → ghapi-2.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghapi
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A python client for the GitHub API
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
6
  License: Apache-2.0
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=2.2.6
19
- Requires-Dist: fastspec>=0.2.0
18
+ Requires-Dist: fastcore>=2.2.7
19
+ Requires-Dist: fastspec>=0.2.1
20
20
  Requires-Dist: tomli; python_version < "3.11"
21
21
  Provides-Extra: dev
22
22
  Requires-Dist: fastgit; extra == "dev"
@@ -5,4 +5,4 @@ Modules:
5
5
  - `ghapi.graphql`: Query GitHub's GraphQL API: schema-aware chained queries, one-request batching, and raw GraphQL
6
6
  - `ghapi.skill`: GitHub REST API access via `GhApi`, plus local git operations via `fastgit.Git`. Use this for day-to-day GitHub work: reading/creating issues and PRs, checking CI status, managing releases/branches/gists, and repo-local git operations -- all from Python, no shelling out to `gh`/`git` needed."""
7
7
 
8
- __version__ = "2.1.1"
8
+ __version__ = "2.1.2"
@@ -5,13 +5,14 @@ Docs: https://ghapi.fast.ai/core.html.md"""
5
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
6
6
 
7
7
  # %% auto #0
8
- __all__ = ['GH_HOST', 'pspec', 'img_md_pat', 'EMPTY_TREE_SHA', 'GhTransport', 'GhSyncTransport', 'print_summary', 'gh_patch',
9
- 'GhApi', 'call_gh', 'date2gh', 'gh2date', 'GhRows', 'delete_release', 'create_release', 'list_tags',
10
- 'list_branches', 'create_branch_empty', 'delete_tag', 'delete_branch', 'get_branch', 'commit_tree',
11
- 'list_files', 'get_content', 'create_or_update_file', 'create_file', 'delete_file', 'update_contents',
12
- 'enable_pages', 'read_issue', 'read_pr', 'pr_file_diff', 'PullRow', 'PullRows', 'list_prs', 'issue_template',
13
- 'issue_body', 'CheckRun', 'CommitStatus', 'check_status', 'pr_status', 'failed_step_log', 'dep_key',
14
- 'local_dep_graph', 'dep_closure', 'dep_order', 'dep_dependents', 'dep_graph', 'APIError']
8
+ __all__ = ['GH_HOST', 'pspec', 'img_md_pat', 'EMPTY_TREE_SHA', 'MAXLEN', 'GhTransport', 'GhSyncTransport', 'print_summary',
9
+ 'gh_patch', 'GhApi', 'call_gh', 'date2gh', 'gh2date', 'GhRows', 'delete_release', 'create_release',
10
+ 'list_tags', 'list_branches', 'create_branch_empty', 'delete_tag', 'delete_branch', 'get_branch',
11
+ 'commit_tree', 'list_files', 'get_content', 'create_or_update_file', 'create_file', 'delete_file',
12
+ 'update_contents', 'enable_pages', 'read_issue', 'read_pr', 'pr_file_diff', 'PullRow', 'PullRows',
13
+ 'list_prs', 'issue_template', 'issue_body', 'CheckRun', 'CommitStatus', 'check_status', 'pr_status',
14
+ 'failed_step_log', 'dep_key', 'local_dep_graph', 'dep_closure', 'dep_order', 'dep_dependents', 'dep_graph',
15
+ 'APIError']
15
16
 
16
17
  # %% ../nbs/00_core.ipynb #5b5cba7b
17
18
  from contextvars import ContextVar
@@ -19,7 +20,7 @@ from contextvars import ContextVar
19
20
  from fastcore.all import *
20
21
  from fastspec.spec import SpecParser
21
22
  from fastspec.oapi import OpenAPIClient, OpFunc, SyncOpFunc
22
- from fastspec.transport import AsyncTransport, SyncTransport
23
+ from fasttransport.core import AsyncTransport, SyncTransport
23
24
  from .gh_spec import spec
24
25
  from fastspec.errors import APIError
25
26
 
@@ -142,7 +143,7 @@ class GhApi(OpenAPIClient):
142
143
  if verb is None: verb = 'POST' if data else 'GET'
143
144
  if route: path = path.format(**{k:quote(str(v), safe='') for k,v in route.items()})
144
145
  if not path.startswith(('http://', 'https://')): path = self.gh_host + path
145
- kw = dict(content=data) if isinstance(data, (bytes,str)) else dict(json_data=data)
146
+ kw = dict(content=data) if isinstance(data, (bytes,str)) else dict(json=data)
146
147
  return self.transport.request(verb, path, headers=headers, params=query, **kw)
147
148
 
148
149
  @property
@@ -487,7 +488,7 @@ async def read_pr(
487
488
  diff = _reduce_ctx(_filter_diff(info.diff, folder=folder))
488
489
  res += f"\n\n## Diff\n```diff\n{diff}\n```"
489
490
  if replies: res += _fmt_replies(info)
490
- return res
491
+ return TruncatedString(res, 8_000)
491
492
 
492
493
  # %% ../nbs/00_core.ipynb #69d12346
493
494
  async def pr_file_diff(
@@ -505,6 +506,8 @@ async def pr_file_diff(
505
506
  return f"File `{filename}` not found in PR #{pr_number}"
506
507
 
507
508
  # %% ../nbs/00_core.ipynb #2c94c2c8
509
+ MAXLEN = 180 # Most characters shown per displayed line
510
+
508
511
  def _age(s):
509
512
  "Compact age of ISO-8601 timestamp `s`"
510
513
  secs = (datetime.now(timezone.utc) - datetime.fromisoformat(s.replace('Z', '+00:00'))).total_seconds()
@@ -520,21 +523,21 @@ def _pr_mark(r):
520
523
 
521
524
  class PullRow(AttrDict):
522
525
  "One pull request as an actionable line"
523
- def line(self, maxlen=120): return f'#{self.number} {_age(self.updated_at)} {_pr_mark(self)}{truncstr(self.title, maxlen)}'
526
+ def line(self, maxlen=MAXLEN): return f'#{self.number} {_age(self.updated_at)} {_pr_mark(self)}{truncstr(self.title, maxlen)}'
524
527
  __repr__ = line
525
528
 
526
529
  class PullRows(GhRows):
527
530
  "Pull request rows, displayed with titles truncated to `maxlen`"
528
- def __init__(self, items, maxlen=120):
531
+ def __init__(self, items, maxlen=MAXLEN):
529
532
  super().__init__(items)
530
533
  self.maxlen = maxlen
531
- def __repr__(self): return '\n'.join(o.line(self.maxlen) for o in self)
534
+ def __repr__(self): return '\n'.join(o.line(self.maxlen) for o in self) or 'no PRs'
532
535
 
533
536
  @gh_patch
534
537
  async def list_prs(
535
538
  self:GhApi,
536
539
  state='open', # 'open', 'closed', or 'all'
537
- maxlen=120, # Title characters shown per row
540
+ maxlen=MAXLEN, # Title characters shown per row
538
541
  per_page=100, # PRs per request (100 max)
539
542
  page=1, # Page of results, for repos with more than `per_page` PRs
540
543
  )->PullRows:
@@ -630,7 +633,7 @@ async def failed_step_log(self:GhApi, job_id:int):
630
633
  errs = [i for i,l in enumerate(seg) if l.startswith(r'##[error]')]
631
634
  if errs: seg = seg[:errs[-1]+1]
632
635
  res.append(f'# {s.name}\n' + '\n'.join(seg))
633
- return '\n\n'.join(res)
636
+ return TruncatedString('\n\n'.join(res), 8_000)
634
637
 
635
638
  # %% ../nbs/00_core.ipynb #751c4e54
636
639
  def dep_key(dep):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghapi
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A python client for the GitHub API
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
6
  License: Apache-2.0
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=2.2.6
19
- Requires-Dist: fastspec>=0.2.0
18
+ Requires-Dist: fastcore>=2.2.7
19
+ Requires-Dist: fastspec>=0.2.1
20
20
  Requires-Dist: tomli; python_version < "3.11"
21
21
  Provides-Extra: dev
22
22
  Requires-Dist: fastgit; extra == "dev"
@@ -1,5 +1,5 @@
1
- fastcore>=2.2.6
2
- fastspec>=0.2.0
1
+ fastcore>=2.2.7
2
+ fastspec>=0.2.1
3
3
 
4
4
  [:python_version < "3.11"]
5
5
  tomli
@@ -12,7 +12,7 @@ license = {text = "Apache-2.0"}
12
12
  authors = [{name = "Jeremy Howard", email = "info@fast.ai"}]
13
13
  keywords = ['github', 'api']
14
14
  classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 5 - Production/Stable", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
- dependencies = ['fastcore>=2.2.6', 'fastspec>=0.2.0', 'tomli; python_version < "3.11"']
15
+ dependencies = ['fastcore>=2.2.7', 'fastspec>=0.2.1', 'tomli; python_version < "3.11"']
16
16
 
17
17
  [project.urls]
18
18
  Repository = "https://github.com/fastai/ghapi"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes