github-rest-api 0.43.0__tar.gz → 0.44.0__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 (46) hide show
  1. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/PKG-INFO +1 -1
  2. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/github.py +27 -0
  3. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/pyproject.toml +1 -1
  4. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_github.py +19 -0
  5. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/uv.lock +1 -1
  6. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.devcontainer/devcontainer.json +0 -0
  7. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.github/workflows/create_pr_to_main.yaml +0 -0
  8. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.github/workflows/lint.yaml +0 -0
  9. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.github/workflows/release.yaml +0 -0
  10. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.github/workflows/remove_branch.yaml +0 -0
  11. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.github/workflows/test.yaml +0 -0
  12. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/.gitignore +0 -0
  13. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/GEMINI.md +0 -0
  14. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/README.md +0 -0
  15. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/__init__.py +0 -0
  16. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/pr_content.py +0 -0
  17. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/__init__.py +0 -0
  18. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/cargo/__init__.py +0 -0
  19. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/cargo/benchmark.py +0 -0
  20. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/cargo/profiling.py +0 -0
  21. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/cargo/utils.py +0 -0
  22. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/container/__init__.py +0 -0
  23. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/container/build_container_images.py +0 -0
  24. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/container/config_container.py +0 -0
  25. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/container/update_version_containerfile.py +0 -0
  26. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/__init__.py +0 -0
  27. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/add_github_repo.py +0 -0
  28. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/create_pull_request.py +0 -0
  29. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/release_on_github.py +0 -0
  30. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/remove_branch.py +0 -0
  31. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/create_pr_dev_to_main.yaml +0 -0
  32. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/create_pr_to_dev.yaml +0 -0
  33. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/create_pr_to_main.yaml +0 -0
  34. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/python/lint.yaml +0 -0
  35. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/python/test.yaml +0 -0
  36. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/github/workflows/remove_branch.yaml +0 -0
  37. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/scripts/utils.py +0 -0
  38. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/github_rest_api/utils.py +0 -0
  39. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/memory/MEMORY.md +0 -0
  40. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/memory/feedback_test_runner.md +0 -0
  41. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/__init__.py +0 -0
  42. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_build_container_images.py +0 -0
  43. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_create_pull_request.py +0 -0
  44. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_pr_content.py +0 -0
  45. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_release_on_github.py +0 -0
  46. {github_rest_api-0.43.0 → github_rest_api-0.44.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-rest-api
3
- Version: 0.43.0
3
+ Version: 0.44.0
4
4
  Summary: Simple wrapper of GitHub REST APIs.
5
5
  Author-email: Ben Du <longendu@yahoo.com>
6
6
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -203,6 +203,12 @@ class GitHub:
203
203
  params["page"] += 1
204
204
 
205
205
 
206
+ class IssueState(StrEnum):
207
+ OPEN = "open"
208
+ CLOSED = "closed"
209
+ ALL = "all"
210
+
211
+
206
212
  class Repository(GitHub):
207
213
  """Abstraction of a GitHub repository."""
208
214
 
@@ -282,6 +288,19 @@ class Repository(GitHub):
282
288
  """List pull requests in this repository."""
283
289
  return self._extract_all(url=self._url_pull, n=n)
284
290
 
291
+ def get_issues(
292
+ self, state: IssueState = IssueState.OPEN, n: int = 0
293
+ ) -> list[dict[str, Any]]:
294
+ """List issues in this repository.
295
+
296
+ :param state: Filter issues by state: ``open`` (the default),
297
+ ``closed``, or ``all``. Note that GitHub's issues endpoint also
298
+ returns pull requests; each pull request carries a
299
+ ``pull_request`` key.
300
+ :param n: The maximum number of issues to return (0 means all).
301
+ """
302
+ return self._extract_all(url=self._url_issues, params={"state": state}, n=n)
303
+
285
304
  def _generate_pull_request_content(
286
305
  self, base: str, head: str, model: str
287
306
  ) -> tuple[str, str] | None:
@@ -499,6 +518,14 @@ class Repository(GitHub):
499
518
  """
500
519
  return self.pr_has_change(pr_number=pr_number, pred=pred)
501
520
 
521
+ def get_issue_comments(self, issue_number: int, n: int = 0) -> list[dict[str, Any]]:
522
+ """List comments on an issue in this repository.
523
+
524
+ :param issue_number: The number of the issue.
525
+ :param n: The maximum number of comments to return (0 means all).
526
+ """
527
+ return self._extract_all(url=f"{self._url_issues}/{issue_number}/comments", n=n)
528
+
502
529
  def create_issue_comment(self, issue_number: int, body: str) -> dict[str, Any]:
503
530
  """Add a new comment to an issue.
504
531
 
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
4
4
 
5
5
  [project]
6
6
  name = "github-rest-api"
7
- version = "0.43.0"
7
+ version = "0.44.0"
8
8
  description = "Simple wrapper of GitHub REST APIs."
9
9
  readme = "README.md"
10
10
  authors = [ { name = "Ben Du", email = "longendu@yahoo.com" } ]
@@ -76,6 +76,25 @@ def test_repository_get_branch():
76
76
  assert branch["name"] == "main"
77
77
 
78
78
 
79
+ def test_get_issues_passes_url_and_state():
80
+ repo = Repository("token", "owner/name")
81
+ with patch.object(repo, "_extract_all", return_value=[]) as mock_extract:
82
+ repo.get_issues()
83
+ assert mock_extract.call_args.kwargs["url"] == (
84
+ "https://api.github.com/repos/owner/name/issues"
85
+ )
86
+ assert mock_extract.call_args.kwargs["params"] == {"state": "open"}
87
+
88
+
89
+ def test_get_issue_comments_passes_url():
90
+ repo = Repository("token", "owner/name")
91
+ with patch.object(repo, "_extract_all", return_value=[]) as mock_extract:
92
+ repo.get_issue_comments(7)
93
+ assert mock_extract.call_args.kwargs["url"] == (
94
+ "https://api.github.com/repos/owner/name/issues/7/comments"
95
+ )
96
+
97
+
79
98
  def test_compare_url_encodes_branch_names():
80
99
  repo = Repository("token", "owner/name")
81
100
  response = MagicMock()
@@ -542,7 +542,7 @@ wheels = [
542
542
 
543
543
  [[package]]
544
544
  name = "github-rest-api"
545
- version = "0.42.1"
545
+ version = "0.43.0"
546
546
  source = { editable = "." }
547
547
  dependencies = [
548
548
  { name = "dulwich" },