Skip to content

Commit 63d986f

Browse files
authored
Prepare release 0.1.10 (#53)
* Bug fixes * Hopefully enabled use of uv
1 parent bc307e8 commit 63d986f

File tree

12 files changed

+2820
-70
lines changed

12 files changed

+2820
-70
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
9+
## [0.1.10] - 2025-03-22
10+
11+
### Added
12+
- Added support for using package with uv by pinning kaleido to 0.2.0
13+
14+
## [0.1.9] - 2024-08-13
15+
16+
### Fixed
17+
- Bug Fix due to missing required package
18+
819
## [0.1.8] - 2024-08-13
920

1021
### Fixed

Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ This tool can be used by anybody, but is aimed for people who want to do a quick
5454
2. `pip install ml2sql`
5555
3. `ml2sql init` (creates folder structure for in- and output)
5656

57+
1. Or use UV:
58+
- to install the package: `uv sync`
59+
- to run the tool: `uv run ml2sql`
60+
2. Or even UVX to run directly without installing:
61+
- to run the tool: `uvx ml2sql run` (just add `uvx` in front of the commands specified below in the demo section)
5762
<br>
5863
</details>
5964
<details>

ml2sql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# ml2sql/__init__.py
33

44
__app_name__ = "ml2sql"
5-
__version__ = "0.1.8"
5+
__version__ = "0.1.10"

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ classifiers = [
3333

3434
dependencies = [
3535
"interpret == 0.6.3",
36-
"numpy",
37-
"duckdb",
38-
"scikit-learn",
36+
"numpy~=1.24.4",
37+
"duckdb~=1.2.1",
38+
"scikit-learn~=1.3.2",
3939
"imblearn",
40-
"kaleido",
41-
"typer",
40+
"kaleido==0.2.0",
41+
"typer~=0.15.2",
4242
'pywin32 ; platform_system == "Windows"',
43+
"pytest~=8.3.5",
4344
]
4445

4546
keywords = ["SQL", "ML", "automl", "interpret", "ML 2 SQL", "EBM", "Explainable Boosting Machine", "ML to SQL"]

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PROBLEM_TYPE = ["binary", "multiclass", "regression"]
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,3 @@ def find_data_file(directory, keyword):
5656
f"No .csv file containing '{keyword}' found in {directory}"
5757
)
5858
return str(matching_files[0])
59-
60-
61-
PROBLEM_TYPE = ["binary", "multiclass", "regression"]

tests/test_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PROBLEM_TYPE = ["binary", "multiclass", "regression"]

tests/test_main.py

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,53 @@
66
from datetime import datetime
77
import os
88
import pandas as pd
9+
from tests.test_constants import PROBLEM_TYPE
910

1011

11-
@pytest.fixture
12+
@pytest.fixture(scope="session")
1213
def runner():
1314
return CliRunner()
1415

1516

17+
@pytest.fixture(scope="session")
18+
def temp_dir(tmp_path_factory):
19+
temp_dir = tmp_path_factory.mktemp("session_temp")
20+
yield temp_dir
21+
22+
1623
@pytest.fixture
17-
def temp_dir(tmp_path):
18-
yield tmp_path
24+
def setup_run_environment(temp_dir):
25+
# Create necessary directories and files
26+
(temp_dir / "input" / "data").mkdir(parents=True, exist_ok=True)
27+
(temp_dir / "input" / "configuration").mkdir(parents=True, exist_ok=True)
28+
(temp_dir / "trained_models").mkdir(exist_ok=True)
29+
30+
# Create a dummy CSV file with some data
31+
df = pd.DataFrame(
32+
{
33+
"target": [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
34+
"feature1": [1, 2, 3, 4, 6, 7, 8, 3, 6, 1],
35+
"feature2": [5, 6, 7, 8, 3, 4, 6, 7, 3, 1],
36+
}
37+
)
38+
df.to_csv(temp_dir / "input" / "data" / "AA_test.csv", index=False)
39+
40+
# Create a dummy JSON configuration file
41+
config = {
42+
"target": "target",
43+
"features": ["feature1", "feature2"],
44+
"model_params": {},
45+
}
46+
47+
with open(temp_dir / "input" / "configuration" / "AA_config.json", "w") as f:
48+
json.dump(config, f)
49+
50+
# Change to the temp directory
51+
original_dir = os.getcwd()
52+
os.chdir(temp_dir)
53+
yield temp_dir
54+
# Change back to the original directory after the test
55+
os.chdir(original_dir)
1956

2057

2158
def test_version(runner):
@@ -25,7 +62,7 @@ def test_version(runner):
2562

2663

2764
# Test cli_init
28-
def test_init_command(runner, temp_dir):
65+
def test_init_command(temp_dir, runner):
2966
result = runner.invoke(app, ["init", "--dest", str(temp_dir)])
3067
assert result.exit_code == 0
3168

@@ -44,7 +81,7 @@ def test_init_command(runner, temp_dir):
4481
), "No files found in input/configuration"
4582

4683

47-
def test_init_command_existing_directory(runner, temp_dir):
84+
def test_init_command_existing_directory(temp_dir, runner):
4885
# Create a file in the directory to simulate an existing project
4986
(temp_dir / "existing_file.txt").touch()
5087

@@ -58,51 +95,15 @@ def test_init_command_existing_directory(runner, temp_dir):
5895
assert (temp_dir / "existing_file.txt").exists()
5996

6097

61-
@pytest.fixture
62-
def setup_run_environment(temp_dir):
63-
# Create necessary directories and files
64-
(temp_dir / "input" / "data").mkdir(parents=True)
65-
(temp_dir / "input" / "configuration").mkdir(parents=True)
66-
(temp_dir / "trained_models").mkdir()
67-
68-
# Create a dummy CSV file with some data
69-
df = pd.DataFrame(
70-
{
71-
"target": [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
72-
"feature1": [1, 2, 3, 4, 6, 7, 8, 3, 6, 1],
73-
"feature2": [5, 6, 7, 8, 3, 4, 6, 7, 3, 1],
74-
}
75-
)
76-
df.to_csv(temp_dir / "input" / "data" / "test.csv", index=False)
77-
78-
# Create a dummy JSON configuration file
79-
config = {
80-
"target": "target",
81-
"features": ["feature1", "feature2"],
82-
"model_params": {},
83-
}
84-
85-
with open(temp_dir / "input" / "configuration" / "config.json", "w") as f:
86-
json.dump(config, f)
87-
88-
# Change to the temp directory
89-
original_dir = os.getcwd()
90-
os.chdir(temp_dir)
91-
yield temp_dir
92-
# Change back to the original directory after the test
93-
os.chdir(original_dir)
94-
95-
96-
def test_run_command(setup_run_environment, caplog):
98+
def test_run_command(setup_run_environment, runner, caplog):
9799
# Avoid I/O error by not having any logger produce a message
98100
caplog.set_level(100000)
99101

100-
runner = CliRunner()
101102
temp_dir = setup_run_environment
102103

103104
# Create the input sequence for test_run
104105
user_inputs = (
105-
"1\n" # Select the first CSV file
106+
"1\n" # Select the first CSV file (AA_test.csv)
106107
"2\n" # Select the first JSON file (we created one in setup)
107108
"1\n" # Select the first model type (assuming it's "Explainable Boosting Machine")
108109
"test_model\n" # Enter model name

tests/test_run_decisiontree_flows.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
from ml2sql.main import app
77
from ml2sql.utils.test_helpers.sql_model import execute_sql_script
88
from datetime import datetime
9-
from test_utils import (
10-
runner, # noqa: F401
11-
temp_dir, # noqa: F401
12-
init_ml2sql, # noqa: F401
13-
change_test_dir, # noqa: F401
9+
from tests.test_constants import PROBLEM_TYPE
10+
from tests.conftest import (
1411
find_sav_file,
1512
find_data_file,
16-
PROBLEM_TYPE,
1713
)
1814

1915

tests/test_run_ebm_flows.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
from ml2sql.main import app
77
from ml2sql.utils.test_helpers.sql_model import execute_sql_script
88
from datetime import datetime
9-
from test_utils import (
10-
runner, # noqa: F401
11-
temp_dir, # noqa: F401
12-
init_ml2sql, # noqa: F401
13-
change_test_dir, # noqa: F401
9+
from tests.test_constants import PROBLEM_TYPE
10+
from tests.conftest import (
1411
find_sav_file,
1512
find_data_file,
16-
PROBLEM_TYPE,
1713
)
1814

1915

0 commit comments

Comments
 (0)