diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0e0f2c9ec6a37aff31fba6db1daf278619e64609..83f3cb24c0180cfd8c7a540812e8436bdab9959c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,24 +22,26 @@ jobs: - name: Cache Poetry 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 + cache: uv - name: Install dependencies - run: | - poetry install --all-extras + run: uv pip install -e .[dev] - 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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bc3f5db02089912174025fda06c45e1a3ce915ac..6072eb129cbbc22eff9176b77a381ad61581972a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,21 +21,18 @@ jobs: - name: Cache Poetry 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 + cache: uv - name: Install dependencies - run: | - poetry install + run: uv pip install -e .[dev] - name: Analyzing the code with our lint run: | make lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee26b0c57172a7fe5b18bb732da48a3d4efe9907..9b437ed7bd05249790b1e6081c0db5251b33c2bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,16 +11,14 @@ 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 + cache: uv + - 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 +26,17 @@ 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 + cache: uv + - 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 }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a849bb3b6eca45288a499d50d321c4a896c517f9..4bd34b547a651004f60df2b637cabe231db39e64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7208e9b6b14200f1b3cd9484bd89eb2b057e74a..7713038a582fa8c6bcf5bb1b4f360482c9e33356 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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] ``` diff --git a/Makefile b/Makefile index 5f85bd41ed94db32783c2dfdf13dbf95f55b3933..502846f39775769382449d9b662486dc072cc074 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,23 @@ 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