cineon-api-format 3.0.0__tar.gz → 3.3.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.
- cineon_api_format-3.3.0/.env.example +1 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/.github/workflows/main.yml +12 -0
- cineon_api_format-3.3.0/.github/workflows/publish.yml +26 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/.gitignore +3 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/PKG-INFO +2 -2
- cineon_api_format-3.3.0/badges/coverage.svg +1 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/badges/version.svg +4 -4
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/pyproject.toml +7 -2
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/scripts/badges.sh +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/scripts/format.sh +0 -0
- cineon_api_format-3.3.0/scripts/publish.sh +32 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/scripts/test.sh +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/src/cineon_api_format/__init__.py +2 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/src/cineon_api_format/requests.py +10 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/src/cineon_api_format/responses.py +6 -1
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/tests/test_all.py +36 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/uv.lock +1 -1
- cineon_api_format-3.0.0/badges/coverage.svg +0 -1
- cineon_api_format-3.0.0/scripts/publish.sh +0 -15
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/.githooks/pre-push +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/.python-version +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/README.md +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/badges/complexity.svg +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/scripts/badges/complexity.py +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/scripts/badges/version.py +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/src/cineon_api_format/definitions.py +0 -0
- {cineon_api_format-3.0.0 → cineon_api_format-3.3.0}/src/cineon_api_format/version.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PYPI_TOKEN=
|
|
@@ -16,12 +16,18 @@ jobs:
|
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v4
|
|
19
|
+
- uses: "google-github-actions/auth@v3"
|
|
20
|
+
with:
|
|
21
|
+
credentials_json: "${{ secrets.CINEON_REGISTRY_READER_CREDENTIALS }}"
|
|
19
22
|
- name: Set up Python
|
|
20
23
|
uses: actions/setup-python@v5
|
|
21
24
|
with:
|
|
22
25
|
python-version-file: ".python-version"
|
|
23
26
|
- name: Install the latest version of uv
|
|
24
27
|
uses: astral-sh/setup-uv@v6
|
|
28
|
+
- name: Install keyring for Google Artifact Registry
|
|
29
|
+
run: |
|
|
30
|
+
uv tool install keyring --with keyrings.google-artifactregistry-auth
|
|
25
31
|
- name: Set up shfmt
|
|
26
32
|
uses: mfinelli/setup-shfmt@v3
|
|
27
33
|
- name: Check formatting
|
|
@@ -35,12 +41,18 @@ jobs:
|
|
|
35
41
|
|
|
36
42
|
steps:
|
|
37
43
|
- uses: actions/checkout@v4
|
|
44
|
+
- uses: "google-github-actions/auth@v3"
|
|
45
|
+
with:
|
|
46
|
+
credentials_json: "${{ secrets.CINEON_REGISTRY_READER_CREDENTIALS }}"
|
|
38
47
|
- name: Set up Python
|
|
39
48
|
uses: actions/setup-python@v5
|
|
40
49
|
with:
|
|
41
50
|
python-version-file: ".python-version"
|
|
42
51
|
- name: Install the latest version of uv
|
|
43
52
|
uses: astral-sh/setup-uv@v6
|
|
53
|
+
- name: Install keyring for Google Artifact Registry
|
|
54
|
+
run: |
|
|
55
|
+
uv tool install keyring --with keyrings.google-artifactregistry-auth
|
|
44
56
|
- name: Run tests
|
|
45
57
|
run: |
|
|
46
58
|
scripts/test.sh
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: "Publish"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
name: Publish package
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v5
|
|
14
|
+
- name: Authenticate to Google Cloud
|
|
15
|
+
uses: "google-github-actions/auth@v3"
|
|
16
|
+
with:
|
|
17
|
+
credentials_json: "${{ secrets.CINEON_REGISTRY_PUBLISHER_CREDENTIALS }}"
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v6
|
|
20
|
+
- name: Install Python 3.12
|
|
21
|
+
run: uv python install 3.12
|
|
22
|
+
- name: Install keyring for Google Artifact Registry
|
|
23
|
+
run: |
|
|
24
|
+
uv tool install keyring --with keyrings.google-artifactregistry-auth
|
|
25
|
+
- name: Publish
|
|
26
|
+
run: ./scripts/publish.sh
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cineon-api-format
|
|
3
|
-
Version: 3.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: Types used by the ELE API, and other Cineon APIs.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Requires-Dist: cineon-format<4,>=3.0.0
|
|
7
7
|
Requires-Dist: pydantic>=2.12.5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 97.44%"><title>coverage: 97.44%</title><filter id="blur"><feGaussianBlur stdDeviation="16"/></filter><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4b0"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><g transform="scale(.1)"><g aria-hidden="true" fill="#010101"><text x="315" y="150" fill-opacity=".8" filter="url(#blur)" textLength="510">coverage</text><text x="315" y="150" fill-opacity=".3" textLength="510">coverage</text></g><text x="315" y="140" textLength="510">coverage</text></g><g transform="scale(.1)"><g aria-hidden="true" fill="#010101"><text x="865" y="150" fill-opacity=".8" filter="url(#blur)" textLength="430">97.44%</text><text x="865" y="150" fill-opacity=".3" textLength="430">97.44%</text></g><text x="865" y="140" textLength="430">97.44%</text></g></g></svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="version:
|
|
2
|
-
<title>version:
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="version: 3.3.0">
|
|
2
|
+
<title>version: 3.3.0</title>
|
|
3
3
|
<linearGradient id="s" x2="0" y2="100%">
|
|
4
4
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
|
5
5
|
<stop offset="1" stop-opacity=".1"/>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
|
|
16
16
|
<text aria-hidden="true" x="265.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text>
|
|
17
17
|
<text x="265.0" y="140" transform="scale(.1)" fill="#fff" textLength="410">version</text>
|
|
18
|
-
<text aria-hidden="true" x="695.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">
|
|
19
|
-
<text x="695.0" y="140" transform="scale(.1)" fill="#fff" textLength="290">
|
|
18
|
+
<text aria-hidden="true" x="695.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">3.3.0</text>
|
|
19
|
+
<text x="695.0" y="140" transform="scale(.1)" fill="#fff" textLength="290">3.3.0</text>
|
|
20
20
|
</g>
|
|
21
21
|
</svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cineon-api-format"
|
|
3
|
-
version = "3.
|
|
4
|
-
description = "
|
|
3
|
+
version = "3.3.0"
|
|
4
|
+
description = "Types used by the ELE API, and other Cineon APIs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
dependencies = [
|
|
@@ -41,5 +41,10 @@ publish-url = "https://europe-west2-python.pkg.dev/elengine-463909/cineon-regist
|
|
|
41
41
|
authenticate = "always"
|
|
42
42
|
explicit = true
|
|
43
43
|
|
|
44
|
+
[[tool.uv.index]]
|
|
45
|
+
name = "pypi"
|
|
46
|
+
url = "https://pypi.org/simple/"
|
|
47
|
+
publish-url = "https://upload.pypi.org/legacy/"
|
|
48
|
+
|
|
44
49
|
[tool.hatch.build.targets.wheel]
|
|
45
50
|
packages = ["src/cineon_api_format"]
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Ensure that the script exits if any commands fail
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
if [ -f .env ]; then
|
|
7
|
+
source .env
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
TARGET="${1:-cineon-registry}"
|
|
11
|
+
|
|
12
|
+
# Build the package
|
|
13
|
+
uv build
|
|
14
|
+
|
|
15
|
+
# Publish to the specified index
|
|
16
|
+
case "$TARGET" in
|
|
17
|
+
cineon-registry)
|
|
18
|
+
uv publish --index cineon-registry \
|
|
19
|
+
--username oauth2accesstoken \
|
|
20
|
+
--keyring-provider subprocess
|
|
21
|
+
;;
|
|
22
|
+
pypi)
|
|
23
|
+
uv publish --index pypi --token "$PYPI_TOKEN"
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
echo "Unknown target: $TARGET (use 'cineon-registry' or 'pypi')" >&2
|
|
27
|
+
exit 1
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
|
|
31
|
+
# Clean up built distributions
|
|
32
|
+
rm -f dist/*.tar.gz dist/*.whl
|
|
File without changes
|
|
@@ -3,6 +3,7 @@ from .requests import (
|
|
|
3
3
|
CineonInferenceRequest,
|
|
4
4
|
ClientInfo,
|
|
5
5
|
InferenceRequest,
|
|
6
|
+
ModelRecalculateRequest,
|
|
6
7
|
)
|
|
7
8
|
from .responses import (
|
|
8
9
|
InferenceOutput,
|
|
@@ -20,6 +21,7 @@ __all__ = [
|
|
|
20
21
|
"ClientInfo",
|
|
21
22
|
"InferenceRequest",
|
|
22
23
|
"CineonInferenceRequest",
|
|
24
|
+
"ModelRecalculateRequest",
|
|
23
25
|
"RootResponse",
|
|
24
26
|
"PingResponse",
|
|
25
27
|
"InferenceOutput",
|
|
@@ -83,3 +83,13 @@ class CineonInferenceRequest(BaseModel, extra="forbid"):
|
|
|
83
83
|
client=self.client,
|
|
84
84
|
eye_data=self.eye_data,
|
|
85
85
|
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ModelRecalculateRequest(BaseModel, extra="forbid"):
|
|
89
|
+
# This can be used to tell the server which models should be used
|
|
90
|
+
# to re-calculate the constructs for a given session.
|
|
91
|
+
#
|
|
92
|
+
# The ELE-api will automatically decide which models to use when not
|
|
93
|
+
# specified. It will also validate that the requested models
|
|
94
|
+
# calculate the construct expected.
|
|
95
|
+
models: Optional[dict[Construct, str]] = None
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
1
4
|
from pydantic import BaseModel
|
|
2
5
|
|
|
3
6
|
from cineon_api_format.definitions import Construct, Metric
|
|
@@ -19,9 +22,11 @@ class VersionResponse(BaseModel, extra="forbid"):
|
|
|
19
22
|
gazetools: str
|
|
20
23
|
|
|
21
24
|
|
|
22
|
-
class InferenceOutput(BaseModel, extra="
|
|
25
|
+
class InferenceOutput(BaseModel, extra="ignore"):
|
|
23
26
|
prediction: Construct | Metric | str
|
|
24
27
|
score: float
|
|
28
|
+
start_timestamp: Optional[datetime] = None
|
|
29
|
+
end_timestamp: Optional[datetime] = None
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
class InferenceResponse(BaseModel, extra="forbid"):
|
|
@@ -6,7 +6,9 @@ from cineon_api_format import (
|
|
|
6
6
|
ClientInfo,
|
|
7
7
|
Construct,
|
|
8
8
|
InferenceRequest,
|
|
9
|
+
InferenceResponse,
|
|
9
10
|
Metric,
|
|
11
|
+
ModelRecalculateRequest,
|
|
10
12
|
)
|
|
11
13
|
|
|
12
14
|
|
|
@@ -36,3 +38,37 @@ def test_cineon_request_to_ele_request():
|
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
assert request.to_ele_request() == target_request
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@typechecked
|
|
44
|
+
def test_parse_recalculate_request():
|
|
45
|
+
request = {"models": {Construct.fatigue: "fatigue-random"}}
|
|
46
|
+
assert ModelRecalculateRequest.model_validate(request)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@typechecked
|
|
50
|
+
def test_inference_response_no_timestamps():
|
|
51
|
+
response = {
|
|
52
|
+
"data": [
|
|
53
|
+
{
|
|
54
|
+
"prediction": "stress",
|
|
55
|
+
"score": 0.8,
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
assert InferenceResponse.model_validate(response)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@typechecked
|
|
63
|
+
def test_inference_response_timestamps():
|
|
64
|
+
response = {
|
|
65
|
+
"data": [
|
|
66
|
+
{
|
|
67
|
+
"prediction": "stress",
|
|
68
|
+
"score": 0.8,
|
|
69
|
+
"start_timestamp": "2024-01-01T00:00:00",
|
|
70
|
+
"end_timestamp": "2024-01-01T00:00:10",
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
assert InferenceResponse.model_validate(response)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="122" height="20" role="img" aria-label="coverage: 100.00%"><title>coverage: 100.00%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="61" height="20" fill="#4c1"/><rect width="122" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">100.00%</text><text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="510">100.00%</text></g></svg>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Ensure that the script exits if any commands fail
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
# Build the package
|
|
7
|
-
uv build
|
|
8
|
-
|
|
9
|
-
# Publish using an OAuth2 access token from gcloud (via keyring)
|
|
10
|
-
uv publish --index cineon-registry \
|
|
11
|
-
--username oauth2accesstoken \
|
|
12
|
-
--keyring-provider subprocess
|
|
13
|
-
|
|
14
|
-
# Clean up built distributions
|
|
15
|
-
rm -f dist/*.tar.gz dist/*.whl
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|