-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish search API, frontend and backend (#28)
* updates
- Loading branch information
Showing
93 changed files
with
30,080 additions
and
12,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Test Suite | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Python ${{ matrix.python-version }} - ${{ matrix.connection }} [redis-stack ${{matrix.redis-stack-version}}] | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.11"] | ||
redis-stack-version: ['latest'] | ||
|
||
services: | ||
redis: | ||
image: redis/redis-stack-server:${{matrix.redis-stack-version}} | ||
ports: | ||
- 6379:6379 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
|
||
- name: Install dependencies | ||
working-directory: ./backend | ||
run: | | ||
poetry install --all-extras | ||
- name: Run tests | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | ||
working-directory: ./backend | ||
run: | | ||
poetry run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
arxiv-metadata-oai-snapshot.json | ||
arxiv-papers-1000.json | ||
arxiv.zip | ||
*.DS_STORE | ||
*.log | ||
.env | ||
.ipynb_checkpoints | ||
*.pkl | ||
.venv | ||
venv | ||
__pycache__ | ||
new_backend/arxivsearch/templates/ | ||
*/.nvm | ||
.coverage* | ||
coverage.* | ||
htmlcov/ | ||
legacy-data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python Debugger: FastAPI", | ||
"type": "debugpy", | ||
"cwd": "${workspaceFolder}/backend/", | ||
"env": { | ||
"PYTHONPATH": "${cwd}" | ||
}, | ||
"request": "launch", | ||
"module": "uvicorn", | ||
"args": [ | ||
"arxivsearch.main:app", | ||
"--port=8888", | ||
"--reload" | ||
], | ||
"jinja": true, | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"python.testing.pytestArgs": [ | ||
"backend" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"python.testing.cwd": "${workspaceFolder}/backend/", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
FROM node:18.8-alpine AS ReactImage | ||
FROM node:22.0.0 AS ReactImage | ||
|
||
WORKDIR /app/frontend | ||
|
||
ENV NODE_PATH=/app/frontend/node_modules | ||
ENV PATH=$PATH:/app/frontend/node_modules/.bin | ||
|
||
COPY ./frontend/package.json ./ | ||
RUN yarn install --no-optional | ||
RUN npm install | ||
|
||
ADD ./frontend ./ | ||
RUN yarn build | ||
RUN npm run build | ||
|
||
|
||
FROM python:3.9-slim-buster AS ApiImage | ||
FROM python:3.11 AS ApiImage | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
|
||
RUN python3 -m pip install --upgrade pip setuptools wheel | ||
|
||
WORKDIR /app/ | ||
COPY ./data/ ./data | ||
VOLUME [ "/data" ] | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \ | ||
cd /usr/local/bin && \ | ||
ln -s /opt/poetry/bin/poetry && \ | ||
poetry config virtualenvs.create false | ||
|
||
RUN mkdir -p /app/backend | ||
|
||
# copy deps first so we don't have to reload everytime | ||
COPY ./backend/poetry.lock ./backend/pyproject.toml ./backend/ | ||
|
||
WORKDIR /app/backend | ||
RUN poetry install --all-extras --no-interaction | ||
|
||
COPY ./backend/ . | ||
RUN pip install -e . --no-cache-dir | ||
|
||
# add static react files to fastapi image | ||
COPY --from=ReactImage /app/frontend/build /app/backend/arxivsearch/templates/build | ||
|
||
LABEL org.opencontainers.image.source https://github.com/RedisVentures/redis-arxiv-search | ||
|
||
WORKDIR /app/backend/arxivsearch | ||
|
||
CMD ["sh", "./entrypoint.sh"] | ||
CMD ["poetry", "run", "start-app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Python | ||
__pycache__ | ||
app.egg-info | ||
*.pyc | ||
.mypy_cache | ||
.coverage | ||
htmlcov | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from fastapi import APIRouter | ||
|
||
from arxivsearch.api.routes import papers | ||
|
||
api_router = APIRouter() | ||
api_router.include_router(papers.router, prefix="/papers", tags=["papers"]) |
Oops, something went wrong.