This commit is contained in:
Bowen Liang 2025-03-20 14:49:16 +08:00
parent c1f3d968bf
commit d403b1b5db
9 changed files with 3967 additions and 5 deletions

84
.github/workflows/api-tests-on-uv.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: Run Pytest on UV
on:
pull_request:
branches:
- main
paths:
- api/**
- docker/**
- .github/workflows/api-tests.yml
concurrency:
group: api-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: API Tests on uv
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./api
strategy:
matrix:
python-version:
- "3.12"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check Poetry lockfile
run: |
uv lock --check
- name: Install dependencies
run: uv sync
# - name: Check dependencies in pyproject.toml
# run: poetry run -P api bash dev/pytest/pytest_artifacts.sh
- name: Run Unit tests
run: uv run bash dev/pytest/pytest_unit_tests.sh
- name: Run dify config tests
run: uv python dev/pytest/pytest_config_tests.py
- name: Run mypy
run: |
uv python -m mypy --install-types --non-interactive .
- name: Set up dotenvs
run: |
cp docker/.env.example docker/.env
cp docker/middleware.env.example docker/middleware.env
- name: Expose Service Ports
run: sh .github/workflows/expose_service_ports.sh
- name: Set up Sandbox
uses: hoverkraft-tech/compose-action@v2.0.2
with:
compose-file: |
docker/docker-compose.middleware.yaml
services: |
sandbox
ssrf_proxy
- name: Run Workflow
run: uv run bash dev/pytest/pytest_workflow.sh

View File

@ -1,11 +1,69 @@
[project]
name = "dify-api"
version = "1.0.1"
requires-python = ">=3.11,<3.13"
dynamic = [ "dependencies" ]
[build-system]
requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"
dependencies = [
"authlib==1.3.1",
"azure-identity==1.16.1",
"beautifulsoup4==4.12.2",
"boto3==1.35.99",
"bs4~=0.0.1",
"cachetools~=5.3.0",
"celery~=5.4.0",
"chardet~=5.1.0",
"flask~=3.1.0",
"flask-compress~=1.17",
"flask-cors~=4.0.0",
"flask-login~=0.6.3",
"flask-migrate~=4.0.7",
"flask-restful~=0.3.10",
"flask-sqlalchemy~=3.1.1",
"gevent~=24.11.1",
"gmpy2~=2.2.1",
"google-api-core==2.18.0",
"google-api-python-client==2.90.0",
"google-auth==2.29.0",
"google-auth-httplib2==0.2.0",
"google-cloud-aiplatform==1.49.0",
"googleapis-common-protos==1.63.0",
"gunicorn~=23.0.0",
"httpx[socks]~=0.27.0",
"jieba==0.42.1",
"langfuse~=2.51.3",
"langsmith~=0.1.77",
"mailchimp-transactional~=1.0.50",
"markdown~=3.5.1",
"numpy~=1.26.4",
"oci~=2.135.1",
"openai~=1.61.0",
"openpyxl~=3.1.5",
"opik~=1.3.4",
"pandas-stubs~=2.2.3.241009",
"pandas[excel,output-formatting,performance]~=2.2.2",
"psycogreen~=1.0.2",
"psycopg2-binary~=2.9.6",
"pycryptodome==3.19.1",
"pydantic~=2.9.2",
"pydantic-extra-types~=2.9.0",
"pydantic-settings~=2.6.0",
"pyjwt~=2.8.0",
"pypdfium2~=4.30.0",
"python-docx~=1.1.0",
"python-dotenv==1.0.1",
"pyyaml~=6.0.1",
"readabilipy==0.2.0",
"redis[hiredis]~=5.0.3",
"resend~=0.7.0",
"sentry-sdk[flask]~=1.44.1",
"sqlalchemy~=2.0.29",
"starlette==0.41.0",
"tiktoken~=0.8.0",
"tokenizers~=0.15.0",
"transformers~=4.35.0",
"unstructured[docx,epub,md,msg,ppt,pptx]~=0.16.1",
"validators==0.21.0",
"yarl~=1.18.3",
]
[tool.poetry]
package-mode = false
@ -176,3 +234,71 @@ optional = true
[tool.poetry.group.lint.dependencies]
dotenv-linter = "~0.5.0"
ruff = "~0.11.0"
[dependency-groups]
dev = [
"coverage~=7.2.4",
"faker~=32.1.0",
"mypy~=1.13.0",
"pytest~=8.3.2",
"pytest-benchmark~=4.0.0",
"pytest-env~=1.1.3",
"pytest-mock~=3.14.0",
"types-beautifulsoup4~=4.12.0.20241020",
"types-deprecated~=1.2.15.20250304",
"types-flask-cors~=5.0.0.20240902",
"types-flask-migrate~=4.1.0.20250112",
"types-html5lib~=1.1.11.20241018",
"types-openpyxl~=3.1.5.20241225",
"types-protobuf~=5.29.1.20241207",
"types-psutil~=6.1.0.20241221",
"types-psycopg2~=2.9.21.20250121",
"types-python-dateutil~=2.9.0.20241206",
"types-pytz~=2024.2.0.20241221",
"types-pyyaml~=6.0.12.20241230",
"types-regex~=2024.11.6.20241221",
"types-requests~=2.32.0.20241016",
"types-six~=1.17.0.20241205",
"types-tqdm~=4.67.0.20241221",
]
lint = [
"dotenv-linter~=0.5.0",
"ruff~=0.11.0",
]
storage = [
"azure-storage-blob==12.13.0",
"bce-python-sdk~=0.9.23",
"cos-python-sdk-v5==1.9.30",
"esdk-obs-python==3.24.6.1",
"google-cloud-storage==2.16.0",
"opendal~=0.45.16",
"oss2==2.18.5",
"supabase~=2.8.1",
"tos~=2.7.1",
]
tools = [
"cloudscraper~=1.2.71",
"nltk~=3.9.1",
]
vdb = [
"alibabacloud-gpdb20160503~=3.8.0",
"alibabacloud-tea-openapi~=0.3.9",
"chromadb==0.5.20",
"clickhouse-connect~=0.7.16",
"couchbase~=4.3.0",
"elasticsearch==8.14.0",
"opensearch-py==2.4.0",
"oracledb~=2.2.1",
"pgvecto-rs[sqlalchemy]~=0.2.1",
"pgvector==0.2.5",
"pymilvus~=2.5.0",
"pymochow==1.3.1",
"pyobvector~=0.1.6",
"qdrant-client==1.7.3",
"tcvectordb==1.3.2",
"tidb-vector==0.0.9",
"upstash-vector==0.6.0",
"volcengine-compat~=1.0.156",
"weaviate-client~=3.21.0",
"xinference-client~=1.2.2",
]

60
api/r1.txt Normal file
View File

@ -0,0 +1,60 @@
authlib==1.3.1
azure-identity==1.16.1
beautifulsoup4==4.12.2
boto3==1.35.99
bs4~=0.0.1
cachetools~=5.3.0
celery~=5.4.0
chardet~=5.1.0
flask~=3.1.0
flask-compress~=1.17
flask-cors~=4.0.0
flask-login~=0.6.3
flask-migrate~=4.0.7
flask-restful~=0.3.10
flask-sqlalchemy~=3.1.1
gevent~=24.11.1
gmpy2~=2.2.1
google-api-core==2.18.0
google-api-python-client==2.90.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-cloud-aiplatform==1.49.0
googleapis-common-protos==1.63.0
gunicorn~=23.0.0
httpx[socks]~=0.27.0
jieba==0.42.1
langfuse~=2.51.3
langsmith~=0.1.77
mailchimp-transactional~=1.0.50
markdown~=3.5.1
numpy~=1.26.4
oci~=2.135.1
openai~=1.61.0
openpyxl~=3.1.5
opik~=1.3.4
pandas[performance,excel,output-formatting]~=2.2.2
pandas-stubs~=2.2.3.241009
psycogreen~=1.0.2
psycopg2-binary~=2.9.6
pycryptodome==3.19.1
pydantic~=2.9.2
pydantic-settings~=2.6.0
pydantic_extra_types~=2.9.0
pyjwt~=2.8.0
pypdfium2~=4.30.0
python-docx~=1.1.0
python-dotenv==1.0.1
pyyaml~=6.0.1
readabilipy==0.2.0
redis[hiredis]~=5.0.3
resend~=0.7.0
sentry-sdk[flask]~=1.44.1
sqlalchemy~=2.0.29
starlette==0.41.0
tiktoken~=0.8.0
tokenizers~=0.15.0
transformers~=4.35.0
unstructured[docx,epub,md,msg,ppt,pptx]~=0.16.1
validators==0.21.0
yarl~=1.18.3

2
api/r2.txt Normal file
View File

@ -0,0 +1,2 @@
cloudscraper~=1.2.71
nltk~=3.9.1

9
api/r3.txt Normal file
View File

@ -0,0 +1,9 @@
azure-storage-blob==12.13.0
bce-python-sdk~=0.9.23
cos-python-sdk-v5==1.9.30
esdk-obs-python==3.24.6.1
google-cloud-storage==2.16.0
opendal~=0.45.16
oss2==2.18.5
supabase~=2.8.1
tos~=2.7.1

20
api/r4.txt Normal file
View File

@ -0,0 +1,20 @@
alibabacloud_gpdb20160503~=3.8.0
alibabacloud_tea_openapi~=0.3.9
chromadb==0.5.20
clickhouse-connect~=0.7.16
couchbase~=4.3.0
elasticsearch==8.14.0
opensearch-py==2.4.0
oracledb~=2.2.1
pgvecto-rs[sqlalchemy]~=0.2.1
pgvector==0.2.5
pymilvus~=2.5.0
pymochow==1.3.1
pyobvector~=0.1.6
qdrant-client==1.7.3
tcvectordb==1.3.2
tidb-vector==0.0.9
upstash-vector==0.6.0
volcengine-compat~=1.0.156
weaviate-client~=3.21.0
xinference-client~=1.2.2

23
api/r5.txt Normal file
View File

@ -0,0 +1,23 @@
coverage~=7.2.4
faker~=32.1.0
mypy~=1.13.0
pytest~=8.3.2
pytest-benchmark~=4.0.0
pytest-env~=1.1.3
pytest-mock~=3.14.0
types-beautifulsoup4~=4.12.0.20241020
types-deprecated~=1.2.15.20250304
types-flask-cors~=5.0.0.20240902
types-flask-migrate~=4.1.0.20250112
types-html5lib~=1.1.11.20241018
types-openpyxl~=3.1.5.20241225
types-protobuf~=5.29.1.20241207
types-psutil~=6.1.0.20241221
types-psycopg2~=2.9.21.20250121
types-python-dateutil~=2.9.0.20241206
types-pytz~=2024.2.0.20241221
types-pyyaml~=6.0.12.20241230
types-regex~=2024.11.6.20241221
types-requests~=2.32.0.20241016
types-six~=1.17.0.20241205
types-tqdm~=4.67.0.20241221

2
api/r6.txt Normal file
View File

@ -0,0 +1,2 @@
dotenv-linter~=0.5.0
ruff~=0.11.0

3636
api/uv.lock Normal file

File diff suppressed because it is too large Load Diff