Skip to content

Commit a7b2594

Browse files
authored
Merge pull request Azure-Samples#46 from Azure-Samples/windows
Better windows support
2 parents 7da549c + e186a3d commit a7b2594

File tree

8 files changed

+65
-229
lines changed

8 files changed

+65
-229
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sh text eol=lf
2+
*.jsonlines text eol=lf

.github/workflows/app-tests.yaml

100644100755
Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,34 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: ["ubuntu-20.04"]
16+
os: ["ubuntu-latest", "windows-latest", "macos-latest-xlarge", "macos-13"]
1717
python_version: ["3.10", "3.11", "3.12"]
18-
services:
19-
postgres:
20-
image: pgvector/pgvector:pg16
21-
env:
22-
POSTGRES_USER: admin
23-
POSTGRES_PASSWORD: postgres
24-
ports:
25-
- 5432:5432
26-
# needed because the postgres container does not provide a healthcheck
27-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
18+
exclude:
19+
- os: macos-latest-xlarge
20+
python_version: "3.10"
2821
steps:
2922
- uses: actions/checkout@v4
23+
- name: Check for MacOS Runner
24+
if: matrix.os == 'macos-latest-xlarge'
25+
run: brew install postgresql@14
26+
- name: Install pgvector on Windows using install-pgvector.bat
27+
if: matrix.os == 'windows-latest'
28+
shell: cmd
29+
run: .github\workflows\install-pgvector.bat
30+
- name: Install PostgreSQL development libraries
31+
if: matrix.os == 'ubuntu-latest'
32+
run: |
33+
sudo apt update
34+
sudo apt install postgresql-server-dev-14
35+
- name: Setup postgres
36+
uses: ikalnytskyi/action-setup-postgres@v6
37+
with:
38+
username: admin
39+
password: postgres
40+
database: postgres
41+
- name: Install pgvector on MacOS/Linux using install-pgvector.sh
42+
if: matrix.os != 'windows-latest'
43+
run: .github/workflows/install-pgvector.sh
3044
- name: Setup python
3145
uses: actions/setup-python@v5
3246
with:
@@ -43,3 +57,12 @@ jobs:
4357
cp .env.sample .env
4458
python ./src/fastapi_app/setup_postgres_database.py
4559
python ./src/fastapi_app/setup_postgres_seeddata.py
60+
- name: Setup node
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 18
64+
- name: Build frontend
65+
run: |
66+
cd ./src/frontend
67+
npm install
68+
npm run build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set "PGROOT=C:\Program Files\PostgreSQL\14"
2+
cd $RUNNER_TEMP
3+
git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git
4+
cd pgvector
5+
6+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
7+
nmake /NOLOGO /F Makefile.win
8+
nmake /NOLOGO /F Makefile.win install

.github/workflows/install-pgvector.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cd /tmp
2+
git clone --branch v0.7.2 https://github.com/pgvector/pgvector.git
3+
cd pgvector
4+
make
5+
sudo make install # may need sudo

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
ruff
33
pre-commit
44
pip-tools
5+
pip-compile-cross-platform

src/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22
set -e
3+
python3 -m pip install .
34
python3 -m gunicorn "fastapi_app:create_app()"

src/pyproject.toml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
[project]
22
name = "fastapi_app"
33
version = "1.0.0"
4-
description = "Create a relecloud demo application with fastapi and postgres-flexible"
4+
description = "Create a application with fastapi and postgres-flexible"
55
dependencies = [
6-
"fastapi",
7-
"gunicorn",
8-
"uvicorn[standard]",
9-
"python-dotenv",
10-
"environs",
11-
"azure-identity",
12-
"aiohttp",
13-
"asyncpg",
14-
"SQLAlchemy[asyncio]",
15-
"pgvector",
16-
"openai",
17-
"tiktoken",
18-
"openai-messages-token-helper"
6+
"fastapi>=0.111.0,<1.0.0",
7+
"python-dotenv>=1.0.1,<2.0.0",
8+
"environs>=11.0.0,<12.0.0",
9+
"azure-identity>=1.16.1,<2.0.0",
10+
"aiohttp>=3.9.5,<4.0.0",
11+
"asyncpg>=0.29.0,<1.0.0",
12+
"SQLAlchemy[asyncio]>=2.0.30,<3.0.0",
13+
"pgvector>=0.2.5,<0.3.0",
14+
"openai>=1.34.0,<2.0.0",
15+
"tiktoken>=0.7.0,<0.8.0",
16+
"openai-messages-token-helper>=0.1.5,<0.2.0",
1917
]
2018

2119
[build-system]

src/requirements.txt

Lines changed: 2 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,2 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.11
3-
# by the following command:
4-
#
5-
# pip-compile --output-file=requirements.txt pyproject.toml
6-
#
7-
aiohttp==3.9.5
8-
# via fastapi_app (pyproject.toml)
9-
aiosignal==1.3.1
10-
# via aiohttp
11-
annotated-types==0.7.0
12-
# via pydantic
13-
anyio==4.4.0
14-
# via
15-
# httpx
16-
# openai
17-
# starlette
18-
# watchfiles
19-
async-timeout==4.0.3
20-
# via asyncpg
21-
asyncpg==0.29.0
22-
# via fastapi_app (pyproject.toml)
23-
attrs==23.2.0
24-
# via aiohttp
25-
azure-core==1.30.1
26-
# via azure-identity
27-
azure-identity==1.16.0
28-
# via fastapi_app (pyproject.toml)
29-
certifi==2024.2.2
30-
# via
31-
# httpcore
32-
# httpx
33-
# requests
34-
cffi==1.16.0
35-
# via cryptography
36-
charset-normalizer==3.3.2
37-
# via requests
38-
click==8.1.7
39-
# via
40-
# typer
41-
# uvicorn
42-
cryptography==42.0.7
43-
# via
44-
# azure-identity
45-
# msal
46-
# pyjwt
47-
distro==1.9.0
48-
# via openai
49-
dnspython==2.6.1
50-
# via email-validator
51-
email-validator==2.1.1
52-
# via fastapi
53-
environs==11.0.0
54-
# via fastapi_app (pyproject.toml)
55-
fastapi==0.111.0
56-
# via fastapi_app (pyproject.toml)
57-
fastapi-cli==0.0.4
58-
# via fastapi
59-
frozenlist==1.4.1
60-
# via
61-
# aiohttp
62-
# aiosignal
63-
greenlet==3.0.3
64-
# via sqlalchemy
65-
gunicorn==22.0.0
66-
# via fastapi_app (pyproject.toml)
67-
h11==0.14.0
68-
# via
69-
# httpcore
70-
# uvicorn
71-
httpcore==1.0.5
72-
# via httpx
73-
httptools==0.6.1
74-
# via uvicorn
75-
httpx==0.27.0
76-
# via
77-
# fastapi
78-
# openai
79-
idna==3.7
80-
# via
81-
# anyio
82-
# email-validator
83-
# httpx
84-
# requests
85-
# yarl
86-
jinja2==3.1.4
87-
# via fastapi
88-
markdown-it-py==3.0.0
89-
# via rich
90-
markupsafe==2.1.5
91-
# via jinja2
92-
marshmallow==3.21.2
93-
# via environs
94-
mdurl==0.1.2
95-
# via markdown-it-py
96-
msal==1.28.0
97-
# via
98-
# azure-identity
99-
# msal-extensions
100-
msal-extensions==1.1.0
101-
# via azure-identity
102-
multidict==6.0.5
103-
# via
104-
# aiohttp
105-
# yarl
106-
numpy==1.26.4
107-
# via pgvector
108-
openai==1.31.0
109-
# via
110-
# fastapi_app (pyproject.toml)
111-
# openai-messages-token-helper
112-
openai-messages-token-helper==0.1.4
113-
# via fastapi_app (pyproject.toml)
114-
orjson==3.10.3
115-
# via fastapi
116-
packaging==24.0
117-
# via
118-
# gunicorn
119-
# marshmallow
120-
# msal-extensions
121-
pgvector==0.2.5
122-
# via fastapi_app (pyproject.toml)
123-
pillow==10.3.0
124-
# via openai-messages-token-helper
125-
portalocker==2.8.2
126-
# via msal-extensions
127-
pycparser==2.22
128-
# via cffi
129-
pydantic==2.7.2
130-
# via
131-
# fastapi
132-
# openai
133-
pydantic-core==2.18.3
134-
# via pydantic
135-
pygments==2.18.0
136-
# via rich
137-
pyjwt[crypto]==2.8.0
138-
# via
139-
# msal
140-
# pyjwt
141-
python-dotenv==1.0.1
142-
# via
143-
# environs
144-
# fastapi_app (pyproject.toml)
145-
# uvicorn
146-
python-multipart==0.0.9
147-
# via fastapi
148-
pyyaml==6.0.1
149-
# via uvicorn
150-
regex==2024.5.15
151-
# via tiktoken
152-
requests==2.32.3
153-
# via
154-
# azure-core
155-
# msal
156-
# tiktoken
157-
rich==13.7.1
158-
# via typer
159-
shellingham==1.5.4
160-
# via typer
161-
six==1.16.0
162-
# via azure-core
163-
sniffio==1.3.1
164-
# via
165-
# anyio
166-
# httpx
167-
# openai
168-
sqlalchemy[asyncio]==2.0.30
169-
# via fastapi_app (pyproject.toml)
170-
starlette==0.37.2
171-
# via fastapi
172-
tiktoken==0.7.0
173-
# via
174-
# fastapi_app (pyproject.toml)
175-
# openai-messages-token-helper
176-
tqdm==4.66.4
177-
# via openai
178-
typer==0.12.3
179-
# via fastapi-cli
180-
typing-extensions==4.12.0
181-
# via
182-
# azure-core
183-
# fastapi
184-
# openai
185-
# pydantic
186-
# pydantic-core
187-
# sqlalchemy
188-
# typer
189-
ujson==5.10.0
190-
# via fastapi
191-
urllib3==2.2.1
192-
# via requests
193-
uvicorn[standard]==0.30.0
194-
# via
195-
# fastapi
196-
# fastapi_app (pyproject.toml)
197-
uvloop==0.19.0
198-
# via uvicorn
199-
watchfiles==0.22.0
200-
# via uvicorn
201-
websockets==12.0
202-
# via uvicorn
203-
yarl==1.9.4
204-
# via aiohttp
1+
gunicorn>=22.0.0,<23.0.0
2+
uvicorn>=0.30.1,<1.0.0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy