Skip to content

Commit 9a5c423

Browse files
takatostcrazywoolabowenliang123
authored
chore: remove pip support for api service (langgenius#5453)
Co-authored-by: crazywoola <[email protected]> Co-authored-by: Bowen Liang <[email protected]>
1 parent 6a09409 commit 9a5c423

File tree

5 files changed

+4
-234
lines changed

5 files changed

+4
-234
lines changed

.devcontainer/post_start_command.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
cd api && pip install -r requirements.txt
3+
poetry install -C api

.github/workflows/api-tests.yml

-70
Original file line numberDiff line numberDiff line change
@@ -14,76 +14,6 @@ concurrency:
1414

1515
jobs:
1616
test:
17-
runs-on: ubuntu-latest
18-
strategy:
19-
matrix:
20-
python-version:
21-
- "3.10"
22-
- "3.11"
23-
24-
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v4
27-
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
cache: 'pip'
33-
cache-dependency-path: |
34-
./api/requirements.txt
35-
./api/requirements-dev.txt
36-
37-
- name: Install dependencies
38-
run: pip install -r ./api/requirements.txt -r ./api/requirements-dev.txt
39-
40-
- name: Run Unit tests
41-
run: dev/pytest/pytest_unit_tests.sh
42-
43-
- name: Run ModelRuntime
44-
run: dev/pytest/pytest_model_runtime.sh
45-
46-
- name: Run Tool
47-
run: dev/pytest/pytest_tools.sh
48-
49-
- name: Set up Sandbox
50-
uses: hoverkraft-tech/[email protected]
51-
with:
52-
compose-file: |
53-
docker/docker-compose.middleware.yaml
54-
services: |
55-
sandbox
56-
ssrf_proxy
57-
58-
- name: Run Workflow
59-
run: dev/pytest/pytest_workflow.sh
60-
61-
- name: Set up Vector Stores (Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS, Chroma)
62-
uses: hoverkraft-tech/[email protected]
63-
with:
64-
compose-file: |
65-
docker/docker-compose.middleware.yaml
66-
docker/docker-compose.qdrant.yaml
67-
docker/docker-compose.milvus.yaml
68-
docker/docker-compose.pgvecto-rs.yaml
69-
docker/docker-compose.pgvector.yaml
70-
docker/docker-compose.chroma.yaml
71-
docker/docker-compose.oracle.yaml
72-
services: |
73-
weaviate
74-
qdrant
75-
etcd
76-
minio
77-
milvus-standalone
78-
pgvecto-rs
79-
pgvector
80-
chroma
81-
oracle
82-
83-
- name: Test Vector Stores
84-
run: dev/pytest/pytest_vdb.sh
85-
86-
test-in-poetry:
8717
name: API Tests
8818
runs-on: ubuntu-latest
8919
strategy:

api/README.md

+3-62
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Usage
44

5+
> [!IMPORTANT]
6+
> In the v0.6.12 release, we deprecated `pip` as the package management tool for Dify API Backend service and replaced it with `poetry`.
7+
58
1. Start the docker-compose stack
69

710
The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using `docker-compose`.
@@ -29,8 +32,6 @@
2932

3033
Dify API service uses [Poetry](https://python-poetry.org/docs/) to manage dependencies. You can execute `poetry shell` to activate the environment.
3134

32-
> Using pip can be found [below](#usage-with-pip).
33-
3435
5. Install dependencies
3536

3637
```bash
@@ -84,63 +85,3 @@
8485
cd ../
8586
poetry run -C api bash dev/pytest/pytest_all_tests.sh
8687
```
87-
88-
## Usage with pip
89-
90-
> [!NOTE]
91-
> In the next version, we will deprecate pip as the primary package management tool for dify api service, currently Poetry and pip coexist.
92-
93-
1. Start the docker-compose stack
94-
95-
The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using `docker-compose`.
96-
97-
```bash
98-
cd ../docker
99-
docker-compose -f docker-compose.middleware.yaml -p dify up -d
100-
cd ../api
101-
```
102-
103-
2. Copy `.env.example` to `.env`
104-
3. Generate a `SECRET_KEY` in the `.env` file.
105-
106-
```bash
107-
sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env
108-
```
109-
110-
4. Create environment.
111-
112-
If you use Anaconda, create a new environment and activate it
113-
114-
```bash
115-
conda create --name dify python=3.10
116-
conda activate dify
117-
```
118-
119-
5. Install dependencies
120-
121-
```bash
122-
pip install -r requirements.txt
123-
```
124-
125-
6. Run migrate
126-
127-
Before the first launch, migrate the database to the latest version.
128-
129-
```bash
130-
flask db upgrade
131-
```
132-
133-
7. Start backend:
134-
135-
```bash
136-
flask run --host 0.0.0.0 --port=5001 --debug
137-
```
138-
139-
8. Setup your application by visiting <http://localhost:5001/console/api/setup> or other apis...
140-
9. If you need to debug local async processing, please start the worker service.
141-
142-
```bash
143-
celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail
144-
```
145-
146-
The started celery app handles the async tasks, e.g. dataset importing and documents indexing.

api/requirements-dev.txt

-5
This file was deleted.

api/requirements.txt

-96
Original file line numberDiff line numberDiff line change
@@ -1,96 +0,0 @@
1-
beautifulsoup4==4.12.2
2-
flask~=3.0.1
3-
Flask-SQLAlchemy~=3.0.5
4-
SQLAlchemy~=2.0.29
5-
Flask-Compress~=1.14
6-
flask-login~=0.6.3
7-
flask-migrate~=4.0.5
8-
flask-restful~=0.3.10
9-
flask-cors~=4.0.0
10-
gunicorn~=22.0.0
11-
gevent~=23.9.1
12-
openai~=1.29.0
13-
tiktoken~=0.7.0
14-
psycopg2-binary~=2.9.6
15-
pycryptodome==3.19.1
16-
python-dotenv==1.0.0
17-
Authlib==1.3.1
18-
boto3==1.34.123
19-
cachetools~=5.3.0
20-
weaviate-client~=3.21.0
21-
mailchimp-transactional~=1.0.50
22-
scikit-learn==1.2.2
23-
sentry-sdk[flask]~=1.39.2
24-
sympy==1.12
25-
jieba==0.42.1
26-
celery~=5.3.6
27-
redis[hiredis]~=5.0.3
28-
chardet~=5.1.0
29-
python-docx~=1.1.0
30-
pypdfium2~=4.17.0
31-
resend~=0.7.0
32-
pyjwt~=2.8.0
33-
anthropic~=0.23.1
34-
newspaper3k==0.2.8
35-
wikipedia==1.4.0
36-
readabilipy==0.2.0
37-
google-ai-generativelanguage==0.6.1
38-
google-api-core==2.18.0
39-
google-api-python-client==2.90.0
40-
google-auth==2.29.0
41-
google-auth-httplib2==0.2.0
42-
google-generativeai==0.5.0
43-
googleapis-common-protos==1.63.0
44-
google-cloud-storage==2.16.0
45-
replicate~=0.22.0
46-
websocket-client~=1.7.0
47-
dashscope[tokenizer]~=1.17.0
48-
huggingface_hub~=0.16.4
49-
transformers~=4.35.0
50-
tokenizers~=0.15.0
51-
pandas[performance,excel]~=2.2.2
52-
xinference-client==0.9.4
53-
safetensors~=0.4.3
54-
zhipuai==1.0.7
55-
werkzeug~=3.0.1
56-
pymilvus==2.3.1
57-
qdrant-client==1.7.3
58-
cohere~=5.2.4
59-
pyyaml~=6.0.1
60-
numpy~=1.26.4
61-
unstructured[docx,pptx,msg,md,ppt,epub]~=0.10.27
62-
bs4~=0.0.1
63-
markdown~=3.5.1
64-
httpx[socks]~=0.27.0
65-
matplotlib~=3.8.2
66-
yfinance~=0.2.40
67-
pydub~=0.25.1
68-
gmpy2~=2.1.5
69-
numexpr~=2.9.0
70-
duckduckgo-search~=6.1.5
71-
arxiv==2.1.0
72-
yarl~=1.9.4
73-
twilio~=9.0.4
74-
qrcode~=7.4.2
75-
azure-storage-blob==12.13.0
76-
azure-identity==1.16.1
77-
lxml==5.1.0
78-
pydantic~=2.7.4
79-
pydantic_extra_types~=2.8.1
80-
pydantic-settings~=2.3.3
81-
pgvecto-rs==0.1.4
82-
tcvectordb==1.3.2
83-
firecrawl-py==0.0.5
84-
oss2==2.18.5
85-
pgvector==0.2.5
86-
pymysql==1.1.1
87-
tidb-vector==0.0.9
88-
google-cloud-aiplatform==1.49.0
89-
vanna[postgres,mysql,clickhouse,duckdb]==0.5.5
90-
tencentcloud-sdk-python-hunyuan~=3.0.1158
91-
chromadb~=0.5.1
92-
novita_client~=0.5.6
93-
tenacity~=8.3.0
94-
opensearch-py==2.4.0
95-
cos-python-sdk-v5==1.9.30
96-
oracledb~=2.2.1

0 commit comments

Comments
 (0)