gitcode-api 1.2.16__tar.gz → 1.2.18__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 (51) hide show
  1. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/PKG-INFO +9 -9
  2. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/README.md +1 -1
  3. gitcode_api-1.2.18/gitcode_api/__init__.py +55 -0
  4. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_base_client.py +16 -10
  5. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_cli_banner.py +15 -3
  6. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/cli.py +3 -3
  7. gitcode_api-1.2.18/gitcode_api/constants.py +8 -0
  8. gitcode_api-1.2.18/gitcode_api/py.typed +0 -0
  9. gitcode_api-1.2.18/gitcode_api/version.txt +1 -0
  10. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/PKG-INFO +9 -9
  11. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/SOURCES.txt +1 -0
  12. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/pyproject.toml +9 -9
  13. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_build_manifest.py +5 -24
  14. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_collaboration_templates.py +2 -2
  15. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_resources_misc.py +1 -1
  16. gitcode_api-1.2.16/gitcode_api/__init__.py +0 -25
  17. gitcode_api-1.2.16/gitcode_api/py.typed +0 -1
  18. gitcode_api-1.2.16/gitcode_api/version.txt +0 -1
  19. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/LICENSE +0 -0
  20. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/__main__.py +0 -0
  21. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_base_resource.py +0 -0
  22. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_client.py +0 -0
  23. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_exceptions.py +0 -0
  24. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/_models.py +0 -0
  25. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/llm/__init__.py +0 -0
  26. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/llm/_tool.py +0 -0
  27. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/llm/jiuwen.py +0 -0
  28. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/llm/mcp.py +0 -0
  29. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/llm/openai.py +0 -0
  30. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/__init__.py +0 -0
  31. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/_shared.py +0 -0
  32. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/account.py +0 -0
  33. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/collaboration.py +0 -0
  34. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/misc.py +0 -0
  35. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/resources/repositories.py +0 -0
  36. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/run_mcp.py +0 -0
  37. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api/utils.py +0 -0
  38. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/dependency_links.txt +0 -0
  39. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/entry_points.txt +0 -0
  40. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/requires.txt +0 -0
  41. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/gitcode_api.egg-info/top_level.txt +0 -0
  42. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/setup.cfg +0 -0
  43. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_base_client.py +0 -0
  44. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_cli.py +0 -0
  45. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_client.py +0 -0
  46. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_llm_tools.py +0 -0
  47. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_models.py +0 -0
  48. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_resources_account.py +0 -0
  49. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_resources_collaboration.py +0 -0
  50. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_resources_repositories.py +0 -0
  51. {gitcode_api-1.2.16 → gitcode_api-1.2.18}/tests/test_utils.py +0 -0
@@ -1,16 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.16
3
+ Version: 1.2.18
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
7
- Project-URL: changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
- Project-URL: issues, https://github.com/Trenza1ore/GitCode-API/issues
9
- Project-URL: documentation, https://gitcode-api.readthedocs.io
10
- Project-URL: gitcode, https://gitcode.com/SushiNinja/GitCode-API
11
- Project-URL: github, https://github.com/Trenza1ore/GitCode-API
12
- Project-URL: homepage, https://hugohuang.com/gitcode-api
13
- Project-URL: author, https://hugohuang.com
7
+ Project-URL: Changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
+ Project-URL: Issues, https://github.com/Trenza1ore/GitCode-API/issues
9
+ Project-URL: Documentation, https://gitcode-api.readthedocs.io
10
+ Project-URL: Gitcode, https://gitcode.com/SushiNinja/GitCode-API
11
+ Project-URL: Github, https://github.com/Trenza1ore/GitCode-API
12
+ Project-URL: Homepage, https://hugohuang.com/gitcode-api
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
15
  Classifier: Development Status :: 4 - Beta
16
16
  Classifier: Programming Language :: Python
@@ -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=da2880de93fd4f4e9d40eeb7df479829)](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=d8567ce466b142c6acc4b21bdec35cbd)](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=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)
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
 
@@ -1,6 +1,6 @@
1
1
  # GitCode-API
2
2
 
3
- [![PyPI - Version](https://img.shields.io/pypi/v/gitcode-api?link=https%3A%2F%2Fpypi.org%2Fproject%2Fgitcode-api%2F&uuid=da2880de93fd4f4e9d40eeb7df479829)](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=d8567ce466b142c6acc4b21bdec35cbd)](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)
3
+ [![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)
4
4
  [![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)
5
5
  [![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)
6
6
 
@@ -0,0 +1,55 @@
1
+ """Public package exports for the GitCode SDK."""
2
+
3
+ import re
4
+ from importlib.metadata import PackageNotFoundError, metadata, version
5
+ from typing import cast
6
+
7
+ from . import constants
8
+ from ._client import AsyncGitCode, GitCode
9
+ from ._exceptions import (
10
+ GitCodeAPIError,
11
+ GitCodeConfigurationError,
12
+ GitCodeError,
13
+ GitCodeHTTPStatusError,
14
+ )
15
+ from .utils import as_dict
16
+
17
+ _README_UUIDS = []
18
+ _VERSION_STR = "unknown"
19
+
20
+ try:
21
+ package_meta = metadata("gitcode_api")
22
+ package_desc = cast(str, package_meta.get("Description"))
23
+ _README_UUIDS = re.findall(r"\&uuid=(\w+)", package_desc, flags=re.ASCII)
24
+ _VERSION_STR = version("gitcode_api")
25
+ except PackageNotFoundError:
26
+ from pathlib import Path
27
+
28
+ import tomllib
29
+
30
+ pyproject_toml = Path(__file__).parent.parent / "pyproject.toml"
31
+ if pyproject_toml.exists():
32
+ _VERSION_STR = tomllib.loads(pyproject_toml.read_text(encoding="utf-8")).get("project", {}).get("version", "")
33
+ else:
34
+ version_file = Path(__file__).with_name("version.txt")
35
+ if version_file.exists():
36
+ _VERSION_STR = version_file.read_text(encoding="utf-8").strip()
37
+ read_me_file = pyproject_toml.with_name("README.md")
38
+ if read_me_file.exists():
39
+ _README_UUIDS = re.findall(r"\&uuid=(\w+)", read_me_file.read_text(encoding="utf-8").strip(), flags=re.ASCII)
40
+
41
+ __build_hash__ = _README_UUIDS[0] if _README_UUIDS else "unknown"
42
+ __version__ = _VERSION_STR.strip()
43
+
44
+ __all__ = [
45
+ "constants",
46
+ "__version__",
47
+ "__build_hash__",
48
+ "AsyncGitCode",
49
+ "GitCode",
50
+ "GitCodeAPIError",
51
+ "GitCodeConfigurationError",
52
+ "GitCodeError",
53
+ "GitCodeHTTPStatusError",
54
+ "as_dict",
55
+ ]
@@ -12,11 +12,7 @@ import httpx
12
12
 
13
13
  from ._base_resource import BaseResource
14
14
  from ._exceptions import GitCodeConfigurationError, GitCodeHTTPStatusError
15
-
16
- DEFAULT_BASE_URL = "https://api.gitcode.com/api/v5"
17
- DEFAULT_TIMEOUT = 30.0
18
- DEFAULT_TOKEN_ENV = "GITCODE_ACCESS_TOKEN"
19
- DEFAULT_CA_ENV = "GITCODE_CA_BUNDLE"
15
+ from .constants import DEFAULT_BASE_URL, DEFAULT_CA_ENV, DEFAULT_TIMEOUT, DEFAULT_TOKEN_ENV
20
16
 
21
17
 
22
18
  def _drop_none_values(mapping: Dict[str, Any]) -> Dict[str, Any]:
@@ -24,6 +20,11 @@ def _drop_none_values(mapping: Dict[str, Any]) -> Dict[str, Any]:
24
20
  return {key: value for key, value in mapping.items() if value is not None}
25
21
 
26
22
 
23
+ def _default_decrypt(value: Any) -> str:
24
+ """Dummy decryption function, basically a no-op."""
25
+ return value
26
+
27
+
27
28
  class BaseGitCodeClient:
28
29
  """Base configuration shared by synchronous and asynchronous clients.
29
30
 
@@ -46,19 +47,24 @@ class BaseGitCodeClient:
46
47
  decrypt: Optional[Callable] = None,
47
48
  ) -> None:
48
49
  """Store client configuration and resolve authentication."""
49
- self.api_key = self._resolve_api_key(api_key, decrypt)
50
+ self.decrypt = decrypt or _default_decrypt
51
+ self.api_key = self._resolve_api_key(api_key)
50
52
  self.owner = owner
51
53
  self.repo = repo
52
54
  self.base_url = base_url.rstrip("/")
53
55
  self.timeout = timeout if timeout is not None else DEFAULT_TIMEOUT
54
56
 
55
- def _resolve_api_key(self, api_key: Optional[str], decrypt: Optional[Callable] = None) -> str:
57
+ def _resolve_api_key(self, api_key: Optional[str]) -> str:
56
58
  """Resolve the access token from an argument or environment variable."""
57
59
  token = api_key or os.getenv(DEFAULT_TOKEN_ENV)
58
- if callable(decrypt):
59
- token = decrypt(token)
60
60
  if not token:
61
61
  raise GitCodeConfigurationError("No API key provided. Pass api_key=... or set GITCODE_ACCESS_TOKEN.")
62
+ try:
63
+ token_decrypt = self.decrypt(str(token))
64
+ if not isinstance(token_decrypt, str):
65
+ raise TypeError(f"Decrypted token has type={type(token_decrypt)} instead of str: {token_decrypt}")
66
+ except Exception as e:
67
+ raise GitCodeConfigurationError("Invalid decrypt function, check its correctness.") from e
62
68
  return str(token)
63
69
 
64
70
  def _resolve_repo_context(
@@ -79,7 +85,7 @@ class BaseGitCodeClient:
79
85
  """Build request headers for authenticated JSON API calls."""
80
86
  headers = {
81
87
  "Accept": "application/json",
82
- "Authorization": f"Bearer {self.api_key}",
88
+ "Authorization": f"Bearer {self.decrypt(self.api_key)}",
83
89
  }
84
90
  if extra_headers:
85
91
  headers.update(extra_headers)
@@ -2,6 +2,8 @@
2
2
 
3
3
  import sys
4
4
  from functools import lru_cache
5
+ from importlib.metadata import metadata
6
+ from typing import List, cast
5
7
 
6
8
  # ANSI Colour Codes
7
9
  CREDBG = "\033[41m"
@@ -24,8 +26,18 @@ BANNER = r"""
24
26
 
25
27
 
26
28
  @lru_cache(maxsize=1)
27
- def format_default_welcome(version: str) -> str:
29
+ def format_default_welcome(version: str, build: str) -> str:
28
30
  """Colored banner and version line for the no-arguments launcher (plain if not a TTY)."""
31
+ homepage = "https://gitcode-api.readthedocs.io"
32
+ docspage = "https://gitcode-api.readthedocs.io"
33
+ banner = BANNER
34
+ version = f"Ver. {version} (build {build})"
35
+ for project_url in cast(List[str], metadata("gitcode_api").get_all("Project-URL")):
36
+ if project_url.casefold().startswith("homepage"):
37
+ homepage = project_url.split(", ")[1]
29
38
  if sys.stdout.isatty():
30
- return f"{CRED}{BANNER}{CEND}\n{CBLU} Ver. {version}{CEND}\n\n"
31
- return f"{BANNER}\n Ver. {version}\n\n"
39
+ homepage = f"{CBLU}{homepage}{CEND}"
40
+ docspage = f"{CBLU}{docspage}{CEND}"
41
+ banner = f"{CRED}{BANNER}{CEND}"
42
+ version = f"{CREDBG}{version}{CEND}"
43
+ return f"{banner}\n {version}\n Home Page: {homepage}\n Docs Page: {docspage}\n\n"
@@ -13,7 +13,7 @@ from typing import Any, Dict, List, Optional, Union, get_args, get_origin
13
13
 
14
14
  import httpx
15
15
 
16
- from . import GitCode, __version__
16
+ from . import GitCode, __build_hash__, __version__
17
17
  from ._base_client import DEFAULT_BASE_URL, DEFAULT_TOKEN_ENV
18
18
  from ._cli_banner import format_default_welcome
19
19
  from ._exceptions import GitCodeError
@@ -295,7 +295,7 @@ Each method -h opens with resource.method_signature("<name>") from the Python SD
295
295
  epilog=epilog,
296
296
  formatter_class=_CLIHelpFormatter,
297
297
  )
298
- parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
298
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__} (build {__build_hash__})")
299
299
 
300
300
  client = _probe_gitcode()
301
301
  try:
@@ -457,7 +457,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
457
457
  parser = build_parser()
458
458
  effective = list(sys.argv[1:] if argv is None else argv)
459
459
  if not effective:
460
- print(format_default_welcome(__version__), end="")
460
+ print(format_default_welcome(__version__, __build_hash__), end="")
461
461
  saved_epilog = parser.epilog
462
462
  parser.epilog = None
463
463
  try:
@@ -0,0 +1,8 @@
1
+ """Shared constant values for the GitCode SDK."""
2
+
3
+ DEFAULT_BASE_URL = "https://api.gitcode.com/api/v5"
4
+ DEFAULT_TIMEOUT = 30.0
5
+ DEFAULT_TOKEN_ENV = "GITCODE_ACCESS_TOKEN"
6
+ DEFAULT_CA_ENV = "GITCODE_CA_BUNDLE"
7
+
8
+ __all__ = ["DEFAULT_BASE_URL", "DEFAULT_TIMEOUT", "DEFAULT_TOKEN_ENV", "DEFAULT_CA_ENV"]
File without changes
@@ -0,0 +1 @@
1
+ 1.2.18
@@ -1,16 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.16
3
+ Version: 1.2.18
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
7
- Project-URL: changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
- Project-URL: issues, https://github.com/Trenza1ore/GitCode-API/issues
9
- Project-URL: documentation, https://gitcode-api.readthedocs.io
10
- Project-URL: gitcode, https://gitcode.com/SushiNinja/GitCode-API
11
- Project-URL: github, https://github.com/Trenza1ore/GitCode-API
12
- Project-URL: homepage, https://hugohuang.com/gitcode-api
13
- Project-URL: author, https://hugohuang.com
7
+ Project-URL: Changelog, https://gitcode-api.readthedocs.io/en/latest/changelog.html
8
+ Project-URL: Issues, https://github.com/Trenza1ore/GitCode-API/issues
9
+ Project-URL: Documentation, https://gitcode-api.readthedocs.io
10
+ Project-URL: Gitcode, https://gitcode.com/SushiNinja/GitCode-API
11
+ Project-URL: Github, https://github.com/Trenza1ore/GitCode-API
12
+ Project-URL: Homepage, https://hugohuang.com/gitcode-api
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
15
  Classifier: Development Status :: 4 - Beta
16
16
  Classifier: Programming Language :: Python
@@ -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=da2880de93fd4f4e9d40eeb7df479829)](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=d8567ce466b142c6acc4b21bdec35cbd)](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=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)
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
 
@@ -10,6 +10,7 @@ gitcode_api/_client.py
10
10
  gitcode_api/_exceptions.py
11
11
  gitcode_api/_models.py
12
12
  gitcode_api/cli.py
13
+ gitcode_api/constants.py
13
14
  gitcode_api/py.typed
14
15
  gitcode_api/run_mcp.py
15
16
  gitcode_api/utils.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gitcode-api"
3
- version = "1.2.16"
3
+ version = "1.2.18"
4
4
  description = "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
  keywords = [
6
6
  "gitcode", "git", "devops", "api", "sdk", "python", "httpx", "client",
@@ -79,13 +79,13 @@ dev = [
79
79
  ]
80
80
 
81
81
  [project.urls]
82
- changelog = "https://gitcode-api.readthedocs.io/en/latest/changelog.html"
83
- issues = "https://github.com/Trenza1ore/GitCode-API/issues"
84
- documentation = "https://gitcode-api.readthedocs.io"
85
- gitcode = "https://gitcode.com/SushiNinja/GitCode-API"
86
- github = "https://github.com/Trenza1ore/GitCode-API"
87
- homepage = "https://hugohuang.com/gitcode-api"
88
- author = "https://hugohuang.com"
82
+ Changelog = "https://gitcode-api.readthedocs.io/en/latest/changelog.html"
83
+ Issues = "https://github.com/Trenza1ore/GitCode-API/issues"
84
+ Documentation = "https://gitcode-api.readthedocs.io"
85
+ Gitcode = "https://gitcode.com/SushiNinja/GitCode-API"
86
+ Github = "https://github.com/Trenza1ore/GitCode-API"
87
+ Homepage = "https://hugohuang.com/gitcode-api"
88
+ Author = "https://hugohuang.com"
89
89
 
90
90
  [project.scripts]
91
91
  gitcode-api = "gitcode_api.cli:main"
@@ -94,7 +94,7 @@ gitcode-api = "gitcode_api.cli:main"
94
94
  default-groups = ['dev']
95
95
 
96
96
  [tool.setuptools.package-data]
97
- gitcode_api = ["**/version.txt"]
97
+ gitcode_api = ["version.txt", "py.typed"]
98
98
 
99
99
  [tool.coverage.run]
100
100
  omit = ["tests/*"]
@@ -4,8 +4,6 @@ import importlib.util
4
4
  import json
5
5
  from pathlib import Path
6
6
 
7
- import pytest
8
-
9
7
  ROOT = Path(__file__).resolve().parents[1]
10
8
  _BUILD_MANIFEST_PATH = ROOT / "scripts" / "build_manifest.py"
11
9
  _spec = importlib.util.spec_from_file_location("build_manifest", _BUILD_MANIFEST_PATH)
@@ -24,11 +22,11 @@ license = "MIT"
24
22
  authors = [{ name = "Alice Example", email = "alice@example.com" }]
25
23
 
26
24
  [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"
25
+ Homepage = "https://example.com/home"
26
+ Documentation = "https://example.com/docs"
27
+ Github = "https://github.com/org/demo"
28
+ Author = "https://example.com/~alice"
29
+ Issues = "https://github.com/org/demo/issues"
32
30
  """
33
31
 
34
32
  MINIMAL_TEMPLATE = {
@@ -75,20 +73,3 @@ def test_write_manifest_ensure_ascii_utf8(tmp_path: Path) -> None:
75
73
  text = out.read_text(encoding="utf-8")
76
74
  assert "café" in text
77
75
  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,10 +1,10 @@
1
1
  """Tests for issue/PR ``.gitcode`` template resolution helpers."""
2
2
 
3
+ from typing import Optional
4
+
3
5
  import httpx
4
6
  import pytest
5
- from typing import Optional
6
7
 
7
- from gitcode_api import AsyncGitCode
8
8
  from gitcode_api._exceptions import GitCodeHTTPStatusError
9
9
 
10
10
  # ``_resolution_sources_*`` probes ``GET /repos/{owner}/{repo}`` for every candidate; stub these.
@@ -71,7 +71,7 @@ def test_releases_create_posts_documented_payload_and_models_assets(sync_client_
71
71
  client, http_client = sync_client_factory(handler, owner="SushiNinja", repo="GitCode-API")
72
72
  try:
73
73
  release = client.releases.create(
74
- tag_name="v1.0.0",
74
+ tag="v1.0.0",
75
75
  name="v1.0.0",
76
76
  body="Release notes",
77
77
  target_commitish="main",
@@ -1,25 +0,0 @@
1
- """Public package exports for the GitCode SDK."""
2
-
3
- from pathlib import Path
4
-
5
- from ._client import AsyncGitCode, GitCode
6
- from ._exceptions import (
7
- GitCodeAPIError,
8
- GitCodeConfigurationError,
9
- GitCodeError,
10
- GitCodeHTTPStatusError,
11
- )
12
- from .utils import as_dict
13
-
14
- __version__ = (Path(__file__).parent / "version.txt").read_text().strip()
15
-
16
- __all__ = [
17
- "__version__",
18
- "AsyncGitCode",
19
- "GitCode",
20
- "GitCodeAPIError",
21
- "GitCodeConfigurationError",
22
- "GitCodeError",
23
- "GitCodeHTTPStatusError",
24
- "as_dict",
25
- ]
@@ -1 +0,0 @@
1
- partial
@@ -1 +0,0 @@
1
- 1.2.16
File without changes
File without changes