Skip to content

Commit 800381b

Browse files
fix: use sphinx-ts
1 parent 399071e commit 800381b

7 files changed

Lines changed: 197 additions & 905 deletions

File tree

docs/api_reference.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Main Classes
1111

1212
- **ClassifierSdk**: Main entry point for interacting with the Athena service. Handles authentication, deployment management, and image classification.
1313
- **ClassifierServiceClient**: Low-level gRPC client for direct service calls.
14-
- **ClassifyImageOptions**: Options for sending image classification requests.
14+
- **ClassifierSdkOptions**: Configuration options for initializing the SDK.
1515

1616
Usage Example
1717
-------------
@@ -54,11 +54,11 @@ Usage Example
5454
API Classes
5555
-----------
5656

57-
.. js:autoclass:: ClassifierSdk
57+
.. ts:autoclass:: ClassifierSdk
5858
:members:
5959

60-
.. js:autoclass:: ClassifierServiceClient
60+
.. ts:autoclass:: ClassifierServiceClient
6161
:members:
6262

63-
.. js:autoclass:: ClassifyImageOptions
63+
.. ts:autointerface:: ClassifierSdkOptions
6464
:members:

docs/athena-types.rst

Lines changed: 16 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -11,136 +11,46 @@ definitions.
1111
Request Types
1212
-------------
1313

14-
ClassifyRequest
15-
~~~~~~~~~~~~~~~
14+
.. ts:autointerface:: ClassifyRequest
1615
17-
Request message for image classification.
18-
19-
* ``deploymentId: string`` - Deployment identifier for routing responses
20-
* ``inputs: ClassificationInput[]`` - Array of images to classify
21-
22-
ClassificationInput
23-
~~~~~~~~~~~~~~~~~~~
24-
25-
Single image classification input.
26-
27-
* ``affiliate: string`` - Source system identifier
28-
* ``correlationId: string`` - Unique ID for matching responses
29-
* ``encoding: RequestEncoding`` - Data compression format
30-
* ``data: Uint8Array`` - Raw image bytes
31-
* ``format: ImageFormat`` - Image file format
32-
* ``hashes: ImageHash[]`` - Image data hashes
16+
.. ts:autointerface:: ClassificationInput
3317
3418
Response Types
3519
--------------
20+
.. ts:autointerface:: ClassifyResponse
3621
37-
ClassifyResponse
38-
~~~~~~~~~~~~~~~~
39-
40-
Response containing classification results.
41-
42-
* ``globalError?: ClassificationError`` - Error affecting entire request
43-
* ``outputs: ClassificationOutput[]`` - Individual image results
44-
45-
ClassificationOutput
46-
~~~~~~~~~~~~~~~~~~~~
47-
48-
Result for a single image.
49-
50-
* ``correlationId: string`` - Matches input correlation ID
51-
* ``classifications: Classification[]`` - Detected classifications
52-
* ``error?: ClassificationError`` - Image-specific error
22+
.. ts:autointerface:: ClassificationOutput
5323
5424
Classification
5525
~~~~~~~~~~~~~~
5626

57-
Single classification result.
58-
59-
* ``label: string`` - Classification label
60-
* ``weight: number`` - Confidence score (0.0 - 1.0)
27+
.. ts:autointerface:: Classification
6128
6229
ClassificationError
6330
~~~~~~~~~~~~~~~~~~~
6431

65-
Error information.
66-
67-
* ``code: ErrorCode`` - Error type
68-
* ``message: string`` - Error description
69-
* ``details: string`` - Additional error context
32+
.. ts:autointerface:: ClassificationError
7033
7134
Deployment Types
7235
----------------
7336

74-
ListDeploymentsResponse
75-
~~~~~~~~~~~~~~~~~~~~~~~
76-
77-
Response listing active deployments.
78-
79-
* ``deployments: Deployment[]`` - Array of deployment info
80-
81-
Deployment
82-
~~~~~~~~~~
37+
.. ts:autointerface:: ListDeploymentsResponse
8338
84-
Single deployment information.
39+
.. ts:autointerface:: Deployment
8540
86-
* ``deploymentId: string`` - Deployment identifier
87-
* ``backlog: number`` - Number of queued responses
8841
8942
Utility Types
9043
-------------
9144

92-
ImageHash
93-
~~~~~~~~~
94-
95-
Hash of image data.
96-
97-
* ``value: string`` - Hash value
98-
* ``type: HashType`` - Hash algorithm type
45+
.. ts:autointerface:: ImageHash
9946
10047
Enums
10148
-----
10249

103-
ErrorCode
104-
~~~~~~~~~
105-
106-
* ``UNSPECIFIED = 0`` - Unknown error
107-
* ``IMAGE_TOO_LARGE = 2`` - Image exceeds size limits
108-
* ``MODEL_ERROR = 3`` - Classifier internal error
109-
* ``AFFILIATE_NOT_PERMITTED = 4`` - Access denied for affiliate
110-
111-
RequestEncoding
112-
~~~~~~~~~~~~~~~
113-
114-
* ``UNSPECIFIED = 0`` - Default (uncompressed)
115-
* ``UNCOMPRESSED = 1`` - Raw image data
116-
* ``BROTLI = 2`` - Brotli compressed data
117-
118-
ImageFormat
119-
~~~~~~~~~~~
120-
121-
* ``UNSPECIFIED = 0`` - Unknown format
122-
* ``GIF = 1`` - GIF format
123-
* ``JPEG = 2`` - JPEG format (.jpeg, .jpg, .jpe)
124-
* ``BMP = 3`` - BMP format
125-
* ``DIB = 4`` - DIB format
126-
* ``PNG = 5`` - PNG format
127-
* ``WEBP = 6`` - WebP format
128-
* ``PBM = 7`` - PBM format
129-
* ``PGM = 8`` - PGM format
130-
* ``PPM = 9`` - PPM format
131-
* ``PXM = 10`` - PXM format
132-
* ``PNM = 11`` - PNM format
133-
* ``PFM = 12`` - PFM format
134-
* ``SR = 13`` - SR format
135-
* ``RAS = 14`` - RAS format
136-
* ``TIFF = 15`` - TIFF format (.tiff, .tif)
137-
* ``HDR = 16`` - HDR format
138-
* ``PIC = 17`` - PIC format
139-
* ``RAW_UINT8 = 18`` - Raw 8-bit RGB data
140-
141-
HashType
142-
~~~~~~~~
143-
144-
* ``UNKNOWN = 0`` - Unknown hash type
145-
* ``MD5 = 1`` - MD5 hash
146-
* ``SHA1 = 2`` - SHA1 hash
50+
.. ts:autoenum:: ErrorCode
51+
52+
.. ts:autoenum:: RequestEncoding
53+
54+
.. ts:autoenum:: ImageFormat
55+
56+
.. ts:autoenum:: HashType

docs/authenticationManager.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Manages OAuth authentication and token refresh for the Athena gRPC client. Hand
2828
* `autoRefresh`: Whether to automatically refresh the access token
2929
* `scope`: OAuth scope to request
3030

31-
.. js:autoclass:: AuthenticationManager
31+
.. ts:autoclass:: AuthenticationManager
3232
:members:

docs/conf.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828

2929
# Extensions
3030
extensions = [
31-
"sphinx_js",
3231
"sphinx.ext.autodoc",
3332
"sphinx.ext.napoleon",
3433
"sphinx.ext.viewcode",
3534
"sphinx.ext.autosummary",
3635
"sphinx.ext.inheritance_diagram",
3736
"sphinx.ext.intersphinx",
3837
"sphinx.ext.todo",
39-
"myst_parser",
38+
"sphinx_ts",
4039
]
4140

4241
# Add any paths that contain templates here, relative to this directory
@@ -168,3 +167,22 @@
168167

169168
# Output file name
170169
htmlhelp_basename = "AthenaProtobufsdoc"
170+
171+
# -- TypeScript Sphinx Configuration ----------------------------------------
172+
173+
# Directories to scan for TypeScript files (relative to conf.py)
174+
sphinx_ts_src_dirs = ["../src"]
175+
176+
# Patterns for files to exclude from parsing
177+
sphinx_ts_exclude_patterns = [
178+
"**/*.test.ts",
179+
"**/*.spec.ts",
180+
"**/node_modules/**",
181+
"**/*.d.ts",
182+
]
183+
184+
# Whether to include private members in documentation
185+
sphinx_ts_include_private = True
186+
187+
# Whether to include inherited members in class documentation
188+
sphinx_ts_include_inherited = True

docs/hashing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Hashing Utilities
44
Provides functions to compute MD5 and SHA1 hashes from a readable stream, will
55
also resize the image to 448x448 as required if requested.
66

7-
.. js:autofunction:: computeHashesFromStream
7+
.. ts:autodata:: computeHashesFromStream

pyproject.toml

Lines changed: 11 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
[project]
22
name = "athena-nodejs-sdk"
3-
version = "1.0.0"
3+
version = "0.0.0"
44
description = "NodeJS SDK documentation for Athena CSAM Detection API"
5-
authors = [{ name = "Crisp", email = "support@crispthinking.com" }]
5+
authors = [
6+
{ name = "Crisp Thinking Group Ltd.", email = "opensource@kroll.com" },
7+
]
68
readme = "README.md"
79
license = { text = "MIT" }
8-
requires-python = ">=3.10"
9-
classifiers = [
10-
"Development Status :: 5 - Production/Stable",
11-
"Intended Audience :: Developers",
12-
"License :: OSI Approved :: MIT License",
13-
"Programming Language :: Python :: 3",
14-
"Programming Language :: Python :: 3.8",
15-
"Programming Language :: Python :: 3.9",
16-
"Programming Language :: Python :: 3.10",
17-
"Programming Language :: Python :: 3.11",
18-
"Programming Language :: Python :: 3.12",
19-
"Topic :: Documentation",
20-
"Topic :: Software Development :: Documentation",
21-
]
10+
requires-python = ">=3.12"
11+
classifiers = []
2212

2313
dependencies = [
2414
# Sphinx documentation dependencies
@@ -35,100 +25,13 @@ dependencies = [
3525
"grpcio>=1.50.0",
3626
"grpcio-tools>=1.50.0",
3727
"furo>=2025.7.19",
38-
]
39-
40-
[project.optional-dependencies]
41-
dev = [
42-
# Development and testing
43-
"pytest>=7.0.0",
44-
"pytest-asyncio>=0.21.0",
45-
46-
# Code formatting and linting
47-
"black>=23.0.0",
48-
"isort>=5.12.0",
49-
"ruff>=0.1.0",
50-
]
51-
52-
test = ["pytest>=7.0.0", "pytest-asyncio>=0.21.0", "pytest-cov>=4.0.0"]
53-
54-
docs = [
55-
# Additional documentation tools
5628
"sphinx-design>=0.5.0",
5729
"sphinx-copybutton>=0.5.0",
58-
"furo>=2023.0.0",
30+
"sphinx-ts>=0.1.0",
5931
]
6032

6133
[project.urls]
62-
Homepage = "https://github.com/crispthinking/athena-protobufs"
63-
Documentation = "https://crispthinking.github.io/athena-protobufs"
64-
Repository = "https://github.com/crispthinking/athena-protobufs"
65-
Issues = "https://github.com/crispthinking/athena-protobufs/issues"
66-
67-
[tool.black]
68-
target-version = ['py38']
69-
line-length = 88
70-
skip-string-normalization = true
71-
extend-exclude = '''
72-
/(
73-
# directories
74-
\.eggs
75-
| \.git
76-
| \.hg
77-
| \.mypy_cache
78-
| \.tox
79-
| \.venv
80-
| _build
81-
| buck-out
82-
| build
83-
| dist
84-
| docs/_build
85-
)/
86-
'''
87-
88-
[tool.isort]
89-
profile = "black"
90-
multi_line_output = 3
91-
line_length = 88
92-
skip_gitignore = true
93-
94-
[tool.ruff]
95-
target-version = "py38"
96-
line-length = 88
97-
select = [
98-
"E", # pycodestyle errors
99-
"W", # pycodestyle warnings
100-
"F", # pyflakes
101-
"I", # isort
102-
"B", # flake8-bugbear
103-
"C4", # flake8-comprehensions
104-
"UP", # pyupgrade
105-
]
106-
ignore = [
107-
"E501", # line too long, handled by black
108-
"B008", # do not perform function calls in argument defaults
109-
"C901", # too complex
110-
]
111-
112-
[tool.pytest.ini_options]
113-
minversion = "6.0"
114-
addopts = "-ra -q --strict-markers"
115-
testpaths = ["tests"]
116-
pythonpath = ["."]
117-
118-
[tool.coverage.run]
119-
source = ["."]
120-
omit = ["*/tests/*", "*/__tests_*", "*/build/*", ".venv/*"]
121-
122-
[tool.coverage.report]
123-
exclude_lines = [
124-
"pragma: no cover",
125-
"def __repr__",
126-
"if self.debug:",
127-
"if settings.DEBUG",
128-
"raise AssertionError",
129-
"raise NotImplementedError",
130-
"if 0:",
131-
"if __name__ == .__main__.:",
132-
"class .*\\bProtocol\\):",
133-
"@(abc\\.)?abstractmethod",
134-
]
34+
Homepage = "https://github.com/crispthinking/athena-nodejs-client"
35+
Documentation = "https://crispthinking.github.io/athena-nodejs-client"
36+
Repository = "https://github.com/crispthinking/athena-nodejs-client"
37+
Issues = "https://github.com/crispthinking/athena-nodejs-client/issues"

0 commit comments

Comments
 (0)