diff --git a/.github/scripts/build_sdist_and_wheel.sh b/.github/scripts/build_sdist_and_wheel.sh index 6a1b24d1..8ce47042 100755 --- a/.github/scripts/build_sdist_and_wheel.sh +++ b/.github/scripts/build_sdist_and_wheel.sh @@ -3,13 +3,18 @@ # Build sdist and wheel python -m pip install -U pip python -m pip install build +cd bindings/python +ln -sf ../../outlines-core outlines-core-lib +sed -i '' 's|path = "../../outlines-core"|path = "outlines-core-lib"|' Cargo.toml python -m build +cd ../.. + # Check sdist install and imports mkdir -p test-sdist cd test-sdist python -m venv venv-sdist -venv-sdist/bin/python -m pip install ../dist/outlines_core-*.tar.gz +venv-sdist/bin/python -m pip install ../bindings/python/dist/outlines_core-*.tar.gz venv-sdist/bin/python -c "import outlines_core" cd .. @@ -17,6 +22,6 @@ cd .. mkdir -p test-wheel cd test-wheel python -m venv venv-wheel -venv-wheel/bin/python -m pip install ../dist/outlines_core-*.whl +venv-wheel/bin/python -m pip install ../bindings/python/dist/outlines_core-*.whl venv-wheel/bin/python -c "import outlines_core" cd .. diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9d24534c..f5b00869 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,10 +32,10 @@ jobs: - name: Set up test environment run: | python -m pip install --upgrade pip - pip install .[test] + cd bindings/python && pip install '.[test]' - name: Run tests run: | - pytest --cov=src/outlines_core + cd bindings/python && pytest --cov=src/outlines_core - name: Upload coverage data uses: actions/upload-artifact@v3 with: @@ -60,7 +60,7 @@ jobs: - name: Set up environment run: | - pip install --upgrade "coverage[toml]>=5.1" diff-cover + cd bindgins/python && pip install --upgrade "coverage[toml]>=5.1" diff-cover - uses: actions/download-artifact@v3 with: @@ -76,10 +76,10 @@ jobs: # python -m coverage combine # Produce an html report with absolute coverage information - python -m coverage html --skip-covered --skip-empty + cd bindgins/python && python -m coverage html --skip-covered --skip-empty # Report relative coverage and write to the workflow's summary - python -m coverage xml + cd bindings/python && python -m coverage xml diff-cover coverage.xml --markdown-report=coverage.md --fail-under=100 || (cat coverage.md >> $GITHUB_STEP_SUMMARY && exit 1) - name: Upload HTML report if check failed. diff --git a/.gitignore b/.gitignore index 1f8c7e63..4116ab19 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,12 @@ docs/build *.gguf .venv benchmarks/results +.benchmarks **/target/ **/dist/ bindings/python/build bindings/python/src/outlines_core +bindings/python/outlines-core-lib +test-sdist/ +test-wheel/