Skip to content
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
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
!README.md
!pyproject.toml
!handler.py
!service.py
!service.py
!setup.py
!tests/fixtures/document.pdf
docketanalyzer_ocr/data/venv
125 changes: 0 additions & 125 deletions .github/workflows/ci.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Code Format

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set Up
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Check formatting
run: |
ruff format --check .

- name: Check linting
run: |
ruff check .
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run-tests:
runs-on: ubuntu-latest
env:
RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }}
RUNPOD_OCR_ENDPOINT_ID: ${{ secrets.RUNPOD_OCR_ENDPOINT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_S3_ENDPOINT_URL: ${{ secrets.AWS_S3_ENDPOINT_URL }}

steps:
- uses: actions/checkout@v3

- name: Set Up
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: Install
run: |
python -m pip install --upgrade pip
pip install '.[dev]'

- name: Test with pytest
run: |
pytest
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
archive
temp.py
junit.xml
temp
docketanalyzer_ocr/data/venv

### Flask ###
instance/*
Expand Down
42 changes: 42 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Development

## Install

```
pip install '.[dev]'
```

## Test

```
pytest -vv
```

## Format

```
ruff format . && ruff check --fix .
```

## Build and Push to PyPi

```
python -m docketanalyzer_core dev build
python -m docketanalyzer_core dev build --push
```

## Docker Container

Build and run:

```
DOCKER_BUILDKIT=1 docker build -t docketanalyzer-ocr .
docker run --gpus all -p 8000:8000 docketanalyzer-ocr
```

Push:

```
docker tag docketanalyzer-ocr nadahlberg/docketanalyzer-ocr:latest
docker push nadahlberg/docketanalyzer-ocr:latest
```
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM runpod/pytorch:2.0.1-py3.10-cuda11.8.0-devel-ubuntu22.04
WORKDIR /app

ENV PYTHONUNBUFFERED=1
ENV FORCE_GPU=1

RUN apt-get update && \
apt-get install -y libreoffice && \
Expand All @@ -14,8 +15,8 @@ RUN python -m pip install --upgrade pip

COPY . .

RUN pip install --no-cache-dir '.[gpu]'
RUN pip install --no-cache-dir .

RUN python docketanalyzer_ocr/setup/run.py
RUN python setup.py

CMD [ "uvicorn", "service:app", "--host", "0.0.0.0", "--port", "8000" ]
Loading
Loading