spamkit-api 0.1.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.
- spamkit_api-0.1.0/.dockerignore +11 -0
- spamkit_api-0.1.0/.github/workflows/ci.yml +34 -0
- spamkit_api-0.1.0/.gitignore +15 -0
- spamkit_api-0.1.0/Dockerfile +36 -0
- spamkit_api-0.1.0/LICENSE +661 -0
- spamkit_api-0.1.0/PKG-INFO +245 -0
- spamkit_api-0.1.0/PRD.md +629 -0
- spamkit_api-0.1.0/README.md +223 -0
- spamkit_api-0.1.0/THIRD_PARTY_NOTICES.md +14 -0
- spamkit_api-0.1.0/bench/eval_public.py +142 -0
- spamkit_api-0.1.0/bench/fetch_public_data.py +18 -0
- spamkit_api-0.1.0/bench/load_test.py +76 -0
- spamkit_api-0.1.0/contract/fixtures.json +73 -0
- spamkit_api-0.1.0/dist-site/brand/favicon.svg +7 -0
- spamkit_api-0.1.0/dist-site/brand/siftkit-logo-white.svg +7 -0
- spamkit_api-0.1.0/dist-site/brand/siftkit-logo.svg +7 -0
- spamkit_api-0.1.0/dist-site/brand/siftkit-mark.svg +6 -0
- spamkit_api-0.1.0/dist-site/index.html +1414 -0
- spamkit_api-0.1.0/docker-compose.yml +18 -0
- spamkit_api-0.1.0/docs/BENCHMARKS.md +35 -0
- spamkit_api-0.1.0/examples/fastapi-app/main.py +37 -0
- spamkit_api-0.1.0/examples/node-server/server.mjs +49 -0
- spamkit_api-0.1.0/pyproject.toml +44 -0
- spamkit_api-0.1.0/sdk/typescript/LICENSE +661 -0
- spamkit_api-0.1.0/sdk/typescript/README.md +54 -0
- spamkit_api-0.1.0/sdk/typescript/package-lock.json +1491 -0
- spamkit_api-0.1.0/sdk/typescript/package.json +39 -0
- spamkit_api-0.1.0/sdk/typescript/src/index.ts +234 -0
- spamkit_api-0.1.0/sdk/typescript/test/client.test.ts +120 -0
- spamkit_api-0.1.0/sdk/typescript/test/contract.test.ts +56 -0
- spamkit_api-0.1.0/sdk/typescript/tsconfig.json +14 -0
- spamkit_api-0.1.0/site/brand/favicon.svg +7 -0
- spamkit_api-0.1.0/site/brand/siftkit-logo-white.svg +7 -0
- spamkit_api-0.1.0/site/brand/siftkit-logo.svg +7 -0
- spamkit_api-0.1.0/site/brand/siftkit-mark.svg +6 -0
- spamkit_api-0.1.0/site/compare/ember-4k.png +0 -0
- spamkit_api-0.1.0/site/compare/forest-4k.png +0 -0
- spamkit_api-0.1.0/site/compare/index.html +170 -0
- spamkit_api-0.1.0/site/compare/ocean-4k.png +0 -0
- spamkit_api-0.1.0/site/compare/plum-4k.png +0 -0
- spamkit_api-0.1.0/site/compare/rose-4k.png +0 -0
- spamkit_api-0.1.0/site/index.html +1414 -0
- spamkit_api-0.1.0/src/spamkit/__init__.py +27 -0
- spamkit_api-0.1.0/src/spamkit/app.py +314 -0
- spamkit_api-0.1.0/src/spamkit/classifier.py +122 -0
- spamkit_api-0.1.0/src/spamkit/cli.py +199 -0
- spamkit_api-0.1.0/src/spamkit/client.py +174 -0
- spamkit_api-0.1.0/src/spamkit/errors.py +40 -0
- spamkit_api-0.1.0/src/spamkit/evaluation.py +180 -0
- spamkit_api-0.1.0/src/spamkit/observability.py +86 -0
- spamkit_api-0.1.0/src/spamkit/schemas.py +121 -0
- spamkit_api-0.1.0/src/spamkit/settings.py +67 -0
- spamkit_api-0.1.0/src/spamkit/verdict.py +46 -0
- spamkit_api-0.1.0/tests/conftest.py +43 -0
- spamkit_api-0.1.0/tests/test_api.py +187 -0
- spamkit_api-0.1.0/tests/test_cli.py +43 -0
- spamkit_api-0.1.0/tests/test_client.py +110 -0
- spamkit_api-0.1.0/tests/test_contract.py +34 -0
- spamkit_api-0.1.0/tests/test_evaluation.py +79 -0
- spamkit_api-0.1.0/tests/test_model_integration.py +36 -0
- spamkit_api-0.1.0/tests/test_robustness.py +140 -0
- spamkit_api-0.1.0/tests/test_robustness_real_model.py +86 -0
- spamkit_api-0.1.0/tests/test_settings.py +35 -0
- spamkit_api-0.1.0/tests/test_verdict.py +29 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
python:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with:
|
|
14
|
+
python-version: "3.12"
|
|
15
|
+
- name: Install CPU torch and package
|
|
16
|
+
run: |
|
|
17
|
+
pip install --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple "torch>=2.2"
|
|
18
|
+
pip install -e ".[server,dev]"
|
|
19
|
+
# Model integration tests skip unless the model was fetched; the rest run without it.
|
|
20
|
+
- run: pytest -q
|
|
21
|
+
|
|
22
|
+
typescript:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
defaults:
|
|
25
|
+
run:
|
|
26
|
+
working-directory: sdk/typescript
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: "22"
|
|
32
|
+
- run: npm ci
|
|
33
|
+
- run: npm run typecheck
|
|
34
|
+
- run: npm test
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Single-node CPU image. The model is fetched at build time at a pinned revision,
|
|
2
|
+
# so the running container makes no network calls.
|
|
3
|
+
FROM python:3.12-slim-bookworm
|
|
4
|
+
|
|
5
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
6
|
+
PYTHONUNBUFFERED=1 \
|
|
7
|
+
PIP_NO_CACHE_DIR=1 \
|
|
8
|
+
XDG_CACHE_HOME=/tmp
|
|
9
|
+
|
|
10
|
+
RUN useradd --create-home --uid 10001 spamkit
|
|
11
|
+
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
|
|
14
|
+
# CPU-only torch keeps the image small; the server extra then finds torch already satisfied.
|
|
15
|
+
RUN pip install --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple "torch>=2.2"
|
|
16
|
+
|
|
17
|
+
COPY pyproject.toml README.md THIRD_PARTY_NOTICES.md ./
|
|
18
|
+
COPY src ./src
|
|
19
|
+
RUN pip install ".[server]"
|
|
20
|
+
|
|
21
|
+
RUN spamkit fetch-model --dest /opt/models/spamton \
|
|
22
|
+
&& cp /app/THIRD_PARTY_NOTICES.md /opt/models/THIRD_PARTY_NOTICES.md
|
|
23
|
+
|
|
24
|
+
ENV SPAMKIT_MODEL_DIR=/opt/models/spamton \
|
|
25
|
+
SPAMKIT_HOST=0.0.0.0 \
|
|
26
|
+
SPAMKIT_PORT=8080 \
|
|
27
|
+
HF_HUB_OFFLINE=1 \
|
|
28
|
+
TRANSFORMERS_OFFLINE=1
|
|
29
|
+
|
|
30
|
+
USER spamkit
|
|
31
|
+
EXPOSE 8080
|
|
32
|
+
|
|
33
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
|
34
|
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/readyz', timeout=4)"
|
|
35
|
+
|
|
36
|
+
CMD ["spamkit", "serve"]
|