Skip to content
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

Add CI with ruff and pytest, run format #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
71 changes: 71 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install project dependencies
run: pip install -r requirements-ci.txt

- name: Run Ruff lint
run: ruff check .

format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install project dependencies
run: pip install -r requirements-ci.txt

- name: Run Ruff format
run: ruff format .

- name: Check for uncommitted changes (formatting)
run: git diff --exit-code

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install project dependencies
run: pip install -r requirements-ci.txt

- name: Run tests
run: pytest

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# rerankers

![Python Versions](https://img.shields.io/badge/Python-3.8_3.9_3.10_3.11-blue)
![Python Versions](https://img.shields.io/badge/Python-3.9_3.10_3.11_3.12-blue)
[![Downloads](https://static.pepy.tech/badge/rerankers/month)](https://pepy.tech/project/rerankers)
[![Twitter Follow](https://img.shields.io/twitter/follow/bclavie?style=social)](https://twitter.com/bclavie)

Expand Down
3 changes: 1 addition & 2 deletions examples/langchain_integration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@
],
"source": [
"from langchain.retrievers import ContextualCompressionRetriever\n",
"from langchain_openai import OpenAI\n",
"\n",
"text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n",
"texts = text_splitter.split_documents(documents)\n",
Expand All @@ -274,7 +273,7 @@
"\n",
"\n",
"compressed_docs = compression_retriever.get_relevant_documents(\n",
" \"What did the president say about the minimum wage?\"\n",
" \"What did the president say about the minimum wage?\"\n",
")\n",
"\n",
"pretty_print_docs(compressed_docs)"
Expand Down
Loading