From 4e887662042f3bb4a6ae29f6e7165b1872ef8a6e Mon Sep 17 00:00:00 2001 From: Ludwik Trammer Date: Mon, 27 Jan 2025 13:19:53 +0100 Subject: [PATCH] chore: remove the dev setup script (#304) --- .github/workflows/ci.yml | 40 +++++++------------ .github/workflows/documentation.yaml | 6 +-- CONTRIBUTING.md | 13 +++--- check_licenses.sh | 2 - .../ingestion/providers/base.py | 2 +- .../tests/unit/test_document_search.py | 6 +-- setup_dev_env.sh | 11 ----- 7 files changed, 24 insertions(+), 56 deletions(-) delete mode 100755 setup_dev_env.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02b7475ca..f05333de9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,19 +33,15 @@ jobs: path: ~/.cache/pre-commit key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: Install Dependencies - run: source ./setup_dev_env.sh - - name: Run pre-commit checks run: | - source .venv/bin/activate - pre-commit run --all-files --show-diff-on-failure --color always + uv run pre-commit run --all-files --show-diff-on-failure --color always - name: Run ruff formatter - run: uvx ruff format --check + run: uv run ruff format --check - name: Run ruff linter - run: uvx ruff check + run: uv run ruff check - name: Run mypy run: uv run mypy . @@ -79,21 +75,18 @@ jobs: - name: Check licenses run: | - source .venv/bin/activate - ./check_licenses.sh + uv run ./check_licenses.sh - name: Check documentation builds correctly run: | - source .venv/bin/activate - mkdocs build --strict + uv run mkdocs build --strict - name: Generate pip freeze run: | - source .venv/bin/activate - pip freeze > requirements-freeze.txt + uv pip freeze > requirements-freeze.txt - name: Publish Artefacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() continue-on-error: true with: @@ -105,7 +98,7 @@ jobs: retention-days: 30 - name: Publish Test Report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() continue-on-error: true with: @@ -115,11 +108,10 @@ jobs: - name: Validate package build run: | - source .venv/bin/activate for dir in packages/*/; do uv build "$dir" --out-dir dist; done - name: Publish Package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 continue-on-error: true if: success() with: @@ -138,7 +130,7 @@ jobs: strategy: fail-fast: false # do not stop all jobs if one fails matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -167,16 +159,12 @@ jobs: path: ~/nltk_data key: nltk-${{ runner.os }} - - name: Install Dependencies - run: source ./setup_dev_env.sh - - name: Run Tests With Coverage run: | # run with coverage to not execute tests twice - source .venv/bin/activate - coverage run -m pytest -v -p no:warnings --junitxml=report.xml - coverage report - coverage xml + uv run coverage run -m pytest -v -p no:warnings --junitxml=report.xml + uv run coverage report + uv run coverage xml - name: Test Report uses: mikepenz/action-junit-report@v4 @@ -186,7 +174,7 @@ jobs: report_paths: 'report.xml' - name: Publish Test Report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 continue-on-error: true if: always() with: diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 1dc654e32..8e5c9e7db 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -33,13 +33,9 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - - name: Install Dependencies - shell: bash - run: source ./setup_dev_env.sh - - name: Deploy docs shell: bash - run: ./.github/scripts/deploy_docs.sh + run: uv run ./.github/scripts/deploy_docs.sh env: GCP_KEY: ${{ secrets.GCP_KEY }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ebc29d77..79a5c0c18 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,25 +2,22 @@ ## Build from source -To build and run Ragbits from the source code: +Dependencies needed to build and run Ragbits from the source code: -1. Requirements: [**uv**](https://docs.astral.sh/uv/getting-started/installation/) & [**python**](https://docs.astral.sh/uv/guides/install-python/) 3.10 or higher -2. Install dependencies and run venv in editable mode: +1. [**uv**](https://docs.astral.sh/uv/getting-started/installation/) +2. [**python**](https://docs.astral.sh/uv/guides/install-python/) 3.10 -```bash -$ source ./setup_dev_env.sh -``` ## Linting and formatting We use `ruff` for linting and formatting our code. To format your code, run: ```bash -$ uvx ruff format +$ uv run ruff format ``` To lint the code, run: ```bash -$ uvx ruff check --fix +$ uv run ruff check --fix ``` ## Type checking diff --git a/check_licenses.sh b/check_licenses.sh index 0a88bacd5..0febd1f07 100755 --- a/check_licenses.sh +++ b/check_licenses.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -source .venv/bin/activate - uv run pip-licenses --from=mixed --ignore-packages `cat .libraries-whitelist.txt`> licenses.txt cat licenses.txt diff --git a/packages/ragbits-document-search/src/ragbits/document_search/ingestion/providers/base.py b/packages/ragbits-document-search/src/ragbits/document_search/ingestion/providers/base.py index 69f90c617..077aa6df3 100644 --- a/packages/ragbits-document-search/src/ragbits/document_search/ingestion/providers/base.py +++ b/packages/ragbits-document-search/src/ragbits/document_search/ingestion/providers/base.py @@ -13,7 +13,7 @@ class DocumentTypeNotSupportedError(Exception): """ def __init__(self, provider_name: str, document_type: DocumentType) -> None: - message = f"Document type {document_type} is not supported by the {provider_name}" + message = f"Document type {document_type.value} is not supported by the {provider_name}" super().__init__(message) diff --git a/packages/ragbits-document-search/tests/unit/test_document_search.py b/packages/ragbits-document-search/tests/unit/test_document_search.py index e5fc00d47..139e146a3 100644 --- a/packages/ragbits-document-search/tests/unit/test_document_search.py +++ b/packages/ragbits-document-search/tests/unit/test_document_search.py @@ -290,9 +290,9 @@ async def test_document_search_ingest_from_uri_with_wildcard( results = await document_search.search(search_query) # Check that we have the expected number of results - assert len(results) == len(expected_contents), ( - f"Expected {len(expected_contents)} result(s) but got {len(results)}" - ) + assert len(results) == len( + expected_contents + ), f"Expected {len(expected_contents)} result(s) but got {len(results)}" # Verify each result is a TextElement assert all(isinstance(result, TextElement) for result in results) diff --git a/setup_dev_env.sh b/setup_dev_env.sh deleted file mode 100755 index 73021df54..000000000 --- a/setup_dev_env.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -if [ ! -d .venv ]; then - uv venv --python 3.10 - source .venv/bin/activate - - # Install all packages in editable mode - uv sync -fi - -source .venv/bin/activate