gitcode-api 1.2.7__tar.gz → 1.2.8__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 (44) hide show
  1. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/PKG-INFO +6 -1
  2. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/README.md +2 -0
  3. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/cli.py +0 -1
  4. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/llm/_tool.py +2 -4
  5. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/llm/mcp.py +2 -6
  6. gitcode_api-1.2.8/gitcode_api/run_mcp.py +6 -0
  7. gitcode_api-1.2.8/gitcode_api/version.txt +1 -0
  8. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/PKG-INFO +6 -1
  9. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/SOURCES.txt +2 -0
  10. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/pyproject.toml +4 -1
  11. gitcode_api-1.2.8/tests/test_build_manifest.py +94 -0
  12. gitcode_api-1.2.7/gitcode_api/version.txt +0 -1
  13. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/LICENSE +0 -0
  14. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/__init__.py +0 -0
  15. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/__main__.py +0 -0
  16. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_base_client.py +0 -0
  17. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_base_resource.py +0 -0
  18. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_cli_banner.py +0 -0
  19. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_client.py +0 -0
  20. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_exceptions.py +0 -0
  21. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/_models.py +0 -0
  22. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/llm/__init__.py +0 -0
  23. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/llm/openai.py +0 -0
  24. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/py.typed +0 -0
  25. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/__init__.py +0 -0
  26. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/_shared.py +0 -0
  27. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/account.py +0 -0
  28. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/collaboration.py +0 -0
  29. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/misc.py +0 -0
  30. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api/resources/repositories.py +0 -0
  31. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/dependency_links.txt +0 -0
  32. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/entry_points.txt +0 -0
  33. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/requires.txt +0 -0
  34. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/gitcode_api.egg-info/top_level.txt +0 -0
  35. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/setup.cfg +0 -0
  36. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_base_client.py +0 -0
  37. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_cli.py +0 -0
  38. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_client.py +0 -0
  39. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_llm_tools.py +1 -1
  40. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_models.py +0 -0
  41. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_resources_account.py +0 -0
  42. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_resources_collaboration.py +0 -0
  43. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_resources_misc.py +0 -0
  44. {gitcode_api-1.2.7 → gitcode_api-1.2.8}/tests/test_resources_repositories.py +0 -0
@@ -1,13 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.7
3
+ Version: 1.2.8
4
4
  Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP and OpenAI tool) for agents. Community-maintained.
5
5
  Author-email: Hugo Huang <hugo@hugohuang.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
+ Project-URL: issues, https://github.com/Trenza1ore/GitCode-API/issues
8
9
  Project-URL: documentation, https://gitcode-api.readthedocs.io
9
10
  Project-URL: gitcode, https://gitcode.com/SushiNinja/GitCode-API
10
11
  Project-URL: github, https://github.com/Trenza1ore/GitCode-API
12
+ Project-URL: homepage, https://linktr.ee/Hugoooo
13
+ Project-URL: author, https://hugohuang.com
11
14
  Keywords: gitcode,git,devops,api,sdk,python,httpx,client,mcp,agent,fastmcp,llm,mcp client,mcp server,model context protocol
12
15
  Classifier: Development Status :: 4 - Beta
13
16
  Classifier: Programming Language :: Python
@@ -312,6 +315,8 @@ The same server is available from the CLI as `gitcode-api serve` (see the [CLI](
312
315
 
313
316
  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`.
314
317
 
318
+ **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`).
319
+
315
320
  ## Examples
316
321
 
317
322
  Runnable examples live in `examples/`:
@@ -278,6 +278,8 @@ The same server is available from the CLI as `gitcode-api serve` (see the [CLI](
278
278
 
279
279
  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`.
280
280
 
281
+ **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`).
282
+
281
283
  ## Examples
282
284
 
283
285
  Runnable examples live in `examples/`:
@@ -1,7 +1,6 @@
1
1
  """Command-line interface for the GitCode SDK."""
2
2
 
3
3
  import argparse
4
- import asyncio
5
4
  import inspect
6
5
  import json
7
6
  import re
@@ -3,9 +3,9 @@
3
3
  import base64
4
4
  import inspect
5
5
  import logging
6
+ import os
6
7
  from collections.abc import Mapping
7
8
  from functools import lru_cache
8
- import os
9
9
  from typing import Any, Callable, Dict, Optional, Tuple
10
10
 
11
11
  from gitcode_api import (
@@ -38,9 +38,7 @@ MCP_SERVER_INSTRUCTIONS = (
38
38
  "Successful results are JSON-serializable. Raw bytes from endpoints such as contents.get_raw are "
39
39
  'returned as {"encoding": "base64", "data": "<ascii>"}.\n'
40
40
  'Failures are objects with "error": true and a "message" string.\n\n'
41
- "Valid op_type values for this client version:\n- "
42
- + "\n- ".join(OP_TYPE_ENUM)
43
- + "\n\n"
41
+ "Valid op_type values for this client version:\n- " + "\n- ".join(OP_TYPE_ENUM) + "\n\n"
44
42
  "Optional MCP resources (read without calling the tool):\n"
45
43
  "- gitcode-api://help — markdown index of help URIs\n"
46
44
  "- gitcode-api://help/{op_type} — plain-text method list for that client resource\n"
@@ -89,9 +89,7 @@ def register_mcp_help_resources(mcp: Union["FastMCP", Any]) -> None:
89
89
  @mcp.resource(
90
90
  "gitcode-api://help/{op_type}",
91
91
  name="gitcode_api_op_type_help",
92
- description=(
93
- "Method list for one op_type (same as gitcode_api_tool with help=true and empty action)."
94
- ),
92
+ description=("Method list for one op_type (same as gitcode_api_tool with help=true and empty action)."),
95
93
  mime_type="text/plain",
96
94
  )
97
95
  async def _op_type_help_resource(op_type: str) -> str:
@@ -132,9 +130,7 @@ class GitCodeMCP:
132
130
  return getattr(self.mcp, name)
133
131
 
134
132
 
135
- def create_mcp_server(
136
- name: str = "GitCode API", tool: Optional[GitCodeLLMTool] = None, **kwargs: Any
137
- ) -> "FastMCP":
133
+ def create_mcp_server(name: str = "GitCode API", tool: Optional[GitCodeLLMTool] = None, **kwargs: Any) -> "FastMCP":
138
134
  """Create a FastMCP server with the GitCode API tool already registered.
139
135
 
140
136
  :param name: MCP server display name.
@@ -0,0 +1,6 @@
1
+ """Directly run GitCodeMCP."""
2
+
3
+ from gitcode_api.llm.mcp import GitCodeMCP
4
+
5
+ if __name__ == "__main__":
6
+ GitCodeMCP().mcp.run()
@@ -0,0 +1 @@
1
+ 1.2.8
@@ -1,13 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.7
3
+ Version: 1.2.8
4
4
  Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP and OpenAI tool) for agents. Community-maintained.
5
5
  Author-email: Hugo Huang <hugo@hugohuang.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
+ Project-URL: issues, https://github.com/Trenza1ore/GitCode-API/issues
8
9
  Project-URL: documentation, https://gitcode-api.readthedocs.io
9
10
  Project-URL: gitcode, https://gitcode.com/SushiNinja/GitCode-API
10
11
  Project-URL: github, https://github.com/Trenza1ore/GitCode-API
12
+ Project-URL: homepage, https://linktr.ee/Hugoooo
13
+ Project-URL: author, https://hugohuang.com
11
14
  Keywords: gitcode,git,devops,api,sdk,python,httpx,client,mcp,agent,fastmcp,llm,mcp client,mcp server,model context protocol
12
15
  Classifier: Development Status :: 4 - Beta
13
16
  Classifier: Programming Language :: Python
@@ -312,6 +315,8 @@ The same server is available from the CLI as `gitcode-api serve` (see the [CLI](
312
315
 
313
316
  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`.
314
317
 
318
+ **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`).
319
+
315
320
  ## Examples
316
321
 
317
322
  Runnable examples live in `examples/`:
@@ -11,6 +11,7 @@ gitcode_api/_exceptions.py
11
11
  gitcode_api/_models.py
12
12
  gitcode_api/cli.py
13
13
  gitcode_api/py.typed
14
+ gitcode_api/run_mcp.py
14
15
  gitcode_api/version.txt
15
16
  gitcode_api.egg-info/PKG-INFO
16
17
  gitcode_api.egg-info/SOURCES.txt
@@ -29,6 +30,7 @@ gitcode_api/resources/collaboration.py
29
30
  gitcode_api/resources/misc.py
30
31
  gitcode_api/resources/repositories.py
31
32
  tests/test_base_client.py
33
+ tests/test_build_manifest.py
32
34
  tests/test_cli.py
33
35
  tests/test_client.py
34
36
  tests/test_llm_tools.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gitcode-api"
3
- version = "1.2.7"
3
+ version = "1.2.8"
4
4
  description = "Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP and OpenAI tool) for agents. Community-maintained."
5
5
  keywords = [
6
6
  "gitcode", "git", "devops", "api", "sdk", "python", "httpx", "client",
@@ -72,9 +72,12 @@ dev = [{ include-group = "test" }, { include-group = "format" }, { include-group
72
72
 
73
73
  [project.urls]
74
74
  changelog = "https://gitcode-api.readthedocs.io/en/latest/changelog.html"
75
+ issues = "https://github.com/Trenza1ore/GitCode-API/issues"
75
76
  documentation = "https://gitcode-api.readthedocs.io"
76
77
  gitcode = "https://gitcode.com/SushiNinja/GitCode-API"
77
78
  github = "https://github.com/Trenza1ore/GitCode-API"
79
+ homepage = "https://linktr.ee/Hugoooo"
80
+ author = "https://hugohuang.com"
78
81
 
79
82
  [project.scripts]
80
83
  gitcode-api = "gitcode_api.cli:main"
@@ -0,0 +1,94 @@
1
+ """Offline tests for ``scripts/build_manifest.py``."""
2
+
3
+ import importlib.util
4
+ import json
5
+ from pathlib import Path
6
+
7
+ import pytest
8
+
9
+ ROOT = Path(__file__).resolve().parents[1]
10
+ _BUILD_MANIFEST_PATH = ROOT / "scripts" / "build_manifest.py"
11
+ _spec = importlib.util.spec_from_file_location("build_manifest", _BUILD_MANIFEST_PATH)
12
+ assert _spec and _spec.loader
13
+ _build_manifest = importlib.util.module_from_spec(_spec)
14
+ _spec.loader.exec_module(_build_manifest)
15
+
16
+
17
+ MINIMAL_PYPROJECT = b"""\
18
+ [project]
19
+ name = "demo-pkg"
20
+ version = "9.8.7"
21
+ description = "Demo description line."
22
+ keywords = ["alpha", "beta"]
23
+ license = "MIT"
24
+ authors = [{ name = "Alice Example", email = "alice@example.com" }]
25
+
26
+ [project.urls]
27
+ homepage = "https://example.com/home"
28
+ documentation = "https://example.com/docs"
29
+ github = "https://github.com/org/demo"
30
+ author = "https://example.com/~alice"
31
+ issues = "https://github.com/org/demo/issues"
32
+ """
33
+
34
+ MINIMAL_TEMPLATE = {
35
+ "version": "{{VERSION}}",
36
+ "description": "Static manifest description (not from pyproject placeholders).",
37
+ "author": {
38
+ "name": "{{AUTHOR_NAME}}",
39
+ "email": "{{AUTHOR_EMAIL}}",
40
+ "url": "{{AUTHOR_URL}}",
41
+ },
42
+ "homepage": "{{HOMEPAGE}}",
43
+ "documentation": "{{DOCUMENTATION}}",
44
+ "support": "{{SUPPORT}}",
45
+ "repository": {"type": "git", "url": "{{REPOSITORY_URL}}"},
46
+ "keywords": [],
47
+ "license": "",
48
+ }
49
+
50
+
51
+ def test_build_manifest_dict_substitutes_and_lists(tmp_path: Path) -> None:
52
+ pyproject_path = tmp_path / "pyproject.toml"
53
+ pyproject_path.write_bytes(MINIMAL_PYPROJECT)
54
+ template_path = tmp_path / "manifest.in.json"
55
+ template_path.write_text(json.dumps(MINIMAL_TEMPLATE), encoding="utf-8")
56
+
57
+ manifest = _build_manifest.build_manifest_dict(pyproject_path, template_path)
58
+
59
+ assert manifest["version"] == "9.8.7"
60
+ assert manifest["description"] == "Static manifest description (not from pyproject placeholders)."
61
+ assert manifest["author"]["name"] == "Alice Example"
62
+ assert manifest["author"]["email"] == "alice@example.com"
63
+ assert manifest["author"]["url"] == "https://example.com/~alice"
64
+ assert manifest["homepage"] == "https://example.com/home"
65
+ assert manifest["documentation"] == "https://example.com/docs"
66
+ assert manifest["support"] == "https://github.com/org/demo/issues"
67
+ assert manifest["repository"]["url"] == "https://github.com/org/demo"
68
+ assert manifest["keywords"] == ["alpha", "beta"]
69
+ assert manifest["license"] == "MIT"
70
+
71
+
72
+ def test_write_manifest_ensure_ascii_utf8(tmp_path: Path) -> None:
73
+ out = tmp_path / "out.json"
74
+ _build_manifest.write_manifest({"note": "café"}, out)
75
+ text = out.read_text(encoding="utf-8")
76
+ assert "café" in text
77
+ assert text.endswith("\n")
78
+
79
+
80
+ def test_missing_github_raises(tmp_path: Path) -> None:
81
+ bad = b"""\
82
+ [project]
83
+ name = "x"
84
+ version = "1"
85
+ description = "d"
86
+ authors = [{ name = "A", email = "a@b.c" }]
87
+ """
88
+ pyproject_path = tmp_path / "pyproject.toml"
89
+ pyproject_path.write_bytes(bad)
90
+ template_path = tmp_path / "manifest.in.json"
91
+ template_path.write_text(json.dumps(MINIMAL_TEMPLATE), encoding="utf-8")
92
+
93
+ with pytest.raises(ValueError, match="github"):
94
+ _build_manifest.build_manifest_dict(pyproject_path, template_path)
@@ -1 +0,0 @@
1
- 1.2.7
File without changes
File without changes
@@ -10,9 +10,9 @@ from gitcode_api.llm import (
10
10
  register_mcp_gitcode_api_tool,
11
11
  )
12
12
  from gitcode_api.llm._tool import (
13
- GitCodeLLMTool,
14
13
  MCP_SERVER_INSTRUCTIONS,
15
14
  OP_TYPE_ENUM,
15
+ GitCodeLLMTool,
16
16
  help_resource_index_body,
17
17
  op_type_help_resource_body,
18
18
  )