gitcode-api 1.2.18__py3-none-any.whl → 1.2.19__py3-none-any.whl

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.
gitcode_api/constants.py CHANGED
@@ -1,8 +1,25 @@
1
1
  """Shared constant values for the GitCode SDK."""
2
2
 
3
+ import re
4
+
3
5
  DEFAULT_BASE_URL = "https://api.gitcode.com/api/v5"
4
6
  DEFAULT_TIMEOUT = 30.0
5
7
  DEFAULT_TOKEN_ENV = "GITCODE_ACCESS_TOKEN"
6
8
  DEFAULT_CA_ENV = "GITCODE_CA_BUNDLE"
9
+ GITCODE_ISSUE_TEMPLATE_PATH_RE: re.Pattern[str] = re.compile(
10
+ r"\.git(code|hub)/ISSUE_TEMPLATE.*\.(md|markdown|ya?ml)$", re.IGNORECASE
11
+ )
12
+ GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE: re.Pattern[str] = re.compile(
13
+ r"\.git(code|hub)/PULL_REQUEST_TEMPLATE.*\.(md|markdown|ya?ml)$", re.IGNORECASE
14
+ )
15
+ GITCODE_TEMPLATE_REPO = ".gitcode"
7
16
 
8
- __all__ = ["DEFAULT_BASE_URL", "DEFAULT_TIMEOUT", "DEFAULT_TOKEN_ENV", "DEFAULT_CA_ENV"]
17
+ __all__ = [
18
+ "DEFAULT_BASE_URL",
19
+ "DEFAULT_TIMEOUT",
20
+ "DEFAULT_TOKEN_ENV",
21
+ "DEFAULT_CA_ENV",
22
+ "GITCODE_ISSUE_TEMPLATE_PATH_RE",
23
+ "GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE",
24
+ "GITCODE_TEMPLATE_REPO",
25
+ ]
@@ -1,19 +1,12 @@
1
1
  """Shared resource base classes for the GitCode SDK."""
2
2
 
3
- import re
4
3
  from typing import Any, Dict, List, Optional, Pattern, Tuple, Union
5
4
 
6
5
  from .._base_client import AsyncAPIClient, SyncAPIClient
7
6
  from .._base_resource import BaseResource
8
7
  from .._exceptions import GitCodeHTTPStatusError
9
8
  from .._models import APIObject, ModelT, as_model, as_model_list
10
-
11
- GITCODE_ISSUE_TEMPLATE_PATH_RE: Pattern[str] = re.compile(
12
- r"\.gitcode/ISSUE_TEMPLATE.*\.(md|markdown|ya?ml)$", re.IGNORECASE
13
- )
14
- GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE: Pattern[str] = re.compile(
15
- r"\.gitcode/PULL_REQUEST_TEMPLATE.*\.(md|markdown|ya?ml)$", re.IGNORECASE
16
- )
9
+ from ..constants import GITCODE_TEMPLATE_REPO
17
10
 
18
11
 
19
12
  def _parse_parent_owner_repo(repo_obj: Any) -> Optional[Tuple[str, str]]:
@@ -50,7 +43,7 @@ def _resolution_sources_sync(client: SyncAPIClient, owner: str, repo: str) -> Li
50
43
  sources.append(pair)
51
44
 
52
45
  add((owner, repo))
53
- add((owner, ".gitcode"))
46
+ add((owner, GITCODE_TEMPLATE_REPO))
54
47
 
55
48
  max_candidates = 64
56
49
  index = 0
@@ -68,7 +61,7 @@ def _resolution_sources_sync(client: SyncAPIClient, owner: str, repo: str) -> Li
68
61
  continue
69
62
  po, pr = parsed
70
63
  add((po, pr))
71
- add((po, ".gitcode"))
64
+ add((po, GITCODE_TEMPLATE_REPO))
72
65
 
73
66
  return sources
74
67
 
@@ -86,7 +79,7 @@ async def _resolution_sources_async(client: AsyncAPIClient, owner: str, repo: st
86
79
  sources.append(pair)
87
80
 
88
81
  add((owner, repo))
89
- add((owner, ".gitcode"))
82
+ add((owner, GITCODE_TEMPLATE_REPO))
90
83
 
91
84
  max_candidates = 64
92
85
  index = 0
@@ -104,7 +97,7 @@ async def _resolution_sources_async(client: AsyncAPIClient, owner: str, repo: st
104
97
  continue
105
98
  po, pr = parsed
106
99
  add((po, pr))
107
- add((po, ".gitcode"))
100
+ add((po, GITCODE_TEMPLATE_REPO))
108
101
 
109
102
  return sources
110
103
 
@@ -210,6 +203,8 @@ def list_gitcode_template_rows_sync(
210
203
  acc: List[Tuple[str, str, str, str]] = []
211
204
  try:
212
205
  _walk_dot_gitcode_contents_sync(client, so, sr, ".gitcode", acc)
206
+ if sr != GITCODE_TEMPLATE_REPO:
207
+ _walk_dot_gitcode_contents_sync(client, so, sr, ".github", acc)
213
208
  except GitCodeHTTPStatusError:
214
209
  continue
215
210
  rows = [(t_o, t_r, p, s) for t_o, t_r, p, s in acc if path_pattern.match(p)]
@@ -228,6 +223,8 @@ async def list_gitcode_template_rows_async(
228
223
  acc: List[Tuple[str, str, str, str]] = []
229
224
  try:
230
225
  await _walk_dot_gitcode_contents_async(client, so, sr, ".gitcode", acc)
226
+ if sr != GITCODE_TEMPLATE_REPO:
227
+ await _walk_dot_gitcode_contents_async(client, so, sr, ".github", acc)
231
228
  except GitCodeHTTPStatusError:
232
229
  continue
233
230
  rows = [(t_o, t_r, p, s) for t_o, t_r, p, s in acc if path_pattern.match(p)]
@@ -25,9 +25,8 @@ from .._models import (
25
25
  UserSummary,
26
26
  as_model,
27
27
  )
28
+ from ..constants import GITCODE_ISSUE_TEMPLATE_PATH_RE, GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE
28
29
  from ._shared import (
29
- GITCODE_ISSUE_TEMPLATE_PATH_RE,
30
- GITCODE_PULL_REQUEST_TEMPLATE_PATH_RE,
31
30
  AsyncResource,
32
31
  SyncResource,
33
32
  get_gitcode_template_body_async,
@@ -420,6 +419,8 @@ class IssuesResource(SyncResource):
420
419
  are appended, deduplicated, and visited in order). The first source with matching
421
420
  templates wins.
422
421
 
422
+ Version 1.2.19: Now also supporting GitHub-mirrored repos with a ``.github/`` folder.
423
+
423
424
  :param owner: Repository owner path. Uses the client default when omitted.
424
425
  :param repo: Repository name. Uses the client default when omitted.
425
426
  :returns: Template metadata entries (paths and SHAs); empty when none match.
@@ -1067,6 +1068,8 @@ class PullsResource(SyncResource):
1067
1068
  are appended, deduplicated, and visited in order). The first source with matching
1068
1069
  templates wins.
1069
1070
 
1071
+ Version 1.2.19: Now also supporting GitHub-mirrored repos with a ``.github/`` folder.
1072
+
1070
1073
  :param owner: Repository owner path. Uses the client default when omitted.
1071
1074
  :param repo: Repository path. Uses the client default when omitted.
1072
1075
  :returns: Template metadata entries (paths and SHAs); empty when none match.
@@ -1734,6 +1737,8 @@ class AsyncIssuesResource(AsyncResource):
1734
1737
  are appended, deduplicated, and visited in order). The first source with matching
1735
1738
  templates wins.
1736
1739
 
1740
+ Version 1.2.19: Now also supporting GitHub-mirrored repos with a ``.github/`` folder.
1741
+
1737
1742
  :param owner: Repository owner path. Uses the client default when omitted.
1738
1743
  :param repo: Repository name. Uses the client default when omitted.
1739
1744
  :returns: Template metadata entries (paths and SHAs); empty when none match.
@@ -2328,6 +2333,8 @@ class AsyncPullsResource(AsyncResource):
2328
2333
  are appended, deduplicated, and visited in order). The first source with matching
2329
2334
  templates wins.
2330
2335
 
2336
+ Version 1.2.19: Now also supporting GitHub-mirrored repos with a ``.github/`` folder.
2337
+
2331
2338
  :param owner: Repository owner path. Uses the client default when omitted.
2332
2339
  :param repo: Repository path. Uses the client default when omitted.
2333
2340
  :returns: Template metadata entries (paths and SHAs); empty when none match.
gitcode_api/version.txt CHANGED
@@ -1 +1 @@
1
- 1.2.18
1
+ 1.2.19
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.18
3
+ Version: 1.2.19
4
4
  Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP, OpenAI tool, and openJiuwen tool) for agents. Community-maintained.
5
5
  Author-email: Hugo Huang <hugo@hugohuang.com>
6
6
  License-Expression: MIT
@@ -37,7 +37,7 @@ Dynamic: license-file
37
37
 
38
38
  # GitCode-API
39
39
 
40
- [![PyPI - Version](https://img.shields.io/pypi/v/gitcode-api?link=https%3A%2F%2Fpypi.org%2Fproject%2Fgitcode-api%2F&uuid=f049bfb2e9a847dfb667888d9e54d163)](https://pypi.org/project/gitcode-api) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/gitcode-api?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=RED&left_text=downloads&uuid=3d4c578403ac4d8aab1c59a48425e14b)](https://pepy.tech/projects/gitcode-api) [![CodeFactor](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api/badge)](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
40
+ [![PyPI - Version](https://img.shields.io/pypi/v/gitcode-api?link=https%3A%2F%2Fpypi.org%2Fproject%2Fgitcode-api%2F&uuid=a97d86566eb14d5e96f3f90dafdd0beb)](https://pypi.org/project/gitcode-api) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/gitcode-api?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=RED&left_text=downloads&uuid=a97d86566eb14d5e96f3f90dafdd0beb)](https://pepy.tech/projects/gitcode-api) [![CodeFactor](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api/badge)](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
41
41
  [![Install in Cursor](https://img.shields.io/badge/Install_in-Cursor-000000?logoColor=white)](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19) [![Install in VS Code](https://img.shields.io/badge/Install_in-VS_Code-0098FF?logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=GitCode%20API&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22gitcode-api%5Bmcp%5D%22%2C%22gitcode-api%22%2C%22serve%22%5D%2C%22env%22%3A%7B%22GITCODE_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agitcode_access_token%7D%22%7D%2C%22inputs%22%3A%5B%7B%22id%22%3A%22gitcode_access_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Enter%20GITCODE_ACCESS_TOKEN%22%2C%22password%22%3Atrue%7D%5D%7D)
42
42
  [![GitHub Badge](https://img.shields.io/badge/github-repo-blue?logo=github&link=https%3A%2F%2Fgithub.com%2FTrenza1ore%2FGitCode-API)](https://github.com/Trenza1ore/GitCode-API) [![GitCode Badge](https://img.shields.io/badge/gitcode-repo-brown?logo=gitcode&link=https%3A%2F%2Fgitcode.com%2FSushiNinja%2FGitCode-API)](https://gitcode.com/SushiNinja/GitCode-API)
43
43
 
@@ -7,25 +7,25 @@ gitcode_api/_client.py,sha256=bmZxBHdfshM5Kv_EurHUVu8rsEj0k3Up3ATSIPaFrvc,8258
7
7
  gitcode_api/_exceptions.py,sha256=T5N8gBGmPSktDkLP5P_hxbzOHw3W378TzxN1xja40pA,1140
8
8
  gitcode_api/_models.py,sha256=ip0xgdWao8Z3ATfSaPn3KzG81OXd25RVB1ansOaJaUM,110586
9
9
  gitcode_api/cli.py,sha256=7ZrpWIh5zZdftMhbMjldiuvijig8qKLFiQbof93Cy6k,18792
10
- gitcode_api/constants.py,sha256=UYfSkmoRc71kIkgFYS5NFUoFhdbcXvnGV-EiJnvbELI,296
10
+ gitcode_api/constants.py,sha256=uzcI7dVq4Qx_toYtnIphUh1IGepv9NuOdJ4DCswiYgo,769
11
11
  gitcode_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  gitcode_api/run_mcp.py,sha256=3_JOrjg9_yL-0M-H-F8mPgxdVKh7K2ggipu7UHeNCg0,147
13
13
  gitcode_api/utils.py,sha256=51QmPTQPeNsPSGf2IzhwmiEO1H2GkJrp2A7vkzhOOag,1351
14
- gitcode_api/version.txt,sha256=EEaCKUK2jb-KMegeJfWHxBHsQs-nsTSYst95cj6LJIo,7
14
+ gitcode_api/version.txt,sha256=Kt-wv6L2q7wzBPEfl6iGyfGBmEs0ik7CR57DsILDjYU,7
15
15
  gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
16
16
  gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
17
17
  gitcode_api/llm/jiuwen.py,sha256=qca2y4544xoRYFOCMbkjiUZZLpJGMcBkK4w5bqs60-4,4276
18
18
  gitcode_api/llm/mcp.py,sha256=eeAuEETZ4THw31wbcnQaTlZQJ-9ZolvsejQY630OqHs,5702
19
19
  gitcode_api/llm/openai.py,sha256=FSPA0Jv-k4n1Ud92TDfP1TWRlW4FB7smaLwY331nagk,3257
20
20
  gitcode_api/resources/__init__.py,sha256=nsCKW0bFDZ5ombJZxLThmO82sOuF7o4OKUMRkAmwbwk,1725
21
- gitcode_api/resources/_shared.py,sha256=07f4Zk_bk6JKjEwubZ6iSd1Lq1rGi7CyWjvcMNMcYpo,15402
21
+ gitcode_api/resources/_shared.py,sha256=My0DuLyd8q_SPByGcbmizUdN5r3yMbBJ1rUhsXF4LZw,15458
22
22
  gitcode_api/resources/account.py,sha256=mnc2p7wI-nBnHFNdWPNiHfmZpT6d3RDQC777gewtm4M,38801
23
- gitcode_api/resources/collaboration.py,sha256=TK0QXG_ymE4vbtHyP3Y-M39oG9zQE44UU5-UnPhF2WM,112388
23
+ gitcode_api/resources/collaboration.py,sha256=je3ykQOTS_n9bSUr0gDYRkXVxhNtf1NJXWPWcuv5nSs,112783
24
24
  gitcode_api/resources/misc.py,sha256=w7bq8rmgKr2ScBKeWZ3EZJmAdylDdPtSPrhi3AQre7w,34747
25
25
  gitcode_api/resources/repositories.py,sha256=EAK2znZhEsgVUu-NDEQslSEEYJzvb-kHuh4mW57y6sc,78178
26
- gitcode_api-1.2.18.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
27
- gitcode_api-1.2.18.dist-info/METADATA,sha256=QsYuYvwW_j8YWO2FV6YnK6HBOCu9BDLjfIjUaYL_8SI,23592
28
- gitcode_api-1.2.18.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
29
- gitcode_api-1.2.18.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
30
- gitcode_api-1.2.18.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
31
- gitcode_api-1.2.18.dist-info/RECORD,,
26
+ gitcode_api-1.2.19.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
27
+ gitcode_api-1.2.19.dist-info/METADATA,sha256=lkda5yPPW5Nz2RTNiRmtIgptKm7RG-cdy8EVnWPQfk0,23592
28
+ gitcode_api-1.2.19.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
29
+ gitcode_api-1.2.19.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
30
+ gitcode_api-1.2.19.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
31
+ gitcode_api-1.2.19.dist-info/RECORD,,