Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
- [ ] I've read the [`CONTRIBUTING.md`](https://github.com/Giskard-AI/ai-inspector/blob/master/CONTRIBUTING.md) guide.
- [ ] I've written tests for all new methods and classes that I created.
- [ ] I've written the docstring in Google format for all the methods and classes that I used.
- [ ] I've updated the `pdm.lock` running `pdm update-lock` (only applicable when `pyproject.toml` has been
- [ ] I've updated the `uv.lock` running `uv lock` (only applicable when `pyproject.toml` has been
modified)
110 changes: 53 additions & 57 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ concurrency:
cancel-in-progress: true
env:
GSK_DISABLE_ANALYTICS: true
GISKARD_DEV_MODE: true
GSK_DISABLE_SENTRY: true
defaults:
run:
Expand Down Expand Up @@ -116,12 +117,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: ${{ matrix.python-version }}
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false

- name: Cache Giskard test resources
uses: actions/cache@v4
Expand All @@ -138,14 +137,14 @@ jobs:
- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-2022' }}
run: |
pdm install -G :all --without tensorflow
pdm list
uv sync --all-groups --extra llm --extra talk
uv pip list

- name: Install dependencies
if: ${{ matrix.os != 'windows-2022' }}
run: |
pdm install -G :all
pdm list
uv sync --all-groups --extra llm --extra talk --extra tensorflow
uv pip list

- name: Check yet again new disk space
run: |
Expand All @@ -154,49 +153,49 @@ jobs:
- name: Re-install lightgbm from sources for MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
pdm run pip uninstall lightgbm -y
pdm run pip install --no-binary lightgbm lightgbm --config-settings=cmake.define.USE_OPENMP=OFF
uv run pip uninstall lightgbm -y
uv run pip install --no-binary lightgbm lightgbm --config-settings=cmake.define.USE_OPENMP=OFF
brew install libomp

- name: Install pydantic v1
if: ${{ matrix.pydantic_v1 }}
run: |
pdm run pip uninstall pydantic pydantic_core -y
pdm run pip install "pydantic>=1,<2"
uv pip uninstall pydantic pydantic_core -y
uv pip install "pydantic>=1,<2"

- name: Check Pydantic installed version
run: |
pdm run pip freeze | grep '^pydantic'
pdm run pip freeze | grep -q '^pydantic==${{ matrix.pydantic_v1 && '1' || '2' }}\.'
uv pip list | grep -i pydantic
uv run python -c "import pydantic; assert pydantic.__version__.startswith('${{ matrix.pydantic_v1 && '1' || '2' }}.'), f'Wrong pydantic version: {pydantic.__version__}'"

- name: Install langchain minimal version
if: ${{ matrix.langchain_minimal }}
run: |
pdm run pip uninstall langchain -y
pdm run pip install "langchain==0.0.275"
uv pip uninstall langchain -y
uv pip install "langchain==0.0.275"

- name: Check langchain installed version
if: ${{ matrix.langchain_minimal }}
run: |
pdm run pip freeze | grep '^langchain'
pdm run pip freeze | grep -q '^langchain==0.0.275'
uv pip list | grep -i langchain
uv run python -c "import langchain; assert langchain.__version__ == '0.0.275'"

- name: Install pandas v1
if: ${{ matrix.pandas_v1 }}
run: |
pdm run pip uninstall pandas -y
pdm run pip install "pandas<2"
uv pip uninstall pandas -y
uv pip install "pandas>=1.0,<2.0"

- name: Check Pandas installed version
run: |
pdm run pip freeze | grep '^pandas'
pdm run pip freeze | grep -q '^pandas==${{ matrix.pandas_v1 && '1' || '2' }}\.'
uv pip list | grep -i pandas
uv run python -c "import pandas; version = pandas.__version__; print(f'pandas version: {version}'); assert version.startswith('${{ matrix.pandas_v1 && '1' || '2' }}.'), f'Expected pandas v${{ matrix.pandas_v1 && '1' || '2' }}.x, got {version}'"

- name: Lint code
run: pdm run lint
run: uv run ruff check giskard tests

- name: Test code
run: pdm test-fast
run: uv run pytest -c pyproject.toml --cov=giskard --cov-report=xml --cov-append --disable-warnings --no-header -vv --durations=0 -n auto -m 'not slow' --use-subprocess tests
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: 2

Expand All @@ -208,7 +207,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Build
run: pdm build
run: uv build

- name: "Python client: archive built artifacts"
# Upload needs to be done only once by workflo run, so we need to select one only in the matrix
Expand All @@ -221,7 +220,7 @@ jobs:
if: ${{ inputs.run-integration-tests }}
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: 2
run: pdm test-slow tests/
run: uv run pytest -c pyproject.toml --cov=giskard --cov-report=xml --cov-append --disable-warnings --no-header -vv --durations=0 -m 'slow' --use-subprocess tests/

- name: "Memory csv"
if: ${{ always() && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && !matrix.langchain_minimal && !matrix.pandas_v1 && !matrix.pydantic_v1 }}
Expand All @@ -247,14 +246,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false
- name: Build wheel
run: pdm build
run: uv build
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Create new project, install wheel and import (Poetry)
Expand All @@ -271,42 +268,43 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false
- name: Build wheel
run: pdm build
run: uv build
- name: Create new project, install wheel and import (Pip)
run: |
python -m venv .venv-test-pip
source .venv-test-pip/bin/activate
python -m pip install "$(ls ./dist/*.whl)"
python -c "import giskard"
install-pdm:
name: "Check if wheel can be installed with PDM"
install-uv:
name: "Check if wheel can be installed with UV"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false
- name: Build wheel
run: pdm build
- name: Create new project, install wheel and import (PDM)
run: uv build
- name: Create new project, install wheel and import (UV)
run: |
mkdir ./install-run
cd ./install-run
pdm init --python 3.10 -n
sed -i 's/^\(requires-python *= *\).*$/\1">=3.10,<3.12"/' pyproject.toml
pdm add "$(ls ../dist/*.whl)"
pdm run python -c "import giskard"
mkdir -p /tmp/install-run
cd /tmp/install-run
cat > pyproject.toml << 'EOF'
[project]
name = "install-run"
version = "0.1.0"
requires-python = ">=3.10,<3.13"
dependencies = []
EOF
uv add "$(ls ${{ github.workspace }}/dist/*.whl)"
uv run python -c "import giskard"
check-doc:
name: "Build and check doc"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -346,27 +344,25 @@ jobs:
with:
fetch-depth: 0

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false

- name: Set up Pandoc (needed for doc)
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: "3.1.7" # https://github.com/jgm/pandoc/releases

- name: Install dependencies
run: pdm install -G :all
run: uv sync --all-groups --extra llm --extra talk --extra tensorflow

- name: Check new disk space
run: |
df -h

- name: Build doc
run: pdm doc
run: uv run sphinx-build docs docs/_build/html

- name: Check doc
run: pdm check-doc
run: uv run python ./docs/scrapper.py
16 changes: 8 additions & 8 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ jobs:
ref: main
token: ${{ secrets.RELEASE_PAT_TOKEN }} # Needed to trigger other actions

- name: Edit pyproject.toml
run: sed -i 's/^\(version *= *\).*$/\1"${{ env.VERSION_NUMBER }}"/' pyproject.toml

- name: Remove dark theme logo from README
run: sed -i 's/.*#gh-dark-mode-only.*//' README.md

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false
- name: Change version
run: |
set -euo pipefail
uv version "${INPUT_VERSION}"

- name: "@slack Release process started"
id: slack
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:

# build .tar.gz sdist tarball
- name: Build source distribution tarball
run: pdm build
run: uv build

- name: Create Github Release
id: github-release
Expand All @@ -101,7 +101,7 @@ jobs:
dist/giskard-*.whl

- name: Push to Pipy
run: pdm publish --no-build --username "${{ secrets.PIPY_USERNAME }}" --password "${{ secrets.PIPY_PASSWORD }}"
run: uv publish --username "${{ secrets.PIPY_USERNAME }}" --password "${{ secrets.PIPY_PASSWORD }}"

- name: Set job success env var
run: |
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/lock-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:
jobs:
lock-deps:
if: ${{ !github.event.pull_request || contains( github.event.pull_request.labels.*.name, 'Lockfile') }}
name: "Lock dependencies using PDM"
name: "Lock dependencies using UV"
runs-on: ubuntu-latest
continue-on-error: false # https://ncorti.com/blog/howto-github-actions-build-matrix
steps:
Expand Down Expand Up @@ -51,15 +51,13 @@ jobs:
token: ${{ secrets.RELEASE_PAT_TOKEN }} # Needed to trigger other actions
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Setup UV
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
python-version: "3.10"
version: head # Issue with PDM 2.20.1: https://github.com/pdm-project/pdm/issues/3271
cache: false

- name: Install dependencies
run: rm -rf pdm.lock && pdm lock -G :all
run: rm -rf uv.lock && uv lock

- name: Configure git
run: |
Expand All @@ -68,8 +66,8 @@ jobs:

- name: Adding file
run: |
git add pdm.lock
git commit -m "Regenerating pdm.lock" --allow-empty
git add uv.lock
git commit -m "Regenerating uv.lock" --allow-empty

- name: Remove label
if: ${{ github.event.pull_request}}
Expand Down
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,8 @@ ipython_config.py
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
.pdm-python

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and similar tools
__pypackages__/

# Celery stuff
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ build:
python: "3.10"
jobs:
post_create_environment:
- pip install pdm
- pdm export --without-hashes -G doc,llm -o requirements-sphinx.txt
- pip install uv
- uv export --no-hashes --group doc --extra llm -o requirements-sphinx.txt

sphinx:
configuration: docs/conf.py
Expand Down
8 changes: 4 additions & 4 deletions docs/community/contribution_guidelines/dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ After cloning the repository here are the useful commands to set up the local en

## Install dependencies

We work with [PDM](https://pdm-project.org/en/latest/) as our package manager. You can find the installation instructions [here](https://pdm-project.org/en/latest/#installation).
We work with [uv](https://docs.astral.sh/uv/) as our Python package and project manager. You can find the installation instructions [here](https://docs.astral.sh/uv/getting-started/installation/).

After installing PDM, we can install the dependencies by running:
After installing uv, we can install the dependencies by running:

```shell
pdm install
uv sync --all-extras --all-groups
```

## Pre-commit hooks installation
Pre-commit hooks ensure that the basic code quality checks are performed before the code is committed. Pre-commit has already been installed as a dev dependency using `pdm`.
Pre-commit hooks ensure that the basic code quality checks are performed before the code is committed. Pre-commit has already been installed as a dev dependency using `uv`.

The current pre-commit hook configuration is defined in `.pre-commit-config.yaml`.

Expand Down
Loading
Loading