Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.13 tests #40

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions .github/workflows/pytest_duckdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
name: Run tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
Expand All @@ -35,7 +35,7 @@ jobs:

- name: Run tests with coverage
run: |
poetry add pytest-cov
poetry add "pytest-cov>=5.0.0"
poetry run pytest -v --durations=0 -m "duckdb_only or core" --cov=splink --cov-report=xml --cov-report=term tests/

- name: Upload coverage report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest_postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
name: Run tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest_sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
name: Run tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions docs/api_docs/comparison_level_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ tags:
- "!^create_sql$" # Exclude the create_sql method


## AbsoluteDateDifferenceAtThresholds
## AbsoluteDateDifferenceLevel

An alias of [AbsoluteTimeDifferenceAtThresholds](./comparison_level_library.html#splink.comparison_level_library.AbsoluteTimeDifferenceLevel).
An alias of [AbsoluteTimeDifferenceLevel](./comparison_level_library.html#splink.comparison_level_library.AbsoluteTimeDifferenceLevel).

## Configuring comparisons

Expand Down
10 changes: 5 additions & 5 deletions docs/topic_guides/splink_fundamentals/backends/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,31 +95,31 @@ Once you have initialised the `linker` object, there is no difference in the sub
```python
from splink import Linker, DuckDBAPI

linker = Linker(your_args. DuckDBAPI)
linker = Linker(df, settings, db_api=DuckDBAPI(...))
```

=== ":simple-apachespark: Spark"

```python
from splink import Linker, SparkAPI

linker = Linker(your_args. SparkAPI)
linker = Linker(df, settings, db_api=SparkAPI(...))
```

=== ":simple-amazonaws: Athena"

```python
from splink import Linker, AthenaAPI

linker = Linker(your_args. AthenaAPI)
linker = Linker(df, settings, db_api=AthenaAPI(...))
```

=== ":simple-sqlite: SQLite"

```python
from splink import Linker, SQLiteAPI

linker = Linker(your_args. SQLiteAPI)
linker = Linker(df, settings, db_api=SQLiteAPI(...))

```

Expand All @@ -128,7 +128,7 @@ Once you have initialised the `linker` object, there is no difference in the sub
```python
from splink import Linker, PostgresAPI

linker = Linker(your_args. PostgresAPI)
linker = Linker(df, settings, db_api=PostgresAPI(...))

```

Expand Down
1,102 changes: 640 additions & 462 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ readme = "README.md"
python = ">=3.8.0,<4.0.0"
jsonschema = ">=3.2"
# 1.3.5 is the last version supporting py 3.7.1
pandas = ">1.3.5"
pandas = [
{ version = ">1.3.5", python = "<3.13" },
{ version = ">=2.2.3", python = ">=3.13" }
]
duckdb = ">=0.9.2"
sqlglot = ">=13.0.0"
altair = "^5.0.1"
Expand Down Expand Up @@ -57,7 +60,10 @@ ruff = "^0.4.2"
[tool.poetry.group.testing.dependencies]
# pin to reduce dependencies
pytest = ">=7.3"
pyarrow = ">=7.0.0"
pyarrow = [
{ version = ">=7.0.0", python = "<3.13" },
{ version = ">=18.0.0", python = ">=3.13" }
]
networkx = ">=2.5.1"
rapidfuzz = ">=2.0.3"

Expand Down
24 changes: 5 additions & 19 deletions splink/internals/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
import json
import math
import os
from typing import TYPE_CHECKING, Any, Dict, Union
from typing import Any, Dict, Union

import numpy as np
import pandas as pd
from altair import Chart, SchemaBase

from splink.internals.misc import read_resource
from splink.internals.waterfall_chart import records_to_waterfall_data

altair_installed = True

try:
import altair as alt
except ImportError:
altair_installed = False

if TYPE_CHECKING:
import altair as alt

# type alias:
ChartReturnType = Union[Dict[Any, Any], alt.core.SchemaBase]
ChartReturnType = Union[Dict[Any, Any], SchemaBase]


def load_chart_definition(filename):
Expand All @@ -42,13 +33,8 @@ def _load_external_libs():
def altair_or_json(
chart_dict: dict[Any, Any], as_dict: bool = False
) -> ChartReturnType:
if altair_installed:
if not as_dict:
try:
return alt.Chart.from_dict(chart_dict)

except ModuleNotFoundError:
return chart_dict
if not as_dict:
return Chart.from_dict(chart_dict)

return chart_dict

Expand Down
2 changes: 1 addition & 1 deletion splink/internals/cluster_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _get_cluster_id_of_each_size(
where row_num <= {rows_per_partition}
"""

pipeline.enqueue_sql(sql, "__splink__cluster_count_row_numbered")
pipeline.enqueue_sql(sql, "__splink__cluster_count_row_numbered_2")
df_cluster_sample_with_size = linker._db_api.sql_pipeline_to_splink_dataframe(
pipeline
)
Expand Down
2 changes: 1 addition & 1 deletion splink/internals/connected_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def solve_connected_components(
where node_id in
(select node_id from {prev_representatives_thinned.templated_name})
"""
pipeline.enqueue_sql(sql, "__splink__df_neighbours_filtered")
pipeline.enqueue_sql(sql, f"__splink__df_neighbours_filtered_{iteration}")
filtered_neighbours_thinned = db_api.sql_pipeline_to_splink_dataframe(pipeline)
filtered_neighbours.drop_table_from_database_and_remove_from_cache()
filtered_neighbours = filtered_neighbours_thinned
Expand Down
Loading