buildstock-fetch 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of buildstock-fetch might be problematic. Click here for more details.

@@ -0,0 +1,25 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/python
3
+ {
4
+ "name": "buildstock-fetch",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
7
+ "features": {},
8
+
9
+ // Use 'postCreateCommand' to run commands after the container is created.
10
+ "postCreateCommand": "./.devcontainer/postCreateCommand.sh",
11
+
12
+ // Configure tool-specific properties.
13
+ "customizations": {
14
+ "vscode": {
15
+ "extensions": ["ms-python.python", "editorconfig.editorconfig"],
16
+ "settings": {
17
+ "python.testing.pytestArgs": ["tests"],
18
+ "python.testing.unittestEnabled": false,
19
+ "python.testing.pytestEnabled": true,
20
+ "python.defaultInterpreterPath": "/workspaces/buildstock-fetch/.venv/bin/python",
21
+ "python.testing.pytestPath": "/workspaces/buildstock-fetch/.venv/bin/pytest"
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env bash
2
+
3
+ # Install uv
4
+ curl -LsSf https://astral.sh/uv/install.sh | sh
5
+
6
+ # Install Dependencies
7
+ uv sync
8
+
9
+ # Install pre-commit hooks
10
+ git config --global --add safe.directory /workspaces/buildstock-fetch # Needed for pre-commit install to work
11
+ uv run pre-commit install --install-hooks
@@ -0,0 +1,30 @@
1
+ name: "Setup Python Environment"
2
+ description: "Set up Python environment for the given Python version"
3
+
4
+ inputs:
5
+ python-version:
6
+ description: "Python version to use"
7
+ required: true
8
+ default: "3.12"
9
+ uv-version:
10
+ description: "uv version to use"
11
+ required: true
12
+ default: "0.6.14"
13
+
14
+ runs:
15
+ using: "composite"
16
+ steps:
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ inputs.python-version }}
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v2
23
+ with:
24
+ version: ${{ inputs.uv-version }}
25
+ enable-cache: 'true'
26
+ cache-suffix: ${{ matrix.python-version }}
27
+
28
+ - name: Install Python dependencies
29
+ run: uv sync --frozen
30
+ shell: bash
@@ -0,0 +1,77 @@
1
+ name: Main
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types: [opened, synchronize, reopened, ready_for_review]
9
+
10
+ jobs:
11
+ quality:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Check out
15
+ uses: actions/checkout@v4
16
+
17
+ - uses: actions/cache@v4
18
+ with:
19
+ path: ~/.cache/pre-commit
20
+ key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21
+
22
+ - name: Set up the environment
23
+ uses: ./.github/actions/setup-python-env
24
+
25
+ - name: Run checks
26
+ run: make check
27
+
28
+ tests-and-type-check:
29
+ runs-on: ubuntu-latest
30
+ strategy:
31
+ matrix:
32
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
33
+ fail-fast: false
34
+ defaults:
35
+ run:
36
+ shell: bash
37
+ steps:
38
+ - name: Check out
39
+ uses: actions/checkout@v4
40
+
41
+ - name: Set up the environment
42
+ uses: ./.github/actions/setup-python-env
43
+ with:
44
+ python-version: ${{ matrix.python-version }}
45
+
46
+ - name: Run tests
47
+ run: uv run python -m pytest tests
48
+
49
+ - name: Check typing
50
+ run: uv run mypy
51
+
52
+
53
+
54
+ check-docs:
55
+ runs-on: ubuntu-latest
56
+ steps:
57
+ - name: Check out
58
+ uses: actions/checkout@v4
59
+
60
+ - name: Set up the environment
61
+ uses: ./.github/actions/setup-python-env
62
+
63
+ - name: Check if documentation can be built
64
+ run: uv run mkdocs build -s
65
+
66
+ deploy-docs:
67
+ needs: check-docs
68
+ runs-on: ubuntu-latest
69
+ steps:
70
+ - name: Check out
71
+ uses: actions/checkout@v4
72
+
73
+ - name: Set up the environment
74
+ uses: ./.github/actions/setup-python-env
75
+
76
+ - name: Deploy documentation
77
+ run: uv run mkdocs gh-deploy --force
@@ -0,0 +1,66 @@
1
+ name: release-main
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+
9
+ set-version:
10
+ runs-on: ubuntu-24.04
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Export tag
15
+ id: vars
16
+ run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
17
+ if: ${{ github.event_name == 'release' }}
18
+
19
+ - name: Update project version
20
+ run: |
21
+ sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml
22
+ env:
23
+ RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
24
+ if: ${{ github.event_name == 'release' }}
25
+
26
+ - name: Upload updated pyproject.toml
27
+ uses: actions/upload-artifact@v4
28
+ with:
29
+ name: pyproject-toml
30
+ path: pyproject.toml
31
+
32
+ publish:
33
+ runs-on: ubuntu-latest
34
+ needs: [set-version]
35
+ steps:
36
+ - name: Check out
37
+ uses: actions/checkout@v4
38
+
39
+ - name: Set up the environment
40
+ uses: ./.github/actions/setup-python-env
41
+
42
+ - name: Download updated pyproject.toml
43
+ uses: actions/download-artifact@v4
44
+ with:
45
+ name: pyproject-toml
46
+
47
+ - name: Build package
48
+ run: uv build
49
+
50
+ - name: Publish package
51
+ run: uv publish
52
+ env:
53
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
54
+
55
+ deploy-docs:
56
+ needs: publish
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - name: Check out
60
+ uses: actions/checkout@v4
61
+
62
+ - name: Set up the environment
63
+ uses: ./.github/actions/setup-python-env
64
+
65
+ - name: Deploy documentation
66
+ run: uv run mkdocs gh-deploy --force
@@ -0,0 +1,146 @@
1
+ docs/source
2
+
3
+ # From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
90
+ __pypackages__/
91
+
92
+ # Celery stuff
93
+ celerybeat-schedule
94
+ celerybeat.pid
95
+
96
+ # SageMath parsed files
97
+ *.sage.py
98
+
99
+ # Environments
100
+ .env
101
+ .venv
102
+ env/
103
+ venv/
104
+ ENV/
105
+ env.bak/
106
+ venv.bak/
107
+
108
+ # Spyder project settings
109
+ .spyderproject
110
+ .spyproject
111
+
112
+ # Rope project settings
113
+ .ropeproject
114
+
115
+ # mkdocs documentation
116
+ /site
117
+
118
+ # mypy
119
+ .mypy_cache/
120
+ .dmypy.json
121
+ dmypy.json
122
+
123
+ # Pyre type checker
124
+ .pyre/
125
+
126
+ # pytype static type analyzer
127
+ .pytype/
128
+
129
+ # Cython debug symbols
130
+ cython_debug/
131
+
132
+ # Vscode config files
133
+ .vscode/
134
+
135
+ # PyCharm
136
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
137
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
138
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
139
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
140
+ #.idea/
141
+
142
+ # Mac
143
+ .DS_Store
144
+
145
+ # Data folder
146
+ data/
@@ -0,0 +1,22 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: "v5.0.0"
4
+ hooks:
5
+ - id: check-case-conflict
6
+ - id: check-merge-conflict
7
+ - id: check-toml
8
+ - id: check-yaml
9
+ - id: check-json
10
+ exclude: ^.devcontainer/devcontainer.json
11
+ - id: pretty-format-json
12
+ exclude: ^.devcontainer/devcontainer.json
13
+ args: [--autofix, --no-sort-keys]
14
+ - id: end-of-file-fixer
15
+ - id: trailing-whitespace
16
+
17
+ - repo: https://github.com/astral-sh/ruff-pre-commit
18
+ rev: "v0.11.5"
19
+ hooks:
20
+ - id: ruff
21
+ args: [--exit-non-zero-on-fix]
22
+ - id: ruff-format
@@ -0,0 +1,126 @@
1
+ # Contributing to `buildstock-fetch`
2
+
3
+ Contributions are welcome, and they are greatly appreciated!
4
+ Every little bit helps, and credit will always be given.
5
+
6
+ You can contribute in many ways:
7
+
8
+ # Types of Contributions
9
+
10
+ ## Report Bugs
11
+
12
+ Report bugs at https://github.com/switchbox-data/buildstock-fetch/issues
13
+
14
+ If you are reporting a bug, please include:
15
+
16
+ - Your operating system name and version.
17
+ - Any details about your local setup that might be helpful in troubleshooting.
18
+ - Detailed steps to reproduce the bug.
19
+
20
+ ## Fix Bugs
21
+
22
+ Look through the GitHub issues for bugs.
23
+ Anything tagged with "bug" and "help wanted" is open to whoever wants to implement a fix for it.
24
+
25
+ ## Implement Features
26
+
27
+ Look through the GitHub issues for features.
28
+ Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.
29
+
30
+ ## Write Documentation
31
+
32
+ buildstock-fetch could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.
33
+
34
+ ## Submit Feedback
35
+
36
+ The best way to send feedback is to file an issue at https://github.com/switchbox-data/buildstock-fetch/issues.
37
+
38
+ If you are proposing a new feature:
39
+
40
+ - Explain in detail how it would work.
41
+ - Keep the scope as narrow as possible, to make it easier to implement.
42
+ - Remember that this is a volunteer-driven project, and that contributions
43
+ are welcome :)
44
+
45
+ # Get Started!
46
+
47
+ Ready to contribute? Here's how to set up `buildstock-fetch` for local development.
48
+ Please note this documentation assumes you already have `uv` and `Git` installed and ready to go.
49
+
50
+ 1. Fork the `buildstock-fetch` repo on GitHub.
51
+
52
+ 2. Clone your fork locally:
53
+
54
+ ```bash
55
+ cd <directory_in_which_repo_should_be_created>
56
+ git clone git@github.com:YOUR_NAME/buildstock-fetch.git
57
+ ```
58
+
59
+ 3. Now we need to install the environment. Navigate into the directory
60
+
61
+ ```bash
62
+ cd buildstock-fetch
63
+ ```
64
+
65
+ Then, install and activate the environment with:
66
+
67
+ ```bash
68
+ uv sync
69
+ ```
70
+
71
+ 4. Install pre-commit to run linters/formatters at commit time:
72
+
73
+ ```bash
74
+ uv run pre-commit install
75
+ ```
76
+
77
+ 5. Create a branch for local development:
78
+
79
+ ```bash
80
+ git checkout -b name-of-your-bugfix-or-feature
81
+ ```
82
+
83
+ Now you can make your changes locally.
84
+
85
+ 6. Don't forget to add test cases for your added functionality to the `tests` directory.
86
+
87
+ 7. When you're done making changes, check that your changes pass the formatting tests.
88
+
89
+ ```bash
90
+ make check
91
+ ```
92
+
93
+ Now, validate that all unit tests are passing:
94
+
95
+ ```bash
96
+ make test
97
+ ```
98
+
99
+ 9. Before raising a pull request you should also run tox.
100
+ This will run the tests across different versions of Python:
101
+
102
+ ```bash
103
+ tox
104
+ ```
105
+
106
+ This requires you to have multiple versions of python installed.
107
+ This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally.
108
+
109
+ 10. Commit your changes and push your branch to GitHub:
110
+
111
+ ```bash
112
+ git add .
113
+ git commit -m "Your detailed description of your changes."
114
+ git push origin name-of-your-bugfix-or-feature
115
+ ```
116
+
117
+ 11. Submit a pull request through the GitHub website.
118
+
119
+ # Pull Request Guidelines
120
+
121
+ Before you submit a pull request, check that it meets these guidelines:
122
+
123
+ 1. The pull request should include tests.
124
+
125
+ 2. If the pull request adds functionality, the docs should be updated.
126
+ Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Switchbox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,54 @@
1
+ .PHONY: install
2
+ install: ## Install the virtual environment and install the pre-commit hooks
3
+ @echo "🚀 Creating virtual environment using uv"
4
+ @uv sync
5
+ @uv run pre-commit install
6
+
7
+ .PHONY: check
8
+ check: ## Run code quality tools.
9
+ @echo "🚀 Checking lock file consistency with 'pyproject.toml'"
10
+ @uv lock --locked
11
+ @echo "🚀 Linting code: Running pre-commit"
12
+ @uv run pre-commit run -a
13
+ @echo "🚀 Static type checking: Running mypy"
14
+ @uv run mypy
15
+ @echo "🚀 Checking for obsolete dependencies: Running deptry"
16
+ @uv run deptry .
17
+
18
+ .PHONY: test
19
+ test: ## Test the code with pytest
20
+ @echo "🚀 Testing code: Running pytest"
21
+ @uv run python -m pytest --doctest-modules
22
+
23
+ .PHONY: build
24
+ build: clean-build ## Build wheel file
25
+ @echo "🚀 Creating wheel file"
26
+ @uvx --from build pyproject-build --installer uv
27
+
28
+ .PHONY: clean-build
29
+ clean-build: ## Clean build artifacts
30
+ @echo "🚀 Removing build artifacts"
31
+ @uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None"
32
+
33
+ .PHONY: publish
34
+ publish: ## Publish a release to PyPI.
35
+ @echo "🚀 Publishing."
36
+ @uvx twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
37
+
38
+ .PHONY: build-and-publish
39
+ build-and-publish: build publish ## Build and publish.
40
+
41
+ .PHONY: docs-test
42
+ docs-test: ## Test if documentation can be built without warnings or errors
43
+ @uv run mkdocs build -s
44
+
45
+ .PHONY: docs
46
+ docs: ## Build and serve the documentation
47
+ @uv run mkdocs serve
48
+
49
+ .PHONY: help
50
+ help:
51
+ @uv run python -c "import re; \
52
+ [[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]"
53
+
54
+ .DEFAULT_GOAL := help
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.4
2
+ Name: buildstock-fetch
3
+ Version: 0.1.0
4
+ Summary: This library simplifies downloading building characteristics and load curve data from NREL's ResStock and ComStock projects.
5
+ Project-URL: Homepage, https://switchbox-data.github.io/buildstock-fetch/
6
+ Project-URL: Repository, https://github.com/switchbox-data/buildstock-fetch
7
+ Project-URL: Documentation, https://switchbox-data.github.io/buildstock-fetch/
8
+ Author-email: Switchbox <bryan@switch.box>
9
+ License-File: LICENSE
10
+ Keywords: python
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: <4.0,>=3.9
21
+ Requires-Dist: requests>=2.32.3
22
+ Description-Content-Type: text/markdown
23
+
24
+ # buildstock-fetch
25
+
26
+ [![Release](https://img.shields.io/github/v/release/switchbox-data/buildstock-fetch)](https://img.shields.io/github/v/release/switchbox-data/buildstock-fetch)
27
+ [![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)
28
+ [![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)
29
+ [![License](https://img.shields.io/github/license/switchbox-data/buildstock-fetch)](https://img.shields.io/github/license/switchbox-data/buildstock-fetch)
30
+
31
+ This library simplifies downloading building characteristics and load curve data from NREL's ResStock and ComStock projects.
32
+
33
+ - **Github repository**: <https://github.com/switchbox-data/buildstock-fetch/>
34
+ - **Documentation** <https://switchbox-data.github.io/buildstock-fetch/>
35
+
36
+ ## Getting start with the project
37
+
38
+ ### 1. Set Up Your Development Environment
39
+
40
+ The easiest way to set up the library's dev 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.
41
+
42
+ Alternatively, you can install the environment and the pre-commit hooks on your laptop with
43
+
44
+ ```bash
45
+ make install
46
+ ```
47
+
48
+ You are now ready to start development on the library!
49
+ The github action CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release.
50
+
51
+ ### 2. Set up PyPI publishing
52
+
53
+ To finalize the set-up for publishing to PyPI, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/publishing/#set-up-for-pypi).
54
+
55
+ ### 3. Activate automatic documentation
56
+ For activating the automatic documentation with MkDocs, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/mkdocs/#enabling-the-documentation-on-github).
57
+
58
+ ## Releasing a new version
59
+
60
+ - Create an API Token on [PyPI](https://pypi.org/).
61
+ - Add the API Token to your projects secrets with the name `PYPI_TOKEN` by visiting [this page](https://github.com/switchbox-data/buildstock-fetch/settings/secrets/actions/new).
62
+ - Create a [new release](https://github.com/switchbox-data/buildstock-fetch/releases/new) on Github.
63
+ - Create a new tag in the form `*.*.*`.
64
+
65
+ For more details, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/cicd/#how-to-trigger-a-release).
66
+
67
+ ---
68
+
69
+ Repository initiated with [fpgmaas/cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv).