gitcode-api 1.3.0__py3-none-any.whl → 1.3.1__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/llm/mcp.py +1 -1
- gitcode_api/resources/collaboration/issues_resource_group.py +12 -1
- gitcode_api/version.txt +1 -1
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/METADATA +15 -18
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/RECORD +9 -9
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/WHEEL +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/entry_points.txt +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/licenses/LICENSE +0 -0
- {gitcode_api-1.3.0.dist-info → gitcode_api-1.3.1.dist-info}/top_level.txt +0 -0
gitcode_api/llm/mcp.py
CHANGED
|
@@ -136,7 +136,7 @@ def create_mcp_server(name: str = "GitCode API", tool: Optional[GitCodeLLMTool]
|
|
|
136
136
|
:param name: MCP server display name.
|
|
137
137
|
:param tool: Optional preconfigured :class:`~gitcode_api.llm._tool.GitCodeLLMTool`.
|
|
138
138
|
:param kwargs: Forwarded to :class:`GitCodeMCP` and then to ``fastmcp.FastMCP`` (for example
|
|
139
|
-
``instructions
|
|
139
|
+
``instructions`` to override the default server instructions).
|
|
140
140
|
:returns: Configured ``FastMCP`` instance with ``gitcode_api_tool`` registered.
|
|
141
141
|
"""
|
|
142
142
|
return GitCodeMCP(name=name, tool=tool, **kwargs).mcp
|
|
@@ -76,6 +76,8 @@ class AbstractIssuesResource(ABC):
|
|
|
76
76
|
labels: Optional[List[str]] = None,
|
|
77
77
|
milestone: Union[int, str, None] = None,
|
|
78
78
|
security_hole: Optional[str] = None,
|
|
79
|
+
template_path: Optional[str] = None,
|
|
80
|
+
**kwargs,
|
|
79
81
|
) -> Issue:
|
|
80
82
|
"""Create an issue for a repository.
|
|
81
83
|
|
|
@@ -87,6 +89,9 @@ class AbstractIssuesResource(ABC):
|
|
|
87
89
|
:param labels: Optional label names.
|
|
88
90
|
:param milestone: Optional milestone identifier.
|
|
89
91
|
:param security_hole: Whether the issue is private; form field described in the Issues API (default public).
|
|
92
|
+
:param template_path: issue template path, project templates support files under the .gitcode, .github, .gitee
|
|
93
|
+
directories, and organization templates only support files under the .gitcode directory of .gitcode repo.
|
|
94
|
+
:param kwargs: Forwarded directly, useful since GitCode has awful documentation...
|
|
90
95
|
:returns: Created issue details.
|
|
91
96
|
"""
|
|
92
97
|
|
|
@@ -400,6 +405,8 @@ class IssuesResource(SyncResource, AbstractIssuesResource):
|
|
|
400
405
|
labels: Optional[List[str]] = None,
|
|
401
406
|
milestone: Union[int, str, None] = None,
|
|
402
407
|
security_hole: Optional[str] = None,
|
|
408
|
+
template_path: Optional[str] = None,
|
|
409
|
+
**kwargs,
|
|
403
410
|
) -> Issue:
|
|
404
411
|
resolved_repo = repo or self._client.repo
|
|
405
412
|
return self._model(
|
|
@@ -414,7 +421,8 @@ class IssuesResource(SyncResource, AbstractIssuesResource):
|
|
|
414
421
|
"labels": _comma_join(labels),
|
|
415
422
|
"milestone": milestone,
|
|
416
423
|
"security_hole": security_hole,
|
|
417
|
-
|
|
424
|
+
"template_path": template_path,
|
|
425
|
+
} | kwargs,
|
|
418
426
|
)
|
|
419
427
|
|
|
420
428
|
def update(
|
|
@@ -659,6 +667,8 @@ class AsyncIssuesResource(AsyncResource, AbstractIssuesResource):
|
|
|
659
667
|
labels: Optional[List[str]] = None,
|
|
660
668
|
milestone: Union[int, str, None] = None,
|
|
661
669
|
security_hole: Optional[str] = None,
|
|
670
|
+
template_path: Optional[str] = None,
|
|
671
|
+
**kwargs,
|
|
662
672
|
) -> Issue:
|
|
663
673
|
resolved_repo = repo or self._client.repo
|
|
664
674
|
return await self._model(
|
|
@@ -673,6 +683,7 @@ class AsyncIssuesResource(AsyncResource, AbstractIssuesResource):
|
|
|
673
683
|
"labels": _comma_join(labels),
|
|
674
684
|
"milestone": milestone,
|
|
675
685
|
"security_hole": security_hole,
|
|
686
|
+
"template_path": template_path,
|
|
676
687
|
},
|
|
677
688
|
)
|
|
678
689
|
|
gitcode_api/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.1
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
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
|
-
Author-email: Hugo Huang <hugo@hugohuang.com>
|
|
5
|
+
Author-email: "Hugo (Jin Huang)" <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
|
|
8
8
|
Project-URL: Issues, https://github.com/Trenza1ore/GitCode-API/issues
|
|
@@ -12,7 +12,7 @@ Project-URL: Github, https://github.com/Trenza1ore/GitCode-API
|
|
|
12
12
|
Project-URL: Homepage, https://hugohuang.com/gitcode-api
|
|
13
13
|
Project-URL: Author, https://hugohuang.com
|
|
14
14
|
Keywords: gitcode,git,devops,api,sdk,python,httpx,client,mcp,agent,fastmcp,llm,openjiuwen,mcp client,mcp server,model context protocol
|
|
15
|
-
Classifier: Development Status ::
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -35,15 +35,12 @@ Provides-Extra: mcp
|
|
|
35
35
|
Requires-Dist: fastmcp; python_version >= "3.10" and extra == "mcp"
|
|
36
36
|
Dynamic: license-file
|
|
37
37
|
|
|
38
|
-
# GitCode-API
|
|
39
|
-
|
|
40
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api)
|
|
41
|
-
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19) [](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
|
-
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API/actions/workflows/check-code.yml/)
|
|
38
|
+
# GitCode-API [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API)
|
|
39
|
+
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api) 
|
|
43
40
|
|
|
44
41
|
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
45
42
|
|
|
46
|
-
`gitcode-api` is a community-maintained Python SDK for the GitCode REST API. It provides easy-to-use synchronous and asynchronous clients,
|
|
43
|
+
`gitcode-api` is a community-maintained Python SDK for the GitCode REST API. It provides easy-to-use synchronous and asynchronous clients, helpers methods grouped by resource groups, and type-hinted response models so you can work with GitCode from Python without hand-writing raw HTTP requests. The `gitcode_api.llm` module adds an OpenAI-style function tool, an MCP service, and an [openJiuwen](https://openjiuwen.com) tool integration so agents can reuse the same resource-oriented API.
|
|
47
44
|
|
|
48
45
|
## Why This Project
|
|
49
46
|
|
|
@@ -51,7 +48,7 @@ Dynamic: license-file
|
|
|
51
48
|
- Sync and async clients with a consistent API surface.
|
|
52
49
|
- Convenient methods not offered by REST API directly: such as fetching Issue and PR templates.
|
|
53
50
|
- Resource groups such as `client.repos`, `client.pulls`, and `client.users`.
|
|
54
|
-
- Repository defaults via `owner
|
|
51
|
+
- Repository defaults via `owner` and `repo` on the client.
|
|
55
52
|
- Sphinx docs plus a mirrored GitCode REST API reference in `docs/`.
|
|
56
53
|
- Provides MCP server, OpenAI tool, and [openJiuwen](https://openjiuwen.com) tool for LLM agent usage.
|
|
57
54
|
- Provide MCP service that directly installs to your IDE of choice, such as Cursor and VS Code!
|
|
@@ -77,14 +74,14 @@ For detailed setup (including installing to services like Claude Code / Codex):
|
|
|
77
74
|
|
|
78
75
|
## Authentication
|
|
79
76
|
|
|
80
|
-
Pass `api_key
|
|
77
|
+
Pass `api_key` directly, or set `GITCODE_ACCESS_TOKEN` in your environment:
|
|
81
78
|
|
|
82
79
|
```bash
|
|
83
80
|
export GITCODE_ACCESS_TOKEN="your-token"
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
If your token is stored in encrypted form, pass `decrypt
|
|
87
|
-
encrypted `api_key
|
|
83
|
+
If your token is stored in encrypted form, pass `decrypt` to decode either an
|
|
84
|
+
encrypted `api_key` value or an encrypted `GITCODE_ACCESS_TOKEN` value before
|
|
88
85
|
the client uses it.
|
|
89
86
|
|
|
90
87
|
```python
|
|
@@ -171,7 +168,7 @@ meta = as_dict(repo) # dict
|
|
|
171
168
|
|
|
172
169
|
### Context managers
|
|
173
170
|
|
|
174
|
-
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. Leaving the block calls `close()` / `await close()` on the underlying client automatically, including a custom `http_client
|
|
171
|
+
`GitCode` and `AsyncGitCode` (and the lower-level `SyncAPIClient` / `AsyncAPIClient`) support `with` / `async with`. Leaving the block calls `close()` / `await close()` on the underlying client automatically, including a custom `http_client` you passed in. `close()` also clears the LRU cache used by each resource group's `method_signature(...)` helper (see the [Available Resources](#available-resources) section).
|
|
175
172
|
|
|
176
173
|
```python
|
|
177
174
|
from gitcode_api import GitCode
|
|
@@ -328,7 +325,7 @@ while True:
|
|
|
328
325
|
pip install 'gitcode-api[mcp]'
|
|
329
326
|
```
|
|
330
327
|
|
|
331
|
-
- **`create_mcp_server`** — builds a `FastMCP` instance with `gitcode_api_tool` already registered; optional `name
|
|
328
|
+
- **`create_mcp_server`** — builds a `FastMCP` instance with `gitcode_api_tool` already registered; optional `name`, `tool`, and extra keyword arguments are forwarded to `FastMCP(...)`.
|
|
332
329
|
- **`GitCodeMCP`** — thin wrapper that constructs that server and registers the tool; unknown attributes are delegated to the underlying `FastMCP` object (for example transport helpers exposed by your FastMCP version).
|
|
333
330
|
- **`create_mcp_gitcode_api_tool`** — returns the standalone async callable used as the tool body (for custom wiring).
|
|
334
331
|
- **`register_mcp_gitcode_api_tool`** — attaches that callable to an existing FastMCP-compatible object (`mcp.tool(...)` or `mcp.add_tool(...)`).
|
|
@@ -342,7 +339,7 @@ mcp = create_mcp_server(name="GitCode API", owner="SushiNinja", repo="GitCode-AP
|
|
|
342
339
|
|
|
343
340
|
The same server is available from the CLI as `gitcode-api serve` (see the [CLI](#cli) section).
|
|
344
341
|
|
|
345
|
-
To share auth or clients across tools, build `GitCodeLLMTool` once (`from gitcode_api.llm._tool import GitCodeLLMTool`) and pass it as `tool
|
|
342
|
+
To share auth or clients across tools, build `GitCodeLLMTool` once (`from gitcode_api.llm._tool import GitCodeLLMTool`) and pass it as `tool` into `GitCodeMCP`, `create_mcp_server`, `register_mcp_gitcode_api_tool`, or `create_mcp_gitcode_api_tool`.
|
|
346
343
|
|
|
347
344
|
### openJiuwen (`LocalFunction`)
|
|
348
345
|
|
|
@@ -360,7 +357,7 @@ jiuwen_tool = create_openjiuwen_gitcode_api_tool(owner="SushiNinja", repo="GitCo
|
|
|
360
357
|
# await jiuwen_tool.invoke({"op_type": "repos", "action": "get", "params": {}})
|
|
361
358
|
```
|
|
362
359
|
|
|
363
|
-
Optional `name
|
|
360
|
+
Optional `name` and `description` override the default tool card. Constructor options otherwise mirror `GitCode` / `AsyncGitCode` (`client`, `async_client`, `api_key`, `owner`, `repo`, `base_url`, `timeout`, `decrypt`).
|
|
364
361
|
|
|
365
362
|
**Claude Desktop (MCPB):** published GitHub Releases include a `gitcode-<version>.mcpb` bundle for one-click installation as a Claude Desktop extension; see Anthropic’s guide, [Build a desktop extension with MCPB](https://claude.com/docs/connectors/building/mcpb). From a checkout you can run `make mcpb` (requires the [`@anthropic-ai/mcpb`](https://www.npmjs.com/package/@anthropic-ai/mcpb) CLI on your `PATH`).
|
|
366
363
|
|
|
@@ -431,7 +428,7 @@ with GitCode(
|
|
|
431
428
|
|
|
432
429
|
Use `httpx.AsyncClient(verify=...)` with `AsyncGitCode` for async code.
|
|
433
430
|
|
|
434
|
-
The OpenAI tool (`GitCodeOpenAITool`), MCP helpers, and `create_openjiuwen_gitcode_api_tool` accept the same `client
|
|
431
|
+
The OpenAI tool (`GitCodeOpenAITool`), MCP helpers, and `create_openjiuwen_gitcode_api_tool` accept the same `client` / `async_client` arguments (OpenAI and MCP also accept a shared `GitCodeLLMTool` via `tool`). Build `GitCode` / `AsyncGitCode` with your custom `http_client` once and pass it through so LLM tool calls reuse the same TLS settings.
|
|
435
432
|
|
|
436
433
|
## Project Status
|
|
437
434
|
|
|
@@ -13,11 +13,11 @@ gitcode_api/models.py,sha256=Yfkn3zj2iEecOockytFS8lCNaYICYdjHdhpsxyaPkDk,4425
|
|
|
13
13
|
gitcode_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
gitcode_api/run_mcp.py,sha256=3_JOrjg9_yL-0M-H-F8mPgxdVKh7K2ggipu7UHeNCg0,147
|
|
15
15
|
gitcode_api/utils.py,sha256=51QmPTQPeNsPSGf2IzhwmiEO1H2GkJrp2A7vkzhOOag,1351
|
|
16
|
-
gitcode_api/version.txt,sha256=
|
|
16
|
+
gitcode_api/version.txt,sha256=EOLhF7AVI4kconGmFa426dXlI0j9fWQvZnJ2AsG43L4,6
|
|
17
17
|
gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
|
|
18
18
|
gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
|
|
19
19
|
gitcode_api/llm/jiuwen.py,sha256=qca2y4544xoRYFOCMbkjiUZZLpJGMcBkK4w5bqs60-4,4276
|
|
20
|
-
gitcode_api/llm/mcp.py,sha256=
|
|
20
|
+
gitcode_api/llm/mcp.py,sha256=Af-B1hgd1hOHx_IxafM8FygBtnd4BAGuw681fGjmBps,5821
|
|
21
21
|
gitcode_api/llm/openai.py,sha256=FSPA0Jv-k4n1Ud92TDfP1TWRlW4FB7smaLwY331nagk,3257
|
|
22
22
|
gitcode_api/resources/__init__.py,sha256=G5Pmi7J_I3APe8k0lJq9jaAP7Hz1JdFm5O1KwEkSIuw,1743
|
|
23
23
|
gitcode_api/resources/_shared/__init__.py,sha256=JcwcLigNx5OxN0wGNEUlEy6baJdEdWfEVv5QVN0-Mo8,496
|
|
@@ -30,7 +30,7 @@ gitcode_api/resources/account/search_resource_group.py,sha256=0xqJUOEFdCnyEA_Ehw
|
|
|
30
30
|
gitcode_api/resources/account/users_resource_group.py,sha256=OJULyX5-yZtx9zPUL0pWiUEOmy2TFq2d27snEafZltY,8977
|
|
31
31
|
gitcode_api/resources/collaboration/__init__.py,sha256=jcH-u9KIgLEThoqKShh7MkBdqKioZ93gNY58hJeTWW0,727
|
|
32
32
|
gitcode_api/resources/collaboration/_helpers.py,sha256=t2OYoMo0_jra4hQIrYRpY88ZZNrZJRe6EiCwOM9t0uU,305
|
|
33
|
-
gitcode_api/resources/collaboration/issues_resource_group.py,sha256=
|
|
33
|
+
gitcode_api/resources/collaboration/issues_resource_group.py,sha256=gpTSTdZ82qWfn9QYTIRbQVUKis-1wjQGvTnDBqL1NzY,31967
|
|
34
34
|
gitcode_api/resources/collaboration/labels_resource_group.py,sha256=TML77N2t_IWO3uoPyQNl-wNVPF7L75syHkdFQa89vSk,9549
|
|
35
35
|
gitcode_api/resources/collaboration/members_resource_group.py,sha256=qd_6fV5bllGMJ-9SDvNDLj_XiGloXsiv27qufboUX5g,6770
|
|
36
36
|
gitcode_api/resources/collaboration/milestones_resource_group.py,sha256=kVnZqWLctQ7J4dlc9Bxe9F_xH_ZcFg0Xt1ThaGiEMgg,7084
|
|
@@ -44,9 +44,9 @@ gitcode_api/resources/repositories/branches_resource_group.py,sha256=dGhd6241Izh
|
|
|
44
44
|
gitcode_api/resources/repositories/commits_resource_group.py,sha256=vqgy_-d7Ec-5w6FKWJ0v6QGbh9mtjnmqm7iZ9P5gBLw,11254
|
|
45
45
|
gitcode_api/resources/repositories/repo_contents_resource_group.py,sha256=pPsEMTU_3kbSNlCRtkHM7dUdzAo3lLxdYleMs1vmLBU,14832
|
|
46
46
|
gitcode_api/resources/repositories/repos_resource_group.py,sha256=kAEdbKODhqsGRmf0ZwL0kTo6s3ujhDJgpzBYJ-b2EX4,46548
|
|
47
|
-
gitcode_api-1.3.
|
|
48
|
-
gitcode_api-1.3.
|
|
49
|
-
gitcode_api-1.3.
|
|
50
|
-
gitcode_api-1.3.
|
|
51
|
-
gitcode_api-1.3.
|
|
52
|
-
gitcode_api-1.3.
|
|
47
|
+
gitcode_api-1.3.1.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
|
|
48
|
+
gitcode_api-1.3.1.dist-info/METADATA,sha256=dbUe8VDA4PDxOC8K0i46ubIgU5HairlccAKmKOgfMcE,22451
|
|
49
|
+
gitcode_api-1.3.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
50
|
+
gitcode_api-1.3.1.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
|
|
51
|
+
gitcode_api-1.3.1.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
|
|
52
|
+
gitcode_api-1.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|