Skip to content

Commit

Permalink
chore: remove the dev setup script (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwiktrammer authored Jan 27, 2025
1 parent e861024 commit 4e88766
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 56 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

13 changes: 5 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions check_licenses.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 0 additions & 11 deletions setup_dev_env.sh

This file was deleted.

0 comments on commit 4e88766

Please sign in to comment.