github_rest_api 0.29.0__tar.gz → 0.30.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 (20) hide show
  1. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.github/workflows/create_pr_dev_to_main.yml +0 -1
  2. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/PKG-INFO +1 -1
  3. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/github.py +33 -5
  4. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/pyproject.toml +2 -1
  5. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/uv.lock +46 -1
  6. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.github/workflows/create_pr_to_dev.yml +0 -0
  7. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.github/workflows/lint.yml +0 -0
  8. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.github/workflows/release.yml +0 -0
  9. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.gitignore +0 -0
  10. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/.gitpod.yml +0 -0
  11. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/README.md +0 -0
  12. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/__init__.py +0 -0
  13. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/__init__.py +0 -0
  14. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/cargo/__init__.py +0 -0
  15. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/cargo/benchmark.py +0 -0
  16. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/cargo/profiling.py +0 -0
  17. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/cargo/utils.py +0 -0
  18. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/actions/utils.py +0 -0
  19. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/github_rest_api/utils.py +0 -0
  20. {github_rest_api-0.29.0 → github_rest_api-0.30.0}/tests/__init__.py +0 -0
@@ -10,7 +10,6 @@ jobs:
10
10
  - name: Install uv
11
11
  run: |
12
12
  curl -LsSf https://astral.sh/uv/install.sh | sudo env UV_INSTALL_DIR="/usr/local/bin" sh
13
- - uses: actions/checkout@v6
14
13
  - name: Create PR From dev To main
15
14
  run: |
16
15
  curl -sSL https://raw.githubusercontent.com/legendu-net/github_actions_scripts/main/create_pull_request.py \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github_rest_api
3
- Version: 0.29.0
3
+ Version: 0.30.0
4
4
  Summary: Simple wrapper of GitHub REST APIs.
5
5
  Author-email: Ben Du <longendu@yahoo.com>
6
6
  Requires-Python: <4,>=3.11
@@ -76,6 +76,17 @@ class GitHub:
76
76
  resp.raise_for_status()
77
77
  return resp
78
78
 
79
+ def patch(self, url, raise_for_status: bool = True, **kwargs) -> requests.Response:
80
+ resp = requests.patch(
81
+ url=url,
82
+ headers=self._headers,
83
+ timeout=10,
84
+ **kwargs,
85
+ )
86
+ if raise_for_status:
87
+ resp.raise_for_status()
88
+ return resp
89
+
79
90
 
80
91
  class Repository(GitHub):
81
92
  """Abstraction of a GitHub repository."""
@@ -87,11 +98,14 @@ class Repository(GitHub):
87
98
  """
88
99
  super().__init__(token)
89
100
  self._repo = repo
90
- self._url_pull = f"https://api.github.com/repos/{repo}/pulls"
91
- self._url_branches = f"https://api.github.com/repos/{repo}/branches"
92
- self._url_refs = f"https://api.github.com/repos/{repo}/git/refs"
93
- self._url_issues = f"https://api.github.com/repos/{repo}/issues"
94
- self._url_releases = f"https://api.github.com/repos/{repo}/releases"
101
+ self._url = "https://api.github.com/repos"
102
+ self._url_repo = f"{self._url}/{repo}"
103
+ self._url_transfer = f"{self._url_repo}/transfer"
104
+ self._url_pull = f"{self._url_repo}/pulls"
105
+ self._url_branches = f"{self._url_repo}/branches"
106
+ self._url_refs = f"{self._url_repo}/git/refs"
107
+ self._url_issues = f"{self._url_repo}/issues"
108
+ self._url_releases = f"{self._url_repo}/releases"
95
109
 
96
110
  def get_releases(self) -> list[dict[str, Any]]:
97
111
  """List releases in this repository."""
@@ -272,6 +286,20 @@ class Repository(GitHub):
272
286
  timeout=10,
273
287
  ).json()
274
288
 
289
+ def archive(self) -> requests.Response:
290
+ return self.patch(
291
+ url=self._url_repo,
292
+ json={"archived": True},
293
+ )
294
+
295
+ def transfer(self, new_owner: str, new_name: str = "") -> requests.Response:
296
+ data = {
297
+ "new_owner": new_owner,
298
+ }
299
+ if new_name:
300
+ data["new_name"] = new_name
301
+ return self.post(url=self._url_transfer, json=data)
302
+
275
303
 
276
304
  class RepositoryType(StrEnum):
277
305
  ALL = "all"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "github_rest_api"
3
- version = "0.29.0"
3
+ version = "0.30.0"
4
4
  description = "Simple wrapper of GitHub REST APIs."
5
5
  authors = [{ name = "Ben Du", email = "longendu@yahoo.com" }]
6
6
  requires-python = ">=3.11,<4"
@@ -15,6 +15,7 @@ dependencies = [
15
15
  dev = [
16
16
  "deptry>=0.24.0",
17
17
  "pyright>=1.1.407",
18
+ "pytest>=9.0.2",
18
19
  "ruff>=0.14.10",
19
20
  "ty>=0.0.8",
20
21
  ]
@@ -168,7 +168,7 @@ wheels = [
168
168
 
169
169
  [[package]]
170
170
  name = "github-rest-api"
171
- version = "0.28.0"
171
+ version = "0.30.0"
172
172
  source = { editable = "." }
173
173
  dependencies = [
174
174
  { name = "dulwich" },
@@ -180,6 +180,7 @@ dependencies = [
180
180
  dev = [
181
181
  { name = "deptry" },
182
182
  { name = "pyright" },
183
+ { name = "pytest" },
183
184
  { name = "ruff" },
184
185
  { name = "ty" },
185
186
  ]
@@ -195,6 +196,7 @@ requires-dist = [
195
196
  dev = [
196
197
  { name = "deptry", specifier = ">=0.24.0" },
197
198
  { name = "pyright", specifier = ">=1.1.407" },
199
+ { name = "pytest", specifier = ">=9.0.2" },
198
200
  { name = "ruff", specifier = ">=0.14.10" },
199
201
  { name = "ty", specifier = ">=0.0.8" },
200
202
  ]
@@ -208,6 +210,15 @@ wheels = [
208
210
  { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" },
209
211
  ]
210
212
 
213
+ [[package]]
214
+ name = "iniconfig"
215
+ version = "2.3.0"
216
+ source = { registry = "https://pypi.org/simple" }
217
+ sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
218
+ wheels = [
219
+ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
220
+ ]
221
+
211
222
  [[package]]
212
223
  name = "nodeenv"
213
224
  version = "1.10.0"
@@ -226,6 +237,15 @@ wheels = [
226
237
  { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
227
238
  ]
228
239
 
240
+ [[package]]
241
+ name = "pluggy"
242
+ version = "1.6.0"
243
+ source = { registry = "https://pypi.org/simple" }
244
+ sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
245
+ wheels = [
246
+ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
247
+ ]
248
+
229
249
  [[package]]
230
250
  name = "psutil"
231
251
  version = "7.2.1"
@@ -254,6 +274,15 @@ wheels = [
254
274
  { url = "https://files.pythonhosted.org/packages/3e/73/2ce007f4198c80fcf2cb24c169884f833fe93fbc03d55d302627b094ee91/psutil-7.2.1-cp37-abi3-win_arm64.whl", hash = "sha256:0d67c1822c355aa6f7314d92018fb4268a76668a536f133599b91edd48759442", size = 133836, upload-time = "2025-12-29T08:26:43.086Z" },
255
275
  ]
256
276
 
277
+ [[package]]
278
+ name = "pygments"
279
+ version = "2.20.0"
280
+ source = { registry = "https://pypi.org/simple" }
281
+ sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" }
282
+ wheels = [
283
+ { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" },
284
+ ]
285
+
257
286
  [[package]]
258
287
  name = "pyright"
259
288
  version = "1.1.408"
@@ -267,6 +296,22 @@ wheels = [
267
296
  { url = "https://files.pythonhosted.org/packages/0c/82/a2c93e32800940d9573fb28c346772a14778b84ba7524e691b324620ab89/pyright-1.1.408-py3-none-any.whl", hash = "sha256:090b32865f4fdb1e0e6cd82bf5618480d48eecd2eb2e70f960982a3d9a4c17c1", size = 6399144, upload-time = "2026-01-08T08:07:37.082Z" },
268
297
  ]
269
298
 
299
+ [[package]]
300
+ name = "pytest"
301
+ version = "9.0.2"
302
+ source = { registry = "https://pypi.org/simple" }
303
+ dependencies = [
304
+ { name = "colorama", marker = "sys_platform == 'win32'" },
305
+ { name = "iniconfig" },
306
+ { name = "packaging" },
307
+ { name = "pluggy" },
308
+ { name = "pygments" },
309
+ ]
310
+ sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901, upload-time = "2025-12-06T21:30:51.014Z" }
311
+ wheels = [
312
+ { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" },
313
+ ]
314
+
270
315
  [[package]]
271
316
  name = "requests"
272
317
  version = "2.32.5"