This library simplifies 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/
buildstock-fetch is available on PyPI and can be installed via:
pip install buildstock-fetchor
uv pip install buildstock-fetchTo use the CLI tool in buildstock-fetch run:
bsfto activate the interactive mode. Alternatively, provide the inputs directly. For example,
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_dataIf the above options don't work, try:
python -m buildstock_fetchFor more details about the usage, see Usage
To simplify development, this library uses devcontainers for reproducible development environments and the just command runner for all major tasks.
Available commands are defined in Justfile. To view available them:
just --listThis library uses 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). 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) by running:
./devcontainer/postCreateCommand.sh
just installUsing a system package manager (like brew or apt), you'll also need to manually install just and quarto.
To add a python package to the project:
uv add <package-name>This replaces pip install <package-name>, and has the effect of adding the package to pyproject.toml, as well as pinning the package version in uv.lock.
To add a package that will only be used as a development tool:
uv add --dev <package-name>This will update the dev dependency-groups in pyproject.toml, and ensure that the package isn't declared as a run-time dependency of the library itself.
We use ruff for linting and code formatting, mypy for type checking, and a series of post-commit hooks for validating YAML, JSON, whitespaces, and so on.
To run code quality checks:
just checkThe checks will also be run automatically by Github Actions when opening PRs, merging to main, or creating a new release.
Our test are written using pytest and live in tests/. They are checked against multiple python versions using tox.
To run the tests:
just testWe use mkdocs and mkdocs-material for writing and rendering docs. The docs are written in markdown and live in docs/.
To dynamically render the docs as you develop them:
just docsTo statically render the docs into HTML:
just docs-testThe 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.
To build the package into a wheel file, type:
just buildTo publish a release to PyPI using twine:
just publishTo do both in one go:
just build-and-publishRepository initiated with fpgmaas/cookiecutter-uv.