Skip to content

Better windows support #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sh text eol=lf
*.jsonlines text eol=lf
45 changes: 34 additions & 11 deletions .github/workflows/app-tests.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,34 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
os: ["ubuntu-latest", "windows-latest", "macos-latest-xlarge", "macos-13"]
python_version: ["3.10", "3.11", "3.12"]
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
exclude:
- os: macos-latest-xlarge
python_version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Check for MacOS Runner
if: matrix.os == 'macos-latest-xlarge'
run: brew install postgresql@14
- name: Install pgvector on Windows using install-pgvector.bat
if: matrix.os == 'windows-latest'
shell: cmd
run: .github\workflows\install-pgvector.bat
- name: Install PostgreSQL development libraries
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install postgresql-server-dev-14
- name: Setup postgres
uses: ikalnytskyi/action-setup-postgres@v6
with:
username: admin
password: postgres
database: postgres
- name: Install pgvector on MacOS/Linux using install-pgvector.sh
if: matrix.os != 'windows-latest'
run: .github/workflows/install-pgvector.sh
- name: Setup python
uses: actions/setup-python@v5
with:
Expand All @@ -43,3 +57,12 @@ jobs:
cp .env.sample .env
python ./src/fastapi_app/setup_postgres_database.py
python ./src/fastapi_app/setup_postgres_seeddata.py
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Build frontend
run: |
cd ./src/frontend
npm install
npm run build
8 changes: 8 additions & 0 deletions .github/workflows/install-pgvector.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set "PGROOT=C:\Program Files\PostgreSQL\14"
cd $RUNNER_TEMP
git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git
cd pgvector

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake /NOLOGO /F Makefile.win
nmake /NOLOGO /F Makefile.win install
5 changes: 5 additions & 0 deletions .github/workflows/install-pgvector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd /tmp
git clone --branch v0.7.2 https://github.com/pgvector/pgvector.git
cd pgvector
make
sudo make install # may need sudo
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
ruff
pre-commit
pip-tools
pip-compile-cross-platform
1 change: 1 addition & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e
python3 -m pip install .
python3 -m gunicorn "fastapi_app:create_app()"
26 changes: 12 additions & 14 deletions src/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
[project]
name = "fastapi_app"
version = "1.0.0"
description = "Create a relecloud demo application with fastapi and postgres-flexible"
description = "Create a application with fastapi and postgres-flexible"
dependencies = [
"fastapi",
"gunicorn",
"uvicorn[standard]",
"python-dotenv",
"environs",
"azure-identity",
"aiohttp",
"asyncpg",
"SQLAlchemy[asyncio]",
"pgvector",
"openai",
"tiktoken",
"openai-messages-token-helper"
"fastapi>=0.111.0,<1.0.0",
"python-dotenv>=1.0.1,<2.0.0",
"environs>=11.0.0,<12.0.0",
"azure-identity>=1.16.1,<2.0.0",
"aiohttp>=3.9.5,<4.0.0",
"asyncpg>=0.29.0,<1.0.0",
"SQLAlchemy[asyncio]>=2.0.30,<3.0.0",
"pgvector>=0.2.5,<0.3.0",
"openai>=1.34.0,<2.0.0",
"tiktoken>=0.7.0,<0.8.0",
"openai-messages-token-helper>=0.1.5,<0.2.0",
]

[build-system]
Expand Down
206 changes: 2 additions & 204 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,204 +1,2 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
aiohttp==3.9.5
# via fastapi_app (pyproject.toml)
aiosignal==1.3.1
# via aiohttp
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
# via
# httpx
# openai
# starlette
# watchfiles
async-timeout==4.0.3
# via asyncpg
asyncpg==0.29.0
# via fastapi_app (pyproject.toml)
attrs==23.2.0
# via aiohttp
azure-core==1.30.1
# via azure-identity
azure-identity==1.16.0
# via fastapi_app (pyproject.toml)
certifi==2024.2.2
# via
# httpcore
# httpx
# requests
cffi==1.16.0
# via cryptography
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# typer
# uvicorn
cryptography==42.0.7
# via
# azure-identity
# msal
# pyjwt
distro==1.9.0
# via openai
dnspython==2.6.1
# via email-validator
email-validator==2.1.1
# via fastapi
environs==11.0.0
# via fastapi_app (pyproject.toml)
fastapi==0.111.0
# via fastapi_app (pyproject.toml)
fastapi-cli==0.0.4
# via fastapi
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
greenlet==3.0.3
# via sqlalchemy
gunicorn==22.0.0
# via fastapi_app (pyproject.toml)
h11==0.14.0
# via
# httpcore
# uvicorn
httpcore==1.0.5
# via httpx
httptools==0.6.1
# via uvicorn
httpx==0.27.0
# via
# fastapi
# openai
idna==3.7
# via
# anyio
# email-validator
# httpx
# requests
# yarl
jinja2==3.1.4
# via fastapi
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via jinja2
marshmallow==3.21.2
# via environs
mdurl==0.1.2
# via markdown-it-py
msal==1.28.0
# via
# azure-identity
# msal-extensions
msal-extensions==1.1.0
# via azure-identity
multidict==6.0.5
# via
# aiohttp
# yarl
numpy==1.26.4
# via pgvector
openai==1.31.0
# via
# fastapi_app (pyproject.toml)
# openai-messages-token-helper
openai-messages-token-helper==0.1.4
# via fastapi_app (pyproject.toml)
orjson==3.10.3
# via fastapi
packaging==24.0
# via
# gunicorn
# marshmallow
# msal-extensions
pgvector==0.2.5
# via fastapi_app (pyproject.toml)
pillow==10.3.0
# via openai-messages-token-helper
portalocker==2.8.2
# via msal-extensions
pycparser==2.22
# via cffi
pydantic==2.7.2
# via
# fastapi
# openai
pydantic-core==2.18.3
# via pydantic
pygments==2.18.0
# via rich
pyjwt[crypto]==2.8.0
# via
# msal
# pyjwt
python-dotenv==1.0.1
# via
# environs
# fastapi_app (pyproject.toml)
# uvicorn
python-multipart==0.0.9
# via fastapi
pyyaml==6.0.1
# via uvicorn
regex==2024.5.15
# via tiktoken
requests==2.32.3
# via
# azure-core
# msal
# tiktoken
rich==13.7.1
# via typer
shellingham==1.5.4
# via typer
six==1.16.0
# via azure-core
sniffio==1.3.1
# via
# anyio
# httpx
# openai
sqlalchemy[asyncio]==2.0.30
# via fastapi_app (pyproject.toml)
starlette==0.37.2
# via fastapi
tiktoken==0.7.0
# via
# fastapi_app (pyproject.toml)
# openai-messages-token-helper
tqdm==4.66.4
# via openai
typer==0.12.3
# via fastapi-cli
typing-extensions==4.12.0
# via
# azure-core
# fastapi
# openai
# pydantic
# pydantic-core
# sqlalchemy
# typer
ujson==5.10.0
# via fastapi
urllib3==2.2.1
# via requests
uvicorn[standard]==0.30.0
# via
# fastapi
# fastapi_app (pyproject.toml)
uvloop==0.19.0
# via uvicorn
watchfiles==0.22.0
# via uvicorn
websockets==12.0
# via uvicorn
yarl==1.9.4
# via aiohttp
gunicorn>=22.0.0,<23.0.0
uvicorn>=0.30.1,<1.0.0
Loading