Skip to content

Commit

Permalink
quite a refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Jan 30, 2025
2 parents b65586f + 83c1b2a commit 2edd7e1
Show file tree
Hide file tree
Showing 237 changed files with 8,705 additions and 6,688 deletions.
296 changes: 170 additions & 126 deletions .github/workflows/downstream_tests.yml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV


- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
Expand All @@ -30,6 +29,6 @@ jobs:
- name: griffe
# hopefully temporary until https://github.com/mkdocstrings/mkdocstrings/issues/716
run: pip install git+https://github.com/MarcoGorelli/griffe.git@no-overloads
- run: pip install -e .[docs]
- run: pip install -e .[docs,dask,duckdb]

- run: mkdocs gh-deploy --force
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ jobs:
- 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
run: pytest narwhals/*.py --doctest-modules
1 change: 1 addition & 0 deletions docs/api-reference/dataframe.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- to_native
- to_numpy
- to_pandas
- to_polars
- unique
- unpivot
- with_columns
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set operations are supported:
- boolean
- by_dtype
- categorical
- matches
- numeric
- string
show_root_heading: false
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/series.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
- to_list
- to_numpy
- to_pandas
- to_polars
- to_native
- unique
- value_counts
Expand Down
10 changes: 10 additions & 0 deletions docs/backcompat.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ before making any change.

### After `stable.v1`

The following are differences between the main Narwhals namespace and `narwhals.stable.v1`:

- Since Narwhals 1.23:

- Passing an `ibis.Table` to `from_native` returns a `LazyFrame`. In
`narwhals.stable.v1`, it returns a `DataFrame` with `level='interchange'`.
- `eager_or_interchange_only` has been removed from `from_native` and `narwhalify`.
- Order-dependent expressions can no longer be used with `narwhals.LazyFrame`.
- The following expressions have been deprecated from the main namespace: `Expr.head`,
`Expr.tail`, `Expr.gather_every`, `Expr.sample`, `Expr.arg_true`, `Expr.sort`.

- Since Narwhals 1.21, passing a `DuckDBPyRelation` to `from_native` returns a `LazyFrame`. In
`narwhals.stable.v1`, it returns a `DataFrame` with `level='interchange'`.
Expand Down
30 changes: 14 additions & 16 deletions docs/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,20 @@ the next section for what else you can do.
We love open source, but we're not "open source absolutists". If you're unable to open
source you library, then this is how you can make your library compatible with Narwhals.

Make sure that, in addition to the public Narwhals API, you also define:

- `DataFrame.__narwhals_dataframe__`: return an object which implements public methods
from `Narwhals.DataFrame`
- `DataFrame.__narwhals_namespace__`: return an object which implements public top-level
functions from `narwhals` (e.g. `narwhals.col`, `narwhals.concat`, ...)
- `DataFrame.__native_namespace__`: return a native namespace object which must have a
`from_dict` method
- `LazyFrame.__narwhals_lazyframe__`: return an object which implements public methods
from `Narwhals.LazyFrame`
- `LazyFrame.__narwhals_namespace__`: return an object which implements public top-level
functions from `narwhals` (e.g. `narwhals.col`, `narwhals.concat`, ...)
- `LazyFrame.__native_namespace__`: return a native namespace object which must have a
`from_dict` method
- `Series.__narwhals_series__`: return an object which implements public methods
from `Narwhals.Series`
Make sure that you also define:

- `DataFrame.__narwhals_dataframe__`: return an object which implements methods from the
`CompliantDataFrame` protocol in `narwhals/typing.py`.
- `DataFrame.__narwhals_namespace__`: return an object which implements methods from the
`CompliantNamespace` protocol in `narwhals/typing.py`.
- `DataFrame.__native_namespace__`: return the object's native namespace.
- `LazyFrame.__narwhals_lazyframe__`: return an object which implements methods from the
`CompliantLazyFrame` protocol in `narwhals/typing.py`.
- `LazyFrame.__narwhals_namespace__`: return an object which implements methods from the
`CompliantNamespace` protocol in `narwhals/typing.py`.
- `LazyFrame.__native_namespace__`: return the object's native namespace.
- `Series.__narwhals_series__`: return an object which implements methods from the
`CompliantSeries` protocol in `narwhals/typing.py`.

If your library doesn't distinguish between lazy and eager, then it's OK for your dataframe
object to implement both `__narwhals_dataframe__` and `__narwhals_lazyframe__`. In fact,
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To verify the installation, start the Python REPL and execute:
```python
>>> import narwhals
>>> narwhals.__version__
'1.21.1'
'1.24.1'
```

If you see the version number, then the installation was successful!
Expand Down
2 changes: 1 addition & 1 deletion narwhals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
from narwhals.utils import maybe_reset_index
from narwhals.utils import maybe_set_index

__version__ = "1.21.1"
__version__ = "1.24.1"

__all__ = [
"Array",
Expand Down
Loading

0 comments on commit 2edd7e1

Please sign in to comment.