codeocean 0.17.0__tar.gz → 0.18.0__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.
- {codeocean-0.17.0 → codeocean-0.18.0}/CHANGELOG.md +3 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/PKG-INFO +1 -1
- {codeocean-0.17.0 → codeocean-0.18.0}/pyproject.toml +1 -1
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/client.py +5 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/test_client.py +26 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/.flake8 +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/.gitignore +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/LICENSE +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/README.md +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/RELEASE.md +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/examples/create_data_asset.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/examples/run_capsule.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/examples/run_pipeline.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/__init__.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/capsule.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/components.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/computation.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/custom_metadata.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/data_asset.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/enum.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/error.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/__init__.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/capsule.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/components.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/computation.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/data_asset.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/models/folder.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/src/codeocean/pipeline.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/__init__.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/test_error.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/test_git_sync.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/test_package.py +0 -0
- {codeocean-0.17.0 → codeocean-0.18.0}/tests/test_release.py +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
CHANGELOG
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## 0.18.0 (2026-11-23)
|
|
5
|
+
- [#81](https://github.com/codeocean/codeocean-sdk-python/pull/81) feat: add agent_session_id to send Agent-Session-Id header
|
|
6
|
+
|
|
4
7
|
## 0.17.0 (2026-09-09)
|
|
5
8
|
- [#75](https://github.com/codeocean/codeocean-sdk-python/pull/75) feat: add public release capsule/pipeline API
|
|
6
9
|
- **Minimum Code Ocean platform version updated to `4.8.0`.**
|
|
@@ -30,12 +30,15 @@ class CodeOcean:
|
|
|
30
30
|
(number of retries) or a urllib3.util.Retry object for advanced
|
|
31
31
|
retry configuration. Defaults to 0 (no retries)
|
|
32
32
|
agent_id: Optional agent identifier for tracking AI agent API usage on behalf of users
|
|
33
|
+
agent_session_id: Optional agent session identifier for tagging resources an AI agent
|
|
34
|
+
creates during a session
|
|
33
35
|
"""
|
|
34
36
|
|
|
35
37
|
domain: str
|
|
36
38
|
token: str
|
|
37
39
|
retries: Optional[Retry | int] = 0
|
|
38
40
|
agent_id: Optional[str] = None
|
|
41
|
+
agent_session_id: Optional[str] = None
|
|
39
42
|
|
|
40
43
|
# Minimum server version required by this SDK
|
|
41
44
|
MIN_SERVER_VERSION = "4.8.0"
|
|
@@ -49,6 +52,8 @@ class CodeOcean:
|
|
|
49
52
|
})
|
|
50
53
|
if self.agent_id:
|
|
51
54
|
self.session.headers.update({"Agent-Id": self.agent_id})
|
|
55
|
+
if self.agent_session_id:
|
|
56
|
+
self.session.headers.update({"Agent-Session-Id": self.agent_session_id})
|
|
52
57
|
self.session.hooks["response"] = [self._error_handler]
|
|
53
58
|
self.session.mount(self.domain, TCPKeepAliveAdapter(max_retries=self.retries))
|
|
54
59
|
|
|
@@ -13,6 +13,7 @@ class TestClient(unittest.TestCase):
|
|
|
13
13
|
self.test_domain = "https://codeocean.acme.com"
|
|
14
14
|
self.test_token = "test_token_123"
|
|
15
15
|
self.test_agent_id = "test_agent_456"
|
|
16
|
+
self.test_agent_session_id = "6f1c2a3e-8b4d-4e5f-9a6b-7c8d9e0f1a2b"
|
|
16
17
|
|
|
17
18
|
def test_basic_init(self):
|
|
18
19
|
"""Test a basic client initialization."""
|
|
@@ -81,3 +82,28 @@ class TestClient(unittest.TestCase):
|
|
|
81
82
|
# Verify the session headers are correctly configured
|
|
82
83
|
headers = client.session.headers
|
|
83
84
|
self.assertNotIn("Agent-Id", headers)
|
|
85
|
+
|
|
86
|
+
def test_agent_session_id_header_set_when_provided(self):
|
|
87
|
+
"""Test that Agent-Session-Id header is set when agent_session_id is provided."""
|
|
88
|
+
client = CodeOcean(
|
|
89
|
+
domain=self.test_domain,
|
|
90
|
+
token=self.test_token,
|
|
91
|
+
agent_session_id=self.test_agent_session_id,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Verify the session headers are correctly configured
|
|
95
|
+
headers = client.session.headers
|
|
96
|
+
self.assertIn("Agent-Session-Id", headers)
|
|
97
|
+
self.assertEqual(headers["Agent-Session-Id"], self.test_agent_session_id)
|
|
98
|
+
|
|
99
|
+
def test_agent_session_id_header_not_set_when_none(self):
|
|
100
|
+
"""Test that Agent-Session-Id header is not set when agent_session_id is None."""
|
|
101
|
+
client = CodeOcean(
|
|
102
|
+
domain=self.test_domain,
|
|
103
|
+
token=self.test_token,
|
|
104
|
+
agent_session_id=None,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Verify the session headers are correctly configured
|
|
108
|
+
headers = client.session.headers
|
|
109
|
+
self.assertNotIn("Agent-Session-Id", headers)
|
|
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
|