Metadata-Version: 2.4
Name: buildstock-fetch
Version: 1.6.4
Summary: This library simplifies downloading building characteristics and load curve data from NREL's ResStock and ComStock projects.
Author-email: Switchbox <hello@switch.box>
Project-URL: Homepage, https://switchbox-data.github.io/buildstock-fetch/
Project-URL: Repository, https://github.com/switchbox-data/buildstock-fetch
Project-URL: Documentation, https://switchbox-data.github.io/buildstock-fetch/
Keywords: python
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <4.0,>=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.32.3
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.9.5
Requires-Dist: questionary>=1.11.0
Requires-Dist: polars>=0.20.0
Requires-Dist: tomli>=2.0.0
Requires-Dist: boto3>=1.33.0
Requires-Dist: botocore>=1.33.0
Requires-Dist: pyarrow>=14.0.1
Requires-Dist: typedload>=2.39
Requires-Dist: httpx>=0.28.1
Requires-Dist: aiofiles>=25.1.0
Requires-Dist: types-aioboto3[essential,s3]>=15.5.0
Requires-Dist: aioboto3>=15.5.0
Requires-Dist: xmltodict>=1.0.2
Requires-Dist: useful-types>=0.2.1
Requires-Dist: tenacity>=9.1.2
Requires-Dist: async-timer>=1.1.6
Requires-Dist: psutil>=7.2.1
Requires-Dist: cloudpathlib>=0.23.0
Requires-Dist: prek>=0.3.2
Provides-Extra: test
Requires-Dist: pytest>=7.2.0; extra == "test"
Requires-Dist: pytest-asyncio>=1.3.0; extra == "test"
Requires-Dist: pytest-recording>=0.13.4; extra == "test"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.4.2; extra == "docs"
Requires-Dist: mkdocs-material>=8.5.10; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.26.1; extra == "docs"
Provides-Extra: lint
Requires-Dist: mypy>=0.991; extra == "lint"
Requires-Dist: ruff>=0.11.5; extra == "lint"
Requires-Dist: deptry>=0.23.0; extra == "lint"
Requires-Dist: types-requests>=2.31.0; extra == "lint"
Requires-Dist: types-boto3>=1.33.0; extra == "lint"
Requires-Dist: pandas-stubs>=2.2.0; extra == "lint"
Requires-Dist: types-aiofiles>=25.1.0.20251011; extra == "lint"
Provides-Extra: dev-utils
Requires-Dist: boto3>=1.33.0; extra == "dev-utils"
Requires-Dist: botocore>=1.33.0; extra == "dev-utils"
Requires-Dist: numpy>=1.26.4; extra == "dev-utils"
Requires-Dist: scikit-learn>=1.6.1; extra == "dev-utils"
Requires-Dist: awscli>=1.32.0; extra == "dev-utils"
Requires-Dist: xmltodict>=0.14.2; extra == "dev-utils"
Provides-Extra: dev
Requires-Dist: buildstock-fetch[dev-utils,docs,lint,test]; extra == "dev"
Requires-Dist: tox-uv>=1.11.3; extra == "dev"
Dynamic: license-file

# buildstock-fetch

[![Release](https://img.shields.io/github/v/release/switchbox-data/buildstock-fetch)](https://img.shields.io/github/v/release/switchbox-data/buildstock-fetch)
[![Build status](https://img.shields.io/github/actions/workflow/status/switchbox-data/buildstock-fetch/main.yml?branch=main)](https://github.com/switchbox-data/buildstock-fetch/actions/workflows/main.yml?query=branch%3Amain)
[![Commit activity](https://img.shields.io/github/commit-activity/m/switchbox-data/buildstock-fetch)](https://img.shields.io/github/commit-activity/m/switchbox-data/buildstock-fetch)
[![License](https://img.shields.io/github/license/switchbox-data/buildstock-fetch)](https://img.shields.io/github/license/switchbox-data/buildstock-fetch)

A CLI tool, and python library, to simplify downloading building characteristics and load curve data from NREL's ResStock and ComStock projects.

- **Github repository**: <https://github.com/switchbox-data/buildstock-fetch/>
- **Documentation**: <https://switchbox-data.github.io/buildstock-fetch/>
- **PyPI page**: <https://pypi.org/project/buildstock-fetch/>

## Installing the CLI tool

We recommend using [uv](https://docs.astral.sh/uv/getting-started/installation/) or [pipx](https://pipx.pypa.io/stable/installation/) to install the buildstock-fetch CLI:

```bash
uv tool install buildstock-fetch
```
or

```bash
pipx install buildstock-fetch
```

You'll then be able to access the `bsf` command system-wide:

```bash
bsf --help
```

## Installing the library

buildstock-fetch is implemented in Python, and we expose our internal functions via a library.

If you're using Python, and you want to install the CLI only for a particular project (rather than system-wide), or you want to user the underlying library, install our [PyPI](https://pypi.org/project/buildstock-fetch/) package via:

```bash
pip install buildstock-fetch
```

or

```bash
uv add buildstock-fetch
```

## Using the CLI

To make it easy to download what you want from NREL's S3 bucket, `bsf` has an interactive mode. Activate it with:

```bash
bsf
```

Alternatively, you can tell `bsf` exactly what to download via CLI args:

```bash
bsf --product resstock --release_year 2022 --weather_file tmy3 --release_version 1 --states CA --file_type "hpxml metadata" --upgrade_id "0 1 2" --output_directory ./CA_data
```

For more details about the usage, see [Usage](https://switchbox-data.github.io/buildstock-fetch/usage/)

## Developing the library

To simplify development, this library uses [devcontainers](https://containers.dev/) for reproducible development environments and the [just](https://github.com/casey/just) command runner for all major tasks.

Available commands are defined in [Justfile](Justile). To view available them:

```bash
just --list
```

### Setting up development environment

This library uses [uv](https://docs.astral.sh/uv/) for managing python versions, virtual environments, and packages.

However, given the presence of system dependencies, the easiest way to set up the library's develop environment is to use devcontainers. To do so, open up the repo in VSCode, or a VSCode fork like Cursor or Positron.

The editor will auto-detect the presence of the repo's devcontainer (configured in [.devcontainer/devcontainer.json](.devcontainer/devcontainer.json)). Click "Reopen in Container" to launch the devcontainer.

If you prefer not to use a devcontainer, you can install uv, install the pre-commit hooks, launch the virtualenv, and download the packages (pinned in [uv.lock](uv.lock)) by running:

```bash
./devcontainer/postCreateCommand.sh
just install
```

Using a system package manager (like `brew` or `apt`), you'll also need to manually install `just` and `quarto`.

### Adding a package
To add a python package to the project:

```bash
uv add <package-name>
```

This replaces `pip install <package-name>`, and has the effect of adding the package to [pyproject.toml](pyproject.toml), as well as pinning the package version in [uv.lock](uv.lock).

To add a package that will only be used as a development tool:

```bash
uv add --dev <package-name>
```

This will update the dev `dependency-groups` in [pyproject.toml](pyproject.toml), and ensure that the package isn't declared as a run-time dependency of the library itself.

### Running code quality checks

We use [ruff](https://github.com/astral-sh/ruff) for linting and code formatting, [mypy](https://mypy.readthedocs.io/en/stable/running_mypy.html) for type checking, and a series of [post-commit hooks](pre-commit-config.yaml) for validating YAML, JSON, whitespaces, and so on.

To run code quality checks:

```bash
just check
```

The checks will also be run automatically by Github Actions when opening PRs, merging to main, or creating a new release.

### Running tests

Our test are written using `pytest` and live in [tests/](tests/). They are checked against multiple python versions using `tox`.

To run the tests:

```bash
just test
```

### Rendering docs

We use `mkdocs` and [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) for writing and rendering docs. The docs are written in markdown and live in [docs/](docs/).

To dynamically render the docs as you develop them:

```bash
just docs
```

To statically render the docs into HTML:

```bash
just docs-test
```

The docs are served by Github Pages out of the `gh-pages` branch. We do not publish them manually: they are automatically rendered and published by the Github Actions workflow when merging to `main`.

### Releasing the library

To release the latest version of the library, first update the version number in the `pyproject.toml` and `__init__.py` files.

Next, navigate to the library's [publish new release page](https://github.com/switchbox-data/buildstock-fetch/releases/new).

Under the `Tag: Select tag` dragdown menu, enter the latest version number accordingly and select `Create new tag`

Include relevant notes for the release inside the `Write` textbox. Once finished, click the `Publish release` button at the bottom to publish the latest release.

---

Repository initiated with [fpgmaas/cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv).
