diff --git a/.github/workflows/extremes.yml b/.github/workflows/extremes.yml index 3ea81d741..d167d1429 100644 --- a/.github/workflows/extremes.yml +++ b/.github/workflows/extremes.yml @@ -48,7 +48,6 @@ jobs: matrix: python-version: ["3.8"] os: [ubuntu-latest] - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -87,7 +86,6 @@ jobs: matrix: python-version: ["3.9"] os: [ubuntu-latest] - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -117,7 +115,6 @@ jobs: echo "$DEPS" | grep 'scipy==1.8.0' echo "$DEPS" | grep 'scikit-learn==1.3.0' echo "$DEPS" | grep 'dask==2024.7' - - name: Run pytest run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8fd4d1841..28056228f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -11,7 +11,6 @@ jobs: matrix: python-version: ["3.8"] os: [windows-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -25,6 +24,7 @@ jobs: cache-suffix: ${{ matrix.python-version }} cache-dependency-glob: "pyproject.toml" - name: install-reqs + # Python3.8 is technically at end-of-life, so we don't test everything run: uv pip install -e ".[dev]" --system - name: show-deps run: uv pip freeze @@ -36,7 +36,6 @@ jobs: matrix: python-version: ["3.10", "3.12"] os: [windows-latest] - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -50,22 +49,17 @@ jobs: cache-suffix: ${{ matrix.python-version }} cache-dependency-glob: "pyproject.toml" - name: install-reqs - run: uv pip install -e ".[dev]" --system - - name: install-dask - run: uv pip install --upgrade dask[dataframe] --system - - name: install-modin - run: uv pip install --upgrade modin --system + run: uv pip install -e ".[dev, extra]" --system - name: show-deps run: uv pip freeze - name: Run pytest run: pytest tests --cov=narwhals --cov=tests --runslow --cov-fail-under=95 - pytest-coverage: + pytest-full-coverage: strategy: matrix: python-version: ["3.9", "3.11", "3.13"] os: [ubuntu-latest] - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -79,9 +73,7 @@ jobs: cache-suffix: ${{ matrix.python-version }} cache-dependency-glob: "pyproject.toml" - name: install-reqs - run: uv pip install -e ".[dev]" --system - - name: install-modin - run: uv pip install --upgrade modin[dask] --system + run: uv pip install -e ".[dev, extra]" --system - name: show-deps run: uv pip freeze - name: install ibis @@ -92,5 +84,6 @@ jobs: - name: Run pytest run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=100 --runslow - name: Run doctests + # reprs differ between versions, so we only run doctests on the latest Python if: matrix.python-version == '3.13' run: pytest narwhals --doctest-modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d7285907..7083129a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,7 +96,8 @@ Here's how you can set up your local development environment to contribute. uv venv -p 3.12 --seed ``` 4. Activate it. On Linux, this is `. .venv/bin/activate`, on Windows `.\.venv\Scripts\activate`. -2. Install Narwhals: `uv pip install -e ".[dev, docs]"` +2. Install Narwhals: `uv pip install -e ".[dev, docs]"`. If you also want to test Dask , PySpark, and + Modin, you can install them too with `uv pip install -e ".[dev, docs, extra]"`. 3. Install a fork of griffe: ``` uv pip install git+https://github.com/MarcoGorelli/griffe.git@no-overloads diff --git a/pyproject.toml b/pyproject.toml index 23568e5dc..e2e6d2e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,17 +34,19 @@ dev = [ "duckdb", "pandas", "polars", + "pre-commit", "pyarrow", - "pyspark; python_version >= '3.9' and python_version < '3.12'", "pyarrow-stubs", "pytest", "pytest-cov", "pytest-randomly", "pytest-env", - "hypothesis", "hypothesis[numpy]", - "scikit-learn", "typing_extensions", +] +extra = [ # heavier dependencies we don't necessarily need in every testing job + "scikit-learn", + "pyspark; python_version >= '3.9' and python_version < '3.12'", "dask[dataframe]; python_version >= '3.9'", ] docs = [ @@ -175,22 +177,18 @@ env = [ plugins = ["covdefaults"] [tool.coverage.report] +fail_under = 80 # This is just for local development, in CI we set it to 100 omit = [ 'narwhals/typing.py', 'narwhals/stable/v1/typing.py', 'narwhals/this.py', - # we can't run this in every environment that we measure coverage on due to upper-bound constraits - 'narwhals/_ibis/*', - # the latest pyspark (3.5) doesn't officially support Python 3.12 and 3.13 - 'narwhals/_spark_like/*', + # we don't run these in every environment 'tests/spark_like_test.py', ] exclude_also = [ "if sys.version_info() <", - "if (:?self._)?implementation is Implementation.MODIN", "if .*implementation is Implementation.CUDF", 'request.applymarker\(pytest.mark.xfail', - '\w+._backend_version < ', 'backend_version <', 'if "cudf" in str\(constructor' ]