Skip to content

Commit 0cebec4

Browse files
authored
Replace numpy usage and remove from pyproject.toml (#1272)
* use random instead of numpy * remove numpy from pyproject.toml
1 parent f7139fd commit 0cebec4

File tree

3 files changed

+17
-44
lines changed

3 files changed

+17
-44
lines changed

poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ gcsfs = { version = ">=2023.1.0,<2024.1.0", optional = true }
7878
psycopg2-binary = { version = ">=2.9.6", optional = true }
7979
sqlalchemy = { version = "^2.0.18", optional = true }
8080
getdaft = { version = ">=0.2.12", optional = true }
81-
numpy = [
82-
{ version = "1.26.0", python = ">=3.9,<3.13", optional = true },
83-
]
8481
cachetools = "^5.5.0"
8582

8683
[tool.poetry.group.dev.dependencies]
@@ -238,10 +235,6 @@ ignore_missing_imports = true
238235
module = "sortedcontainers.*"
239236
ignore_missing_imports = true
240237

241-
[[tool.mypy.overrides]]
242-
module = "numpy.*"
243-
ignore_missing_imports = true
244-
245238
[[tool.mypy.overrides]]
246239
module = "sqlalchemy.*"
247240
ignore_missing_imports = true
@@ -394,10 +387,6 @@ ignore_missing_imports = true
394387
module = "sortedcontainers.*"
395388
ignore_missing_imports = true
396389

397-
[[tool.mypy.overrides]]
398-
module = "numpy.*"
399-
ignore_missing_imports = true
400-
401390
[[tool.mypy.overrides]]
402391
module = "sqlalchemy.*"
403392
ignore_missing_imports = true
@@ -550,10 +539,6 @@ ignore_missing_imports = true
550539
module = "sortedcontainers.*"
551540
ignore_missing_imports = true
552541

553-
[[tool.mypy.overrides]]
554-
module = "numpy.*"
555-
ignore_missing_imports = true
556-
557542
[[tool.mypy.overrides]]
558543
module = "sqlalchemy.*"
559544
ignore_missing_imports = true
@@ -706,10 +691,6 @@ ignore_missing_imports = true
706691
module = "sortedcontainers.*"
707692
ignore_missing_imports = true
708693

709-
[[tool.mypy.overrides]]
710-
module = "numpy.*"
711-
ignore_missing_imports = true
712-
713694
[[tool.mypy.overrides]]
714695
module = "sqlalchemy.*"
715696
ignore_missing_imports = true
@@ -862,10 +843,6 @@ ignore_missing_imports = true
862843
module = "sortedcontainers.*"
863844
ignore_missing_imports = true
864845

865-
[[tool.mypy.overrides]]
866-
module = "numpy.*"
867-
ignore_missing_imports = true
868-
869846
[[tool.mypy.overrides]]
870847
module = "sqlalchemy.*"
871848
ignore_missing_imports = true
@@ -894,10 +871,10 @@ generate-setup-file = false
894871
script = "build-module.py"
895872

896873
[tool.poetry.extras]
897-
pyarrow = ["pyarrow", "numpy"]
898-
pandas = ["pandas", "pyarrow", "numpy"]
899-
duckdb = ["duckdb", "pyarrow", "numpy"]
900-
ray = ["ray", "pyarrow", "pandas", "numpy"]
874+
pyarrow = ["pyarrow"]
875+
pandas = ["pandas", "pyarrow"]
876+
duckdb = ["duckdb", "pyarrow"]
877+
ray = ["ray", "pyarrow", "pandas"]
901878
daft = ["getdaft"]
902879
snappy = ["python-snappy"]
903880
hive = ["thrift"]
@@ -1084,10 +1061,6 @@ ignore_missing_imports = true
10841061
module = "sortedcontainers.*"
10851062
ignore_missing_imports = true
10861063

1087-
[[tool.mypy.overrides]]
1088-
module = "numpy.*"
1089-
ignore_missing_imports = true
1090-
10911064
[[tool.mypy.overrides]]
10921065
module = "sqlalchemy.*"
10931066
ignore_missing_imports = true

tests/integration/test_writes/test_writes.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
# pylint:disable=redefined-outer-name
1818
import math
1919
import os
20+
import random
2021
import time
2122
from datetime import date, datetime, timedelta
2223
from pathlib import Path
2324
from typing import Any, Dict
2425
from urllib.parse import urlparse
2526

26-
import numpy as np
2727
import pandas as pd
2828
import pyarrow as pa
2929
import pyarrow.compute as pc
@@ -1373,14 +1373,14 @@ def test_delete_threshold(session_catalog: Catalog) -> None:
13731373
date_start, date_end = date(2024, 1, 1), date(2024, 2, 1)
13741374

13751375
# Generate the 'id' column
1376-
id_column = np.random.randint(id_min, id_max, num_rows)
1376+
id_column = [random.randint(id_min, id_max) for _ in range(num_rows)]
13771377

13781378
# Generate the 'created_at' column as dates only
1379-
date_range = pd.date_range(start=date_start, end=date_end, freq="D") # Daily frequency for dates
1380-
created_at_column = np.random.choice(date_range, num_rows) # Convert to string (YYYY-MM-DD format)
1379+
date_range = pd.date_range(start=date_start, end=date_end, freq="D").to_list() # Daily frequency for dates
1380+
created_at_column = [random.choice(date_range) for _ in range(num_rows)] # Convert to string (YYYY-MM-DD format)
13811381

13821382
# Generate the 'relevancy_score' column with a peak around 0.1
1383-
relevancy_score_column = np.random.beta(a=2, b=20, size=num_rows) # Adjusting parameters to peak around 0.1
1383+
relevancy_score_column = [random.betavariate(2, 20) for _ in range(num_rows)] # Adjusting parameters to peak around 0.1
13841384

13851385
# Create the dataframe
13861386
df = pd.DataFrame({"id": id_column, "created_at": created_at_column, "relevancy_score": relevancy_score_column})
@@ -1403,12 +1403,12 @@ def test_delete_threshold(session_catalog: Catalog) -> None:
14031403

14041404
@pytest.mark.integration
14051405
def test_rewrite_manifest_after_partition_evolution(session_catalog: Catalog) -> None:
1406-
np.random.seed(876)
1406+
random.seed(876)
14071407
N = 1440
14081408
d = {
14091409
"timestamp": pa.array([datetime(2023, 1, 1, 0, 0, 0) + timedelta(minutes=i) for i in range(N)]),
1410-
"category": pa.array([np.random.choice(["A", "B", "C"]) for _ in range(N)]),
1411-
"value": pa.array(np.random.normal(size=N)),
1410+
"category": pa.array([random.choice(["A", "B", "C"]) for _ in range(N)]),
1411+
"value": pa.array([random.gauss(0, 1) for _ in range(N)]),
14121412
}
14131413
data = pa.Table.from_pydict(d)
14141414

0 commit comments

Comments
 (0)