Metadata-Version: 2.4
Name: datawhys-sdk
Version: 0.5.5
Summary: DataWhys API wrapper
Home-page: https://github.com/datawhys/datawhys-python-sdk
Author: DataWhys
Author-email: DataWhys <info@datawhys.ai>
Project-URL: Homepage, https://datawhys.ai
Project-URL: Source, https://github.com/datawhys/datawhys-python-sdk
Platform: any
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=2.5
Requires-Dist: numpy>=1.18
Requires-Dist: pandas>=1.0
Requires-Dist: pyarrow>=3.0.0
Requires-Dist: requests>=2.25
Requires-Dist: scikit-learn>=1.0
Requires-Dist: importlib-resources; python_version < "3.9"
Provides-Extra: sci
Requires-Dist: umap-learn~=0.5.1; extra == "sci"
Provides-Extra: viz
Requires-Dist: graphviz~=0.14.2; extra == "viz"
Requires-Dist: pygraphviz~=1.6; extra == "viz"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: platform
Dynamic: requires-python

# DataWhys Python SDK

DataWhys Python SDK is a Python wrapper for the DataWhys API that handles data orchestration, cloud uploads, and solver execution.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install.

```bash
pip install datawhys-sdk
```

## Usage

```python
import datawhys as dw
from datawhys.datasets import load_titanic

# 1. Set your credentials
dw.api_key = "<YOUR_API_KEY>"

# Optional: Set custom API base
# dw.api_base = "https://your-api-server.com/api/v1"

# 2. Load and Upload your data
# DataWhys uses a cloud-first workflow: upload once, solve many times.
dwf = load_titanic()
dwf.upload()

print(f"File ID: {dwf.file_id}")

# 3. Create a solver and fit the data
solver = dw.Solver()

# Pass the DataWhysFrame directly. The solver extracts the cloud file_id automatically.
solver.fit(
    dwf=dwf,
    outcome='survived',
    target='Died',
    features=['sex', 'class', 'age', 'fare']
)

# 4. View results
print(solver.rule)
print('Score:', solver.score)
print('Rule Size:', solver.size)

# Filter the original dataframe using the discovered rule
filtered_df = solver.get_rule_data()
```

See the `SDK Example.ipynb` for more in-depth examples and advanced features.

## Install from source

```bash
git clone https://github.com/datawhys/datawhys-python-sdk.git
cd datawhys-python-sdk
pip install -e .
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Take a look at `CONTRIBUTING.md` for more info

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)
