Skip to content

Commit

Permalink
Remove CLI (#1938)
Browse files Browse the repository at this point in the history
* Remove CLI

* Fix compose path

* Remove postgres from action

* Another trty

* Add logs?

* Move to building the image

* Change postgres host

* Modify CI/CD install workflows

* Again

* Try again

* Add validation to dockerfile

* Install lark with no binary

* Pin to poetry 1.8.4

* Add more lark checks
  • Loading branch information
NolanTrem authored Feb 7, 2025
1 parent 5238b4f commit 6f44ddf
Show file tree
Hide file tree
Showing 46 changed files with 163 additions and 6,178 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-python-full/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
python-version: ${{ inputs.python-version }}
cache: 'pip'

- name: Install R2R CLI & Python SDK
- name: Install Python SDK
shell: bash
run: |
if [ "${{ inputs.r2r-version }}" = "latest" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/start-r2r-full/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ runs:
shell: bash
run: |
cd py
poetry run r2r serve --docker --full --config-name=full_azure --build --image=r2r-local
docker compose -f r2r/compose.full.yaml --project-name r2r-full up -d
15 changes: 14 additions & 1 deletion .github/actions/start-r2r-light/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@ runs:
steps:
- name: Start R2R server
shell: bash
env:
PYTHONWARNINGS: "ignore::UserWarning"
PYTHONPATH: "/app"
run: |
cd py
poetry run r2r serve --config-name=r2r_azure_with_test_limits &
export R2R_CONFIG_NAME=r2r_azure_with_test_limits
docker build -t r2r/test .
docker compose -f r2r/compose.yaml --project-name r2r --profile postgres up -d
echo "Waiting for services to start..."
sleep 30
echo "R2R Container Logs:"
docker logs r2r-r2r-1
curl http://localhost:7272/v3/health || echo "Server not responding"
18 changes: 5 additions & 13 deletions .github/workflows/r2r-js-sdk-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ jobs:
uses: ./.github/actions/setup-python-light
with:
os: ubuntu-latest
- name: Setup and start PostgreSQL
uses: ./.github/actions/setup-postgres-ext
with:
os: ubuntu-latest
- name: Start R2R Light server
uses: ./.github/actions/start-r2r-light
- name: Use Node.js
uses: actions/setup-node@v2
with:
Expand All @@ -32,9 +26,11 @@ jobs:
- name: Install JS SDK dependencies
working-directory: ./js/sdk
run: pnpm install
- name: Check if R2R server is running
- name: Lint and Build JS SDK
run: |
curl http://localhost:7272/v2/health || echo "Server not responding"
cd js/sdk
pnpm format
pnpm build
v3-integration-tests:
needs: setup
Expand All @@ -60,7 +56,7 @@ jobs:
AZURE_API_BASE: ${{ secrets.AZURE_API_BASE }}
AZURE_API_VERSION: ${{ secrets.AZURE_API_VERSION }}
TELEMETRY_ENABLED: 'false'
R2R_POSTGRES_HOST: localhost
R2R_POSTGRES_HOST: host.docker.internal
R2R_POSTGRES_DBNAME: postgres
R2R_POSTGRES_PORT: '5432'
R2R_POSTGRES_PASSWORD: postgres
Expand All @@ -72,10 +68,6 @@ jobs:
uses: ./.github/actions/setup-python-light
with:
os: ubuntu-latest
- name: Setup and start PostgreSQL
uses: ./.github/actions/setup-postgres-ext
with:
os: ubuntu-latest
- name: Start R2R Light server
uses: ./.github/actions/start-r2r-light
- name: Use Node.js
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/r2r-light-py-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
AZURE_API_BASE: ${{ secrets.AZURE_API_BASE }}
AZURE_API_VERSION: ${{ secrets.AZURE_API_VERSION }}
TELEMETRY_ENABLED: 'false'
R2R_POSTGRES_HOST: localhost
R2R_POSTGRES_HOST: host.docker.internal
R2R_POSTGRES_DBNAME: postgres
R2R_POSTGRES_PORT: '5432'
R2R_POSTGRES_PASSWORD: postgres
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
hooks:
- id: check-print-statements
name: Check for print statements
entry: bash -c 'echo "Checking for print statements..." && find . -name "*.py" ! -path "./py/cli/*" ! -path "./py/core/examples/*" ! -path "./py/migrations/*" ! -path "./py/tests/*" | xargs grep -n "print(" || exit 0 && echo "Found print statements!" && exit 1'
entry: bash -c 'echo "Checking for print statements..." && find . -name "*.py" ! -path "./py/core/examples/*" ! -path "./py/migrations/*" ! -path "./py/tests/*" | xargs grep -n "print(" || exit 0 && echo "Found print statements!" && exit 1'
language: system
types: [python]
pass_filenames: false
Expand Down
9 changes: 7 additions & 2 deletions py/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

RUN pip install --no-cache-dir poetry
RUN pip install --no-cache-dir poetry==1.8.4


# Add Rust to PATH
Expand All @@ -20,7 +20,8 @@ COPY pyproject.toml /app/py/pyproject.toml
# Install dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --extras "core ingestion-bundle" --no-root \
&& pip install --no-cache-dir gunicorn uvicorn
&& pip install --no-cache-dir gunicorn uvicorn \
&& python -c "import lark"

# Create the final image
FROM python:3.12-slim
Expand All @@ -43,6 +44,8 @@ WORKDIR /app
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin

RUN python -c "import lark"

# Expose the port and set environment variables
ARG R2R_PORT=8000 R2R_HOST=0.0.0.0
ENV R2R_PORT=$R2R_PORT R2R_HOST=$R2R_HOST
Expand All @@ -56,5 +59,7 @@ COPY shared /app/shared
COPY r2r/r2r.toml /app/r2r.toml
COPY pyproject.toml /app/pyproject.toml

RUN python -c "import lark"

# Run the application
CMD ["sh", "-c", "uvicorn core.main.app_entry:app --host $R2R_HOST --port $R2R_PORT"]
Empty file removed py/cli/__init__.py
Empty file.
184 changes: 0 additions & 184 deletions py/cli/command_group.py

This file was deleted.

Empty file removed py/cli/commands/__init__.py
Empty file.
Loading

0 comments on commit 6f44ddf

Please sign in to comment.