gitcode-api 1.2.17__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.
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/PKG-INFO +9 -9
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/README.md +1 -1
- gitcode_api-1.2.18/gitcode_api/__init__.py +55 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_base_client.py +15 -5
- gitcode_api-1.2.18/gitcode_api/py.typed +0 -0
- gitcode_api-1.2.18/gitcode_api/version.txt +1 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/PKG-INFO +9 -9
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/pyproject.toml +9 -9
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_build_manifest.py +5 -24
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_resources_misc.py +1 -1
- gitcode_api-1.2.17/gitcode_api/__init__.py +0 -34
- gitcode_api-1.2.17/gitcode_api/py.typed +0 -1
- gitcode_api-1.2.17/gitcode_api/version.txt +0 -1
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/LICENSE +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/__main__.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_base_resource.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_cli_banner.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_client.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_exceptions.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/_models.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/cli.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/constants.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/llm/__init__.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/llm/_tool.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/llm/jiuwen.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/llm/mcp.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/llm/openai.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/__init__.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/_shared.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/account.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/collaboration.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/misc.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/resources/repositories.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/run_mcp.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api/utils.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/SOURCES.txt +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/dependency_links.txt +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/entry_points.txt +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/requires.txt +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/gitcode_api.egg-info/top_level.txt +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/setup.cfg +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_base_client.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_cli.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_client.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_collaboration_templates.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_llm_tools.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_models.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_resources_account.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_resources_collaboration.py +0 -0
- {gitcode_api-1.2.17 → gitcode_api-1.2.18}/tests/test_resources_repositories.py +0 -0
- {gitcode_api-1.2.17 → 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.
|
|
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:
|
|
8
|
-
Project-URL:
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
Project-URL:
|
|
12
|
-
Project-URL:
|
|
13
|
-
Project-URL:
|
|
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
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api) [](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
|
|
41
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
42
|
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API)
|
|
43
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitCode-API
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api) [](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
|
|
4
4
|
[](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)
|
|
5
5
|
[](https://github.com/Trenza1ore/GitCode-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
|
+
]
|
|
@@ -20,6 +20,11 @@ def _drop_none_values(mapping: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
20
20
|
return {key: value for key, value in mapping.items() if value is not None}
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
def _default_decrypt(value: Any) -> str:
|
|
24
|
+
"""Dummy decryption function, basically a no-op."""
|
|
25
|
+
return value
|
|
26
|
+
|
|
27
|
+
|
|
23
28
|
class BaseGitCodeClient:
|
|
24
29
|
"""Base configuration shared by synchronous and asynchronous clients.
|
|
25
30
|
|
|
@@ -42,19 +47,24 @@ class BaseGitCodeClient:
|
|
|
42
47
|
decrypt: Optional[Callable] = None,
|
|
43
48
|
) -> None:
|
|
44
49
|
"""Store client configuration and resolve authentication."""
|
|
45
|
-
self.
|
|
50
|
+
self.decrypt = decrypt or _default_decrypt
|
|
51
|
+
self.api_key = self._resolve_api_key(api_key)
|
|
46
52
|
self.owner = owner
|
|
47
53
|
self.repo = repo
|
|
48
54
|
self.base_url = base_url.rstrip("/")
|
|
49
55
|
self.timeout = timeout if timeout is not None else DEFAULT_TIMEOUT
|
|
50
56
|
|
|
51
|
-
def _resolve_api_key(self, api_key: Optional[str]
|
|
57
|
+
def _resolve_api_key(self, api_key: Optional[str]) -> str:
|
|
52
58
|
"""Resolve the access token from an argument or environment variable."""
|
|
53
59
|
token = api_key or os.getenv(DEFAULT_TOKEN_ENV)
|
|
54
|
-
if callable(decrypt):
|
|
55
|
-
token = decrypt(token)
|
|
56
60
|
if not token:
|
|
57
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
|
|
58
68
|
return str(token)
|
|
59
69
|
|
|
60
70
|
def _resolve_repo_context(
|
|
@@ -75,7 +85,7 @@ class BaseGitCodeClient:
|
|
|
75
85
|
"""Build request headers for authenticated JSON API calls."""
|
|
76
86
|
headers = {
|
|
77
87
|
"Accept": "application/json",
|
|
78
|
-
"Authorization": f"Bearer {self.api_key}",
|
|
88
|
+
"Authorization": f"Bearer {self.decrypt(self.api_key)}",
|
|
79
89
|
}
|
|
80
90
|
if extra_headers:
|
|
81
91
|
headers.update(extra_headers)
|
|
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.
|
|
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:
|
|
8
|
-
Project-URL:
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
Project-URL:
|
|
12
|
-
Project-URL:
|
|
13
|
-
Project-URL:
|
|
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
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api) [](https://www.codefactor.io/repository/github/trenza1ore/gitcode-api)
|
|
41
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
42
|
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API)
|
|
43
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gitcode-api"
|
|
3
|
-
version = "1.2.
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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 = ["
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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)
|
|
@@ -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
|
-
|
|
74
|
+
tag="v1.0.0",
|
|
75
75
|
name="v1.0.0",
|
|
76
76
|
body="Release notes",
|
|
77
77
|
target_commitish="main",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Public package exports for the GitCode SDK."""
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
from importlib.metadata import metadata
|
|
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
|
-
package_meta = metadata("gitcode_api")
|
|
18
|
-
package_desc = cast(str, package_meta.get("Description"))
|
|
19
|
-
readme_uuids = re.findall(r"\&uuid=(\w+)", package_desc, flags=re.ASCII)
|
|
20
|
-
__build_hash__ = readme_uuids[0] if readme_uuids else "unknown"
|
|
21
|
-
__version__ = cast(str, package_meta.get("Version")).strip()
|
|
22
|
-
|
|
23
|
-
__all__ = [
|
|
24
|
-
"constants",
|
|
25
|
-
"__version__",
|
|
26
|
-
"__build_hash__",
|
|
27
|
-
"AsyncGitCode",
|
|
28
|
-
"GitCode",
|
|
29
|
-
"GitCodeAPIError",
|
|
30
|
-
"GitCodeConfigurationError",
|
|
31
|
-
"GitCodeError",
|
|
32
|
-
"GitCodeHTTPStatusError",
|
|
33
|
-
"as_dict",
|
|
34
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
partial
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.2.17
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|