Metadata-Version: 2.4
Name: dsgrid-toolkit
Version: 0.3.1
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: chronify~=0.6.0
Requires-Dist: click>=8.2,<9
Requires-Dist: dash
Requires-Dist: dash-bootstrap-components
Requires-Dist: duckdb>=1,<2
Requires-Dist: fastapi
Requires-Dist: json5
Requires-Dist: networkx
Requires-Dist: pandas
Requires-Dist: prettytable
Requires-Dist: pyarrow
Requires-Dist: pydantic~=2.11.6
Requires-Dist: requests
Requires-Dist: rich-click
Requires-Dist: semver
Requires-Dist: sqlalchemy>=2,<3
Requires-Dist: uvicorn
Requires-Dist: tzdata
Requires-Dist: httpx ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: devtools ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: pyarrow ; extra == 'dev'
Requires-Dist: maturin ; extra == 'dev'
Requires-Dist: furo ; extra == 'doc'
Requires-Dist: ghp-import ; extra == 'doc'
Requires-Dist: numpydoc ; extra == 'doc'
Requires-Dist: pandas-stubs ; extra == 'doc'
Requires-Dist: ruff ; extra == 'doc'
Requires-Dist: sphinx~=7.2 ; extra == 'doc'
Requires-Dist: sphinx-click~=5.0 ; extra == 'doc'
Requires-Dist: sphinx-copybutton~=0.5.2 ; extra == 'doc'
Requires-Dist: sphinx-tabs~=3.4 ; extra == 'doc'
Requires-Dist: sphinx-argparse~=0.4.0 ; extra == 'doc'
Requires-Dist: sphinxcontrib-programoutput ; extra == 'doc'
Requires-Dist: autodoc-pydantic[erdantic]~=2.0 ; extra == 'doc'
Requires-Dist: twine ; extra == 'release'
Requires-Dist: setuptools ; extra == 'release'
Requires-Dist: wheel ; extra == 'release'
Requires-Dist: chronify[spark] ; extra == 'spark'
Requires-Dist: pyspark==4.0.0 ; extra == 'spark'
Requires-Dist: thrift ; extra == 'spark'
Requires-Dist: thrift-sasl ; extra == 'spark'
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: release
Provides-Extra: spark
License-File: LICENSE
Summary: Python API for accessing demand-side grid model (dsgrid) datasets
Keywords: dsgrid
Author-email: Elaine Hale <elaine.hale@nrel.gov>, Lixi Liu <lixi.liu@nrel.gov>, Meghan Mooney <meghan.mooney@nrel.gov>, Daniel Thom <daniel.thom@nrel.gov>
Maintainer-email: Elaine Hale <elaine.hale@nrel.gov>
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://dsgrid.github.io/dsgrid/
Project-URL: GitHub, https://github.com/dsgrid/dsgrid
Project-URL: Homepage, https://www.nrel.gov/analysis/dsgrid

# dsgrid
[![Documentation](https://img.shields.io/badge/docs-ready-blue.svg)](https://dsgrid.github.io/dsgrid)
[![codecov](https://codecov.io/gh/dsgrid/dsgrid/branch/main/graph/badge.svg?token=W0441C9XAL)](https://codecov.io/gh/dsgrid/dsgrid)

Python API for contributing to and accessing demand-side grid model (dsgrid) projects and datasets.

⚠️ **dsgrid is under active development and does not yet have a formal package release.** Details listed here are subject to change. Please reach out to the dsgrid coordination team with any questions or other feedback. ⚠️

[Install](#install) | [Usage](#usage) | [Uninstall](#uninstall)

## Install

[Virtual environment](#virtual-environment) | [Dependencies](#dependencies) | [from PIPY/pip](#from-pipypip) | [from pip+git](#from-pipgit) | [from cloned repository](#from-cloned-repository)

### Virtual environment

Create a virtual environment in which to install dsgrid. Anaconda or miniconda is recommended.

```
conda create -n dsgrid python=3.11
conda activate dsgrid
```

### Dependencies

dsgrid uses [Apache Spark](#https://spark.apache.org/) to manage big data. There are no separate installation steps for Apache Spark beyond installing the dsgrid package and installing:

```
pip install "dsgrid-toolkit[spark]"
```

Otherwise installing the pyspark Python dependency handles it.

However, you should be aware that Apache Spark's Microsoft Windows support is poor and essentially limited to local mode. That is, if you use dsgrid on a Windows machine you should not attempt to install a full version of Spark nor expect to run on a Spark cluster. As such, we recommend limiting dsgrid use on Windows to browsing the registry, registering and submitting small- to medium-sized datasets, or development work with small test projects. Full dsgrid functionality with large projects requires additional computational resources, e.g., high performance or cloud computing, typically on a Linux operating system.

#### Additional Notes
- If pyspark complains about not finding Python, you may need to locate your python executable file (python.exe on Windows), copy it, and rename the copy to python3 (python3.exe on Windows)

Spark requires Java 8 or later with the `JAVA_HOME` environment variable set to the Java installation directory.

On Linux you can install OpenJDK with conda:
```
conda install openjdk
```

Windows install instructions are below.

#### Windows

To install Apache Spark on Windows, follow [these instructions](https://towardsdatascience.com/installing-apache-pyspark-on-windows-10-f5f0c506bea1).

### From PIPY/pip

pip install dsgrid-toolkit

or

pip install "dsgrid-toolkit[spark]"

### From pip+git

**With ssh keys:**
```
pip install git+ssh://git@github.com/dsgrid/dsgrid.git@main

# or

pip install git+ssh://git@github.com/dsgrid/dsgrid.git@develop
```

**From http:**
```
pip install git+https://github.com/dsgrid/dsgrid.git@main

# or

pip install git+https://github.com/dsgrid/dsgrid.git@develop
```

### From Cloned Repository

First, clone the repository and change into the `dsgrid` directory. For example:

```
cd ~                                       # or other directory where you put repositories
git clone git@github.com:dsgrid/dsgrid.git # or the http address
cd dsgrid
```

Then install the pacakge using the pip `-e` flag to directly use the files in the
cloned repository.

**Users:**
```
pip install -e .
```

**Developers:**
```
pip install -e '.[dev,spark]'
```

## Usage

dsgrid is primarily a command-line interface (CLI) tool. To see the available commands:
```
dsgrid --help
```

## Uninstall

```
pip uninstall dsgrid
```

If you are using a conda environment
```
conda deactivate
```

## Software Record

dsgrid is developed under NREL Software Record SWR-21-52, "demand-side grid model".

