Skip to content
Snippets Groups Projects
Unverified Commit eb04c6ab authored by James Briggs's avatar James Briggs Committed by GitHub
Browse files

Merge pull request #537 from aurelio-labs/james/uv-migration

parents 505cb23a 965080c3
No related branches found
No related tags found
No related merge requests found
......@@ -15,31 +15,30 @@ jobs:
matrix:
python-version:
- "3.13"
env:
POETRY_VERSION: "2.0.1"
steps:
- uses: actions/checkout@v4
- name: Cache Poetry
- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
path: ~/.uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install poetry
${{ runner.os }}-uv-
- name: Install uv
run: |
pipx install poetry==$POETRY_VERSION
curl -LsSf https://astral.sh/uv/install.sh | sh
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# cache: uv
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
run: uv venv --python 3.13
- name: Install dependencies
run: |
poetry install --all-extras
run: uv pip install -e .[docs]
- name: Build docs
run: |
poetry run sphinx-build -M html docs/source docs/build
uv run sphinx-build -M html docs/source docs/build
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
......
name: lint
on:
push:
branches: [ main ]
pull_request:
env:
POETRY_VERSION: "2.0.1"
jobs:
build:
runs-on: ubuntu-latest
......@@ -18,24 +13,20 @@ jobs:
- "3.13"
steps:
- uses: actions/checkout@v3
- name: Cache Poetry
- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
path: ~/.uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install poetry
${{ runner.os }}-uv-
- name: Install uv
run: |
pipx install poetry==$POETRY_VERSION
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
run: uv venv --python 3.13
- name: Install dependencies
run: |
poetry install
run: uv pip install -e .[dev]
- name: Analyzing the code with our lint
run: |
make lint
......@@ -11,16 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.13'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
run: uv venv --python 3.13
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: poetry install
run: uv pip install -e .[dev]
- name: Build
run: poetry build
run: uv build
publish:
needs: build
......@@ -28,15 +25,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.13'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 2.0.1
run: uv venv --python 3.13
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: uv pip install -e .[dev]
- name: Build
run: uv build
- name: Publish to PyPI
run: |
poetry config repositories.remote https://upload.pypi.org/legacy/
poetry --no-interaction -v publish --build --repository remote --username "__token__" --password "$PYPI_API_TOKEN"
uv config repositories.remote https://upload.pypi.org/legacy/
uv --no-interaction -v publish --build --repository remote --username "__token__" --password "$PYPI_API_TOKEN"
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
......@@ -4,9 +4,6 @@ on:
pull_request:
env:
POETRY_VERSION: "2.0.1"
jobs:
build:
runs-on: ubuntu-latest
......@@ -17,7 +14,7 @@ jobs:
PORT: 5080
PINECONE_HOST: localhost
ports:
- "5080-6000:5080-6000"
- "5080-6000:5080-6000"
strategy:
matrix:
......@@ -28,43 +25,38 @@ jobs:
- "3.13"
steps:
- uses: actions/checkout@v4
- name: Cache Poetry
- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
path: ~/.uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
${{ runner.os }}-uv-
- name: Wait for Pinecone service to start
run: |
echo "Waiting for Pinecone service to start..."
sleep 10 # Wait for 10 seconds to ensure the container is up
- name: Install poetry
- name: Install uv
run: |
pipx install poetry==$POETRY_VERSION
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
run: uv venv --python 3.13
# only needed for local testing
# - name: Add Poetry to PATH
# run: echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install --all-extras
run: uv pip install -e .[all]
- name: Install nltk
run: |
pip install nltk
run: uv pip install nltk
- name: Download nltk data
run: |
python -m nltk.downloader punkt stopwords wordnet punkt_tab
uv run python -m nltk.downloader punkt stopwords wordnet punkt_tab
- name: Pytest All
env:
PINECONE_API_KEY: pclocal
......
......@@ -32,7 +32,7 @@ repos:
language: python
types: [ text ]
args: [ "--write-changes", "--ignore-words-list", "asend" ]
exclude: "poetry.lock"
exclude: "uv.lock"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
......
......@@ -27,6 +27,7 @@ While we encourage you to initiate a draft Pull Request early to get feedback on
1. Fork on GitHub:
Go to the [repository's page](https://github.com/aurelio-labs/semantic-router) on GitHub:
Click the "Fork" button in the top-right corner of the page.
2. Clone Your Fork:
After forking, you'll be taken to your new fork of the repository on GitHub. Copy the URL of your fork from the address bar or by clicking the "Code" button and copying the URL under "Clone with HTTPS" or "Clone with SSH".
Open your terminal or command prompt.
......@@ -34,18 +35,20 @@ While we encourage you to initiate a draft Pull Request early to get feedback on
```
git clone https://github.com/<your-gh-username>/<semantic-router>.git
```
3. Ensure you have poetry installed: `pip install poetry`.
4. Then navigate to the cloned folder, create a virtualenv, and install via poetry (which defaults to an editable installation):
3. Ensure you have [`uv` installed](https://docs.astral.sh/uv/getting-started/installation/), for macos and linux use `curl -LsSf https://astral.sh/uv/install.sh | sh`.
4. Then navigate to the cloned folder, create a virtualenv, and install via `uv`:
```
# Move into the cloned folder
cd semantic-router/
# Create a virtual environment
python3 -m venv venv
uv venv --python 3.13
# Activate the environment
source venv/bin/activate
source .venv/bin/activate
# Install via poetry with all extras relevant to perform unit tests
poetry install --all-extras
# Install via uv with all extras relevant to perform unit tests
uv pip install -e .[dev]
```
format:
poetry run black --target-version py313 -l 88 .
poetry run ruff --select I --fix .
uv run black --target-version py313 -l 88 .
uv run ruff --select I --fix .
PYTHON_FILES=.
lint: PYTHON_FILES=.
lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')
lint lint_diff:
poetry run black --target-version py313 -l 88 $(PYTHON_FILES) --check
poetry run ruff check .
poetry run mypy $(PYTHON_FILES)
uv run black --target-version py313 -l 88 $(PYTHON_FILES) --check
uv run ruff check .
uv run mypy $(PYTHON_FILES)
test:
poetry run pytest -vv --cov=semantic_router --cov-report=term-missing --cov-report=xml --exitfirst --maxfail=1
uv run pytest -vv --cov=semantic_router --cov-report=term-missing --cov-report=xml --exitfirst --maxfail=1
test_functional:
poetry run pytest -vv -s --exitfirst --maxfail=1 tests/functional
uv run pytest -vv -s --exitfirst --maxfail=1 tests/functional
test_unit:
poetry run pytest -vv --exitfirst --maxfail=1 tests/unit
uv run pytest -vv --exitfirst --maxfail=1 tests/unit
test_integration:
poetry run pytest -vv --exitfirst --maxfail=1 tests/integration
uv run pytest -vv --exitfirst --maxfail=1 tests/integration
This diff is collapsed.
[tool.poetry]
[project]
name = "semantic-router"
version = "0.1.0.dev10"
description = "Super fast semantic router for AI decision making"
authors = ["Aurelio AI <hello@aurelio.ai>"]
authors = [{ name = "Aurelio AI", email = "hello@aurelio.ai" }]
requires-python = ">=3.9,<3.14"
readme = "README.md"
packages = [{include = "semantic_router"}]
license = "MIT"
dependencies = [
"pydantic>=2.10.2,<3",
"openai>=1.10.0,<2.0.0",
"numpy>=1.25.2,<2",
"colorlog>=6.8.0,<7",
"pyyaml>=6.0.1,<7",
"aurelio-sdk>=0.0.18,<0.0.19",
"colorama>=0.4.6,<0.5",
"regex>=2023.12.25",
"tiktoken>=0.6.0,<1.0.0",
"requests-mock>=1.12.1,<2",
"aiohttp>=3.10.11,<4",
"psycopg2-binary>=2.9.9,<3",
"tornado>=6.4.2,<7",
]
[tool.poetry.dependencies]
python = ">=3.9,<3.14"
pydantic = "^2.10.2"
openai = ">=1.10.0,<2.0.0"
cohere = {version = ">=5.9.4,<6.00", optional = true}
mistralai= {version = ">=0.0.12,<0.1.0", optional = true}
numpy = "^1.25.2"
colorlog = "^6.8.0"
pyyaml = "^6.0.1"
aurelio-sdk = {version = "^0.0.18"}
pinecone-text = {version = ">=0.7.1", optional = true}
torch = {version = ">=2.1.0,<2.6.0", optional = true, python = "<3.13" }
transformers = {version = ">=4.36.2", optional = true, python = "<3.13" }
tokenizers = {version = ">=0.19", optional = true, python = "<3.13" }
llama-cpp-python = {version = ">=0.2.28,<0.2.86", optional = true, python = "<3.13" }
colorama = "^0.4.6"
pinecone = {version=">=5.0.0", optional = true}
regex = ">=2023.12.25"
torchvision = { version = ">=0.17.0,<0.18.0", optional = true, python = "<3.13" }
pillow = { version = ">=10.2.0,<11.0.0", optional = true, python = "<3.13" }
tiktoken = ">=0.6.0,<1.0.0"
qdrant-client = {version = "^1.11.1", optional = true}
google-cloud-aiplatform = {version = "^1.45.0", optional = true}
requests-mock = "^1.12.1"
boto3 = { version = "^1.34.98", optional = true }
botocore = {version = "^1.34.110", optional = true}
aiohttp = "^3.10.11"
fastembed = {version = "^0.3.0", optional = true, python = "<3.13" }
psycopg2-binary = {version = "^2.9.9", optional = true}
sphinx = {version = "^7.0.0", optional = true}
sphinxawesome-theme = {version = "^5.2.0", optional = true}
tornado = {version = "^6.4.2", optional = true}
[project.optional-dependencies]
hybrid = ["pinecone-text>=0.7.1"]
local = [
"torch>=2.1.0,<2.6.0 ; python_version < '3.13'",
"transformers>=4.36.2 ; python_version < '3.13'",
"tokenizers>=0.19 ; python_version < '3.13'",
"llama-cpp-python>=0.2.28,<0.2.86 ; python_version < '3.13'",
]
pinecone = ["pinecone>=5.0.0,<6.0.0"]
vision = [
"torch>=2.1.0,<2.6.0 ; python_version < '3.13'",
"torchvision>=0.17.0,<0.18.0 ; python_version < '3.13'",
"transformers>=4.36.2 ; python_version < '3.13'",
"pillow>=10.2.0,<11.0.0 ; python_version < '3.13'",
]
mistralai = ["mistralai>=0.0.12,<0.1.0"]
qdrant = ["qdrant-client>=1.11.1,<2"]
google = ["google-cloud-aiplatform>=1.45.0,<2"]
bedrock = [
"boto3>=1.34.98,<2",
"botocore>=1.34.110,<2",
]
postgres = []
fastembed = ["fastembed>=0.3.0,<0.4 ; python_version < '3.13'"]
docs = [
"sphinx>=7.0.0,<8",
"sphinxawesome-theme>=5.2.0,<6",
]
cohere = ["cohere>=5.9.4,<6.00"]
all = [
"semantic-router[local]",
"semantic-router[hybrid]",
"semantic-router[pinecone]",
"semantic-router[vision]",
"semantic-router[mistralai]",
"semantic-router[qdrant]",
"semantic-router[google]",
"semantic-router[bedrock]",
"semantic-router[postgres]",
"semantic-router[fastembed]",
"semantic-router[cohere]",
]
[tool.poetry.extras]
hybrid = ["pinecone-text"]
local = ["torch", "transformers", "tokenizers", "huggingface-hub", "llama-cpp-python"]
pinecone = ["pinecone"]
vision = ["torch", "torchvision", "transformers", "pillow"]
mistralai = ["mistralai"]
qdrant = ["qdrant-client"]
google = ["google-cloud-aiplatform"]
bedrock = ["boto3", "botocore"]
postgres = ["psycopg2"]
fastembed = ["fastembed"]
docs = ["sphinx", "sphinxawesome-theme"]
cohere = ["cohere"]
[tool.uv.sources]
torch = { git = "https://github.com/pytorch/pytorch.git" }
torchvision = { git = "https://github.com/pytorch/vision.git" }
[tool.poetry.group.dev.dependencies]
ipykernel = "^6.25.0"
ruff = "^0.1.5"
pytest = "^8.2"
pytest-mock = "^3.12.0"
pytest-cov = "^4.1.0"
pytest-xdist = "^3.5.0"
pytest-asyncio = "^0.24.0"
mypy = "^1.7.1"
types-pyyaml = "^6.0.12.12"
types-requests = "^2.31.0"
black = {extras = ["jupyter"], version = ">=23.12.1,<24.5.0"}
[dependency-groups]
dev = [
"ipykernel>=6.25.0,<7",
"ruff>=0.1.5,<0.2",
"pytest~=8.2",
"pytest-mock>=3.12.0,<4",
"pytest-cov>=4.1.0,<5",
"pytest-xdist>=3.5.0,<4",
"pytest-asyncio>=0.24.0,<0.25",
"mypy>=1.7.1,<2",
"types-pyyaml>=6.0.12.12,<7",
"types-requests>=2.31.0,<3",
"black[jupyter]>=23.12.1,<24.5.0",
]
[tool.hatch.build.targets.sdist]
include = ["semantic_router"]
[tool.hatch.build.targets.wheel]
include = ["semantic_router"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff.per-file-ignores]
"*.ipynb" = ["ALL"]
......
uv.lock 0 → 100644
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment