tariff_fetch 0.1__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.
- tariff_fetch-0.1/.devcontainer/devcontainer.json +56 -0
- tariff_fetch-0.1/.devcontainer/install-ohmyzsh-plugins.sh +98 -0
- tariff_fetch-0.1/.devcontainer/install-prek-deps.sh +103 -0
- tariff_fetch-0.1/.devcontainer/install-prek.sh +42 -0
- tariff_fetch-0.1/.devcontainer/install-python-deps.sh +101 -0
- tariff_fetch-0.1/.github/ISSUE_TEMPLATE/issue_template.yml +41 -0
- tariff_fetch-0.1/.github/actions/setup-python-env/action.yml +31 -0
- tariff_fetch-0.1/.github/workflows/on-release-main.yml +65 -0
- tariff_fetch-0.1/.github/workflows/python-package-main.yml +72 -0
- tariff_fetch-0.1/.gitignore +73 -0
- tariff_fetch-0.1/.markdownlint.json +8 -0
- tariff_fetch-0.1/.pre-commit-config.yaml +37 -0
- tariff_fetch-0.1/Justfile +104 -0
- tariff_fetch-0.1/LICENSE +21 -0
- tariff_fetch-0.1/PKG-INFO +151 -0
- tariff_fetch-0.1/README.md +118 -0
- tariff_fetch-0.1/docs/cli-usage.md +48 -0
- tariff_fetch-0.1/docs/index.md +54 -0
- tariff_fetch-0.1/docs/providers/arcadia/access.md +24 -0
- tariff_fetch-0.1/docs/providers/arcadia/index.md +33 -0
- tariff_fetch-0.1/docs/providers/arcadia/tariff-json-structure.md +203 -0
- tariff_fetch-0.1/docs/providers/index.md +23 -0
- tariff_fetch-0.1/docs/providers/nrel/access.md +21 -0
- tariff_fetch-0.1/docs/providers/nrel/index.md +42 -0
- tariff_fetch-0.1/docs/providers/nrel/urdb-json-structure.md +1096 -0
- tariff_fetch-0.1/docs/providers/rateacuity/access.md +28 -0
- tariff_fetch-0.1/docs/providers/rateacuity/index.md +39 -0
- tariff_fetch-0.1/docs/wiki/index.md +61 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/delivery-adjustments.md +497 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/index.md +71 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/residential-el1/index.md +954 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/residential-el1-demand/index.md +694 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/residential-el1-tou/index.md +642 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/riders.md +633 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/supply-charges.md +414 -0
- tariff_fetch-0.1/docs/wiki/utilities/coned/variable-rates-api.md +494 -0
- tariff_fetch-0.1/docs/wiki/utilities/index.md +28 -0
- tariff_fetch-0.1/dprint.json +10 -0
- tariff_fetch-0.1/k.py +59 -0
- tariff_fetch-0.1/mkdocs.yml +74 -0
- tariff_fetch-0.1/outputs/RI.json +212 -0
- tariff_fetch-0.1/outputs/arcadia_Consolidated Edison Co-NY Inc_2026-02-10-0.json +4195 -0
- tariff_fetch-0.1/outputs/gas_rateacuity_Bath Electric, Gas and Water Systems_2026-02-17-0.json +154 -0
- tariff_fetch-0.1/outputs/gas_rateacuity_Central Hudson Gas & Electric_2026-02-10-0.json +414 -0
- tariff_fetch-0.1/outputs/gas_rateacuity_Corning Natural Gas_2026-02-11-0.json +724 -0
- tariff_fetch-0.1/outputs/gas_rateacuity_Liberty Utilities_2026-02-17-0.json +173 -0
- tariff_fetch-0.1/outputs/gas_rateacuity_Rhode Island Energy (formally National Grid)_2026-02-10-0.json +158 -0
- tariff_fetch-0.1/outputs/openei_Niagara Mohawk Power Corp._Residential_full_2026-02-17-0.json +21438 -0
- tariff_fetch-0.1/outputs/rateacuity_Bath Electric, Gas and Water Systems.urdb_2026-02-18-0.json +671 -0
- tariff_fetch-0.1/outputs/rateacuity_Bath Electric, Gas and Water Systems_2026-02-17-0.json +1450 -0
- tariff_fetch-0.1/outputs/rateacuity_Bath Electric, Gas and Water Systems_2026-02-18-0.json +2772 -0
- tariff_fetch-0.1/outputs/rateacuity_Central Hudson Gas & Electric.urdb_2026-02-18-0.json +2498 -0
- tariff_fetch-0.1/outputs/rateacuity_Central Hudson Gas & Electric_2026-02-17-0.json +830 -0
- tariff_fetch-0.1/outputs/rateacuity_Chautauqua Utilities.urdb_2026-02-18-0.json +782 -0
- tariff_fetch-0.1/outputs/rateacuity_Consolidated Edison.urdb.2025._2026-02-18-0.json +770 -0
- tariff_fetch-0.1/outputs/rateacuity_Consolidated Edison.urdb_2026-02-18-0.json +8061 -0
- tariff_fetch-0.1/outputs/rateacuity_Consolidated Edison_2026-02-17-0.json +770 -0
- tariff_fetch-0.1/outputs/rateacuity_Consolidated Edison_2026-02-17-1.json +710 -0
- tariff_fetch-0.1/outputs/rateacuity_Hamilton Municipal Utilities.urdb_2026-02-18-0.json +2390 -0
- tariff_fetch-0.1/outputs/rateacuity_Keyspan Gas East_2026-02-17-0.json +1382 -0
- tariff_fetch-0.1/outputs/rateacuity_Niagara Mohawk Power Corporation_2026-02-17-0.json +1578 -0
- tariff_fetch-0.1/outputs/rateacuity_Rhode Island Energy (formally National Grid).urdb_2026-02-18-0.json +1310 -0
- tariff_fetch-0.1/outputs/rateacuity_Rhode Island Energy (formally National Grid)_2026-02-17-0.json +1310 -0
- tariff_fetch-0.1/outputs/rateacuity_Rochester Gas and Electric_2026-02-17-0.json +2588 -0
- tariff_fetch-0.1/outputs/rateacuity_The Brooklyn Union Gas Company.urdb_2026-02-18-0.json +6454 -0
- tariff_fetch-0.1/outputs/rateacuity_The Brooklyn Union Gas Company_2026-02-17-0.json +1538 -0
- tariff_fetch-0.1/outputs/rateacuity_The Brooklyn Union Gas Company_2026-02-17-1.json +734 -0
- tariff_fetch-0.1/pyproject.toml +80 -0
- tariff_fetch-0.1/t.py +55 -0
- tariff_fetch-0.1/t1.py +25 -0
- tariff_fetch-0.1/tariff_fetch/__init__.py +3 -0
- tariff_fetch-0.1/tariff_fetch/_cli/__init__.py +33 -0
- tariff_fetch-0.1/tariff_fetch/_cli/genability.py +152 -0
- tariff_fetch-0.1/tariff_fetch/_cli/openei.py +89 -0
- tariff_fetch-0.1/tariff_fetch/_cli/rateacuity.py +164 -0
- tariff_fetch-0.1/tariff_fetch/_cli/rateacuity_gas_urdb.py +138 -0
- tariff_fetch-0.1/tariff_fetch/_cli/types.py +67 -0
- tariff_fetch-0.1/tariff_fetch/arcadiaurdb_.py +0 -0
- tariff_fetch-0.1/tariff_fetch/cli.py +179 -0
- tariff_fetch-0.1/tariff_fetch/cli_gas.py +72 -0
- tariff_fetch-0.1/tariff_fetch/foo.py +6 -0
- tariff_fetch-0.1/tariff_fetch/genability/__init__.py +1 -0
- tariff_fetch-0.1/tariff_fetch/genability/base.py +24 -0
- tariff_fetch-0.1/tariff_fetch/genability/converters.py +9 -0
- tariff_fetch-0.1/tariff_fetch/genability/lse.py +70 -0
- tariff_fetch-0.1/tariff_fetch/genability/pagination.py +12 -0
- tariff_fetch-0.1/tariff_fetch/genability/response.py +437 -0
- tariff_fetch-0.1/tariff_fetch/genability/search.py +42 -0
- tariff_fetch-0.1/tariff_fetch/genability/tariffs.py +126 -0
- tariff_fetch-0.1/tariff_fetch/openei/__init__.py +0 -0
- tariff_fetch-0.1/tariff_fetch/openei/base.py +26 -0
- tariff_fetch-0.1/tariff_fetch/openei/utility_rates.py +347 -0
- tariff_fetch-0.1/tariff_fetch/openeia.py +47 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/__init__.py +2 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/base.py +67 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/report_tables.py +81 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/schema.py +220 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/state.py +515 -0
- tariff_fetch-0.1/tariff_fetch/rateacuity/urdb.py +12 -0
- tariff_fetch-0.1/tariff_fetch/urdb/__init__.py +0 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_gas.py +53 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_history_gas/__init__.py +78 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_history_gas/exceptions.py +15 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_history_gas/history_data.py +162 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_history_gas/shared.py +19 -0
- tariff_fetch-0.1/tariff_fetch/urdb/rateacuity_history_gas/types.py +36 -0
- tariff_fetch-0.1/tariff_fetch/urdb/schema.py +179 -0
- tariff_fetch-0.1/tests/test_foo.py +9 -0
- tariff_fetch-0.1/tox.ini +9 -0
- tariff_fetch-0.1/uv.lock +1728 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tariff_fetch",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
|
|
4
|
+
"features": {
|
|
5
|
+
"ghcr.io/guiyomh/features/just:0.1.0": { "version": "1.42.4" },
|
|
6
|
+
"ghcr.io/devcontainers/features/python:1": { "version": "os-provided" },
|
|
7
|
+
"ghcr.io/kreemer/features/chrometesting:1": {},
|
|
8
|
+
"ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {
|
|
9
|
+
"plugins": "git colored-man-pages colorize history zsh-autosuggestions fast-syntax-highlighting zsh-autocomplete",
|
|
10
|
+
"theme": "bira"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"postCreateCommand": "bash -c '.devcontainer/install-ohmyzsh-plugins.sh && .devcontainer/install-python-deps.sh && .devcontainer/install-prek.sh && .devcontainer/install-prek-deps.sh'",
|
|
14
|
+
"customizations": {
|
|
15
|
+
"vscode": {
|
|
16
|
+
"extensions": [
|
|
17
|
+
"tombi-toml.tombi",
|
|
18
|
+
"nefrob.vscode-just-syntax",
|
|
19
|
+
"davidanson.vscode-markdownlint",
|
|
20
|
+
"christian-kohler.path-intellisense",
|
|
21
|
+
"ms-python.python",
|
|
22
|
+
"charliermarsh.ruff",
|
|
23
|
+
"astral-sh.ty",
|
|
24
|
+
"tekumara.typos-vscode",
|
|
25
|
+
"foxundermoon.shell-format",
|
|
26
|
+
"dprint.dprint"
|
|
27
|
+
],
|
|
28
|
+
"settings": {
|
|
29
|
+
"python.defaultInterpreterPath": "/workspaces/tariff_fetch/.venv/bin/python",
|
|
30
|
+
"python.terminal.activateEnvironment": false,
|
|
31
|
+
"python.testing.pytestArgs": ["tests"],
|
|
32
|
+
"python.testing.pytestPath": "/workspaces/tariff_fetch/.venv/bin/pytest",
|
|
33
|
+
"python.testing.unittestEnabled": false,
|
|
34
|
+
"python.testing.pytestEnabled": true,
|
|
35
|
+
"ruff.nativeServer": "on",
|
|
36
|
+
"[python]": {
|
|
37
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
38
|
+
"editor.formatOnSave": true,
|
|
39
|
+
"editor.codeActionsOnSave": {
|
|
40
|
+
"source.fixAll": "explicit",
|
|
41
|
+
"source.organizeImports": "explicit"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"shellformat.flag": "-i 2",
|
|
45
|
+
"[shellscript]": {
|
|
46
|
+
"editor.defaultFormatter": "foxundermoon.shell-format",
|
|
47
|
+
"editor.formatOnSave": true
|
|
48
|
+
},
|
|
49
|
+
"[markdown]": {
|
|
50
|
+
"editor.defaultFormatter": "dprint.dprint",
|
|
51
|
+
"editor.formatOnSave": true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# install-ohmyzsh-plugins.sh - Install custom oh-my-zsh plugins
|
|
5
|
+
#
|
|
6
|
+
# This script clones custom oh-my-zsh plugins for the current user.
|
|
7
|
+
|
|
8
|
+
echo "===================================================================="
|
|
9
|
+
echo "🔌 Installing custom oh-my-zsh plugins"
|
|
10
|
+
echo "===================================================================="
|
|
11
|
+
echo
|
|
12
|
+
|
|
13
|
+
PLUGINS_DIR="${HOME}/.oh-my-zsh/custom/plugins"
|
|
14
|
+
|
|
15
|
+
# Initialize counters for installed and existing plugins
|
|
16
|
+
INSTALLED_COUNT=0
|
|
17
|
+
EXISTING_COUNT=0
|
|
18
|
+
|
|
19
|
+
# Verify oh-my-zsh is installed
|
|
20
|
+
if [[ -d "${HOME}/.oh-my-zsh" ]]; then
|
|
21
|
+
# Get oh-my-zsh version from git
|
|
22
|
+
if [[ -d "${HOME}/.oh-my-zsh/.git" ]]; then
|
|
23
|
+
# Try different methods to get version info
|
|
24
|
+
if OMZ_VERSION=$(cd "${HOME}/.oh-my-zsh" && git describe --tags 2>/dev/null); then
|
|
25
|
+
echo "✅ Found oh-my-zsh version: ${OMZ_VERSION}"
|
|
26
|
+
elif OMZ_COMMIT=$(cd "${HOME}/.oh-my-zsh" && git rev-parse --short HEAD 2>/dev/null); then
|
|
27
|
+
echo "✅ Found oh-my-zsh commit: ${OMZ_COMMIT}"
|
|
28
|
+
else
|
|
29
|
+
echo "✅ Found oh-my-zsh at ${HOME}/.oh-my-zsh"
|
|
30
|
+
fi
|
|
31
|
+
else
|
|
32
|
+
echo "✅ Found oh-my-zsh at ${HOME}/.oh-my-zsh"
|
|
33
|
+
fi
|
|
34
|
+
else
|
|
35
|
+
echo "❌ ERROR: oh-my-zsh not found at ${HOME}/.oh-my-zsh" >&2
|
|
36
|
+
echo "The zsh feature must be installed first" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
echo
|
|
40
|
+
|
|
41
|
+
# Create plugins directory if it doesn't exist
|
|
42
|
+
if [[ -d "${PLUGINS_DIR}" ]]; then
|
|
43
|
+
echo "✅ Found plugins directory: ${PLUGINS_DIR}"
|
|
44
|
+
else
|
|
45
|
+
echo "📁 Creating plugins directory: ${PLUGINS_DIR}"
|
|
46
|
+
mkdir -p "${PLUGINS_DIR}"
|
|
47
|
+
fi
|
|
48
|
+
echo
|
|
49
|
+
|
|
50
|
+
# Clone zsh-autosuggestions
|
|
51
|
+
if [[ -d "${PLUGINS_DIR}/zsh-autosuggestions" ]]; then
|
|
52
|
+
echo "✅ zsh-autosuggestions already installed"
|
|
53
|
+
EXISTING_COUNT=$((EXISTING_COUNT + 1))
|
|
54
|
+
else
|
|
55
|
+
echo "📦 Cloning zsh-autosuggestions..."
|
|
56
|
+
git clone --quiet https://github.com/zsh-users/zsh-autosuggestions.git \
|
|
57
|
+
"${PLUGINS_DIR}/zsh-autosuggestions"
|
|
58
|
+
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Clone fast-syntax-highlighting
|
|
62
|
+
if [[ -d "${PLUGINS_DIR}/fast-syntax-highlighting" ]]; then
|
|
63
|
+
echo "✅ fast-syntax-highlighting already installed"
|
|
64
|
+
EXISTING_COUNT=$((EXISTING_COUNT + 1))
|
|
65
|
+
else
|
|
66
|
+
echo "📦 Cloning fast-syntax-highlighting..."
|
|
67
|
+
git clone --quiet https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
|
|
68
|
+
"${PLUGINS_DIR}/fast-syntax-highlighting"
|
|
69
|
+
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Clone zsh-autocomplete
|
|
73
|
+
if [[ -d "${PLUGINS_DIR}/zsh-autocomplete" ]]; then
|
|
74
|
+
echo "✅ zsh-autocomplete already installed"
|
|
75
|
+
EXISTING_COUNT=$((EXISTING_COUNT + 1))
|
|
76
|
+
else
|
|
77
|
+
echo "📦 Cloning zsh-autocomplete..."
|
|
78
|
+
git clone --quiet --depth 1 https://github.com/marlonrichert/zsh-autocomplete.git \
|
|
79
|
+
"${PLUGINS_DIR}/zsh-autocomplete"
|
|
80
|
+
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
echo
|
|
84
|
+
|
|
85
|
+
# Display summary
|
|
86
|
+
if [[ $INSTALLED_COUNT -gt 0 ]] && [[ $EXISTING_COUNT -gt 0 ]]; then
|
|
87
|
+
echo "✅ Installed ${INSTALLED_COUNT} plugin(s), ${EXISTING_COUNT} already installed"
|
|
88
|
+
elif [[ $INSTALLED_COUNT -gt 0 ]]; then
|
|
89
|
+
echo "✅ Installed ${INSTALLED_COUNT} plugin(s)"
|
|
90
|
+
else
|
|
91
|
+
echo "✅ ${EXISTING_COUNT} plugin(s) already installed"
|
|
92
|
+
fi
|
|
93
|
+
echo
|
|
94
|
+
echo "===================================================================="
|
|
95
|
+
echo "✨ oh-my-zsh plugins installed successfully!"
|
|
96
|
+
echo "===================================================================="
|
|
97
|
+
echo
|
|
98
|
+
echo
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# install-prek-deps.sh - Install prek pre-commit hooks
|
|
5
|
+
#
|
|
6
|
+
# Requirements:
|
|
7
|
+
# - prek must be installed
|
|
8
|
+
# - .pre-commit-config.yaml file must exist
|
|
9
|
+
|
|
10
|
+
echo "===================================================================="
|
|
11
|
+
echo "🪝 Installing prek pre-commit hooks from .pre-commit-config.yaml"
|
|
12
|
+
echo "===================================================================="
|
|
13
|
+
echo
|
|
14
|
+
|
|
15
|
+
# Find the git repository root and cd there
|
|
16
|
+
# This works in both devcontainers and on laptops
|
|
17
|
+
REPO_ROOT=$(git rev-parse --show-toplevel 2>&1) || {
|
|
18
|
+
# Git may fail with "dubious ownership" in containers where mounted files
|
|
19
|
+
# are owned by a different user than the running process. This happens because:
|
|
20
|
+
# - Docker Desktop on Mac maps host user UIDs to container UIDs (often UID 1000)
|
|
21
|
+
# - The container runs as root (UID 0)
|
|
22
|
+
# - Git sees the mismatch and refuses to operate (security feature from CVE-2022-24765)
|
|
23
|
+
# The safe.directory config tells git to trust this specific directory.
|
|
24
|
+
# We only add it when the dubious ownership error occurs, not unconditionally.
|
|
25
|
+
if echo "$REPO_ROOT" | grep -q "dubious ownership"; then
|
|
26
|
+
git config --global --add safe.directory "$(pwd)"
|
|
27
|
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
28
|
+
else
|
|
29
|
+
echo "❌ ERROR: Not in a git repository" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
cd "${REPO_ROOT}"
|
|
34
|
+
echo "📁 Working in repository: ${REPO_ROOT}"
|
|
35
|
+
echo
|
|
36
|
+
|
|
37
|
+
# Check if .pre-commit-config.yaml exists
|
|
38
|
+
PRECOMMIT_CONFIG=".pre-commit-config.yaml"
|
|
39
|
+
if [ -f "${PRECOMMIT_CONFIG}" ]; then
|
|
40
|
+
echo "✅ Found .pre-commit-config.yaml: $(realpath "${PRECOMMIT_CONFIG}")"
|
|
41
|
+
else
|
|
42
|
+
echo "❌ ERROR: .pre-commit-config.yaml is necessary but not found in $(pwd)" >&2
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
echo
|
|
46
|
+
|
|
47
|
+
# Check if prek is installed
|
|
48
|
+
echo "📦 Checking for prek..."
|
|
49
|
+
echo
|
|
50
|
+
if command -v prek >/dev/null 2>&1; then
|
|
51
|
+
PREK_VERSION=$(prek --version 2>&1)
|
|
52
|
+
echo "✅ Using: ${PREK_VERSION}"
|
|
53
|
+
else
|
|
54
|
+
echo "❌ ERROR: prek is not installed" >&2
|
|
55
|
+
echo "Expected location: ${HOME}/.local/bin/prek" >&2
|
|
56
|
+
echo "" >&2
|
|
57
|
+
echo "Install prek first by running: .devcontainer/install-prek.sh" >&2
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
echo
|
|
61
|
+
|
|
62
|
+
# Check if pre-commit hooks are already installed
|
|
63
|
+
PRECOMMIT_HOOK=".git/hooks/pre-commit"
|
|
64
|
+
HOOKS_ALREADY_INSTALLED=false
|
|
65
|
+
|
|
66
|
+
if [ -f "${PRECOMMIT_HOOK}" ]; then
|
|
67
|
+
# Check if it's a prek-managed hook
|
|
68
|
+
if grep -q "prek" "${PRECOMMIT_HOOK}" 2>/dev/null; then
|
|
69
|
+
HOOKS_ALREADY_INSTALLED=true
|
|
70
|
+
fi
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Count total hooks from .pre-commit-config.yaml (look for "- id:" pattern)
|
|
74
|
+
TOTAL_HOOKS=$(grep -c "^\s*- id:" .pre-commit-config.yaml 2>/dev/null || echo "0")
|
|
75
|
+
# Ensure it's a single integer
|
|
76
|
+
TOTAL_HOOKS=$(echo "$TOTAL_HOOKS" | head -1 | tr -d ' ')
|
|
77
|
+
|
|
78
|
+
# Install prek pre-commit hooks
|
|
79
|
+
if [ "$HOOKS_ALREADY_INSTALLED" = true ]; then
|
|
80
|
+
if [ "$TOTAL_HOOKS" -gt 0 ] 2>/dev/null; then
|
|
81
|
+
echo "✅ ${TOTAL_HOOKS} pre-commit hooks already installed"
|
|
82
|
+
else
|
|
83
|
+
echo "✅ Pre-commit hooks already installed"
|
|
84
|
+
fi
|
|
85
|
+
else
|
|
86
|
+
echo "📥 Installing prek pre-commit hooks..."
|
|
87
|
+
PREK_OUTPUT=$(prek install --install-hooks 2>&1)
|
|
88
|
+
echo "$PREK_OUTPUT"
|
|
89
|
+
echo
|
|
90
|
+
|
|
91
|
+
if [ "$TOTAL_HOOKS" -gt 0 ] 2>/dev/null; then
|
|
92
|
+
echo "✅ Installed ${TOTAL_HOOKS} pre-commit hooks"
|
|
93
|
+
else
|
|
94
|
+
echo "✅ Pre-commit hooks installed"
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
echo
|
|
98
|
+
|
|
99
|
+
echo "===================================================================="
|
|
100
|
+
echo "✨ prek pre-commit hooks installed successfully!"
|
|
101
|
+
echo "===================================================================="
|
|
102
|
+
echo
|
|
103
|
+
echo
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# install-prek.sh - Install prek CLI for pre-commit hooks
|
|
5
|
+
#
|
|
6
|
+
# This script installs prek for the current user.
|
|
7
|
+
# The actual hook installation (prek install --install-hooks) happens
|
|
8
|
+
# after the container starts, when .git/ is mounted from the host.
|
|
9
|
+
|
|
10
|
+
echo "===================================================================="
|
|
11
|
+
echo "🪝 Installing prek pre-commit hook framework"
|
|
12
|
+
echo "===================================================================="
|
|
13
|
+
echo
|
|
14
|
+
|
|
15
|
+
# Install prek
|
|
16
|
+
echo "📦 Installing prek"
|
|
17
|
+
curl --proto '=https' --tlsv1.2 -LsSf \
|
|
18
|
+
https://github.com/j178/prek/releases/download/v0.2.11/prek-installer.sh | sh
|
|
19
|
+
echo
|
|
20
|
+
|
|
21
|
+
# Add prek to PATH for this session
|
|
22
|
+
# The installer adds prek to ~/.local/bin, so we add that to PATH
|
|
23
|
+
export PATH="${HOME}/.local/bin:${PATH}"
|
|
24
|
+
|
|
25
|
+
# Verify installation
|
|
26
|
+
if ! PREK_VERSION=$(prek --version 2>&1); then
|
|
27
|
+
echo "❌ ERROR: prek installation failed or prek command not found" >&2
|
|
28
|
+
echo "Expected location: ${HOME}/.local/bin/prek" >&2
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "✅ Installed: ${PREK_VERSION}"
|
|
33
|
+
|
|
34
|
+
echo
|
|
35
|
+
echo "💡 To install pre-commit hooks:"
|
|
36
|
+
echo " prek install --install-hooks"
|
|
37
|
+
echo
|
|
38
|
+
echo "===================================================================="
|
|
39
|
+
echo "✨ prek installed successfully!"
|
|
40
|
+
echo "===================================================================="
|
|
41
|
+
echo
|
|
42
|
+
echo
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# install-python-deps.sh - Install Python dependencies using uv
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# ./install-python-deps.sh [path/to/workspace]
|
|
8
|
+
#
|
|
9
|
+
# This script:
|
|
10
|
+
# 1. Checks if Python is installed
|
|
11
|
+
# 2. Installs uv package manager
|
|
12
|
+
# 3. Installs Python dependencies from pyproject.toml + uv.lock
|
|
13
|
+
#
|
|
14
|
+
# Requirements:
|
|
15
|
+
# - Python must be installed
|
|
16
|
+
# - pyproject.toml and uv.lock must exist in the workspace directory
|
|
17
|
+
|
|
18
|
+
WORKSPACE_PATH="${1:-.}"
|
|
19
|
+
|
|
20
|
+
echo "===================================================================="
|
|
21
|
+
echo "🐍 Installing Python dependencies from pyproject.toml + uv.lock"
|
|
22
|
+
echo "===================================================================="
|
|
23
|
+
echo
|
|
24
|
+
|
|
25
|
+
# Check if Python is installed
|
|
26
|
+
if command -v python3 >/dev/null 2>&1; then
|
|
27
|
+
PYTHON_VERSION=$(python3 --version)
|
|
28
|
+
echo "✅ Using: ${PYTHON_VERSION}"
|
|
29
|
+
else
|
|
30
|
+
echo "❌ ERROR: Python is not installed" >&2
|
|
31
|
+
echo "" >&2
|
|
32
|
+
echo "Please install Python before running this script:" >&2
|
|
33
|
+
echo " • Ubuntu/Debian: sudo apt-get install python3" >&2
|
|
34
|
+
echo " • macOS: brew install python3" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
echo
|
|
38
|
+
|
|
39
|
+
# Check if pyproject.toml exists
|
|
40
|
+
PYPROJECT_PATH="${WORKSPACE_PATH}/pyproject.toml"
|
|
41
|
+
if [ -f "${PYPROJECT_PATH}" ]; then
|
|
42
|
+
echo "✅ Found pyproject.toml: $(realpath "${PYPROJECT_PATH}")"
|
|
43
|
+
else
|
|
44
|
+
echo "❌ ERROR: pyproject.toml is necessary but not found in ${WORKSPACE_PATH}" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
echo
|
|
48
|
+
|
|
49
|
+
# Check if uv is already installed
|
|
50
|
+
# Add common uv installation paths to PATH for checking
|
|
51
|
+
export PATH="${HOME}/.local/bin:${PATH}"
|
|
52
|
+
|
|
53
|
+
if command -v uv >/dev/null 2>&1; then
|
|
54
|
+
UV_VERSION=$(uv --version 2>&1)
|
|
55
|
+
echo "✅ uv already installed: ${UV_VERSION}"
|
|
56
|
+
else
|
|
57
|
+
# Install uv package manager
|
|
58
|
+
echo "📦 Installing uv package manager..."
|
|
59
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
60
|
+
|
|
61
|
+
# Add uv to PATH for this session so command can be used
|
|
62
|
+
# The installer adds uv to ~/.local/bin
|
|
63
|
+
export PATH="${HOME}/.local/bin:${PATH}"
|
|
64
|
+
|
|
65
|
+
# Verify installation
|
|
66
|
+
if UV_VERSION=$(uv --version 2>&1); then
|
|
67
|
+
echo "✅ Installed: ${UV_VERSION}"
|
|
68
|
+
else
|
|
69
|
+
echo "❌ ERROR: uv installation failed or uv command not found" >&2
|
|
70
|
+
echo "Expected location: ${HOME}/.local/bin/uv" >&2
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
echo
|
|
75
|
+
|
|
76
|
+
# Change to workspace directory
|
|
77
|
+
cd "${WORKSPACE_PATH}"
|
|
78
|
+
|
|
79
|
+
# Install Python dependencies
|
|
80
|
+
echo "📥 Installing Python dependencies from pyproject.toml + uv.lock..."
|
|
81
|
+
UV_OUTPUT=$(uv sync --group dev 2>&1)
|
|
82
|
+
echo "$UV_OUTPUT"
|
|
83
|
+
echo
|
|
84
|
+
|
|
85
|
+
# Parse uv output to determine what happened
|
|
86
|
+
if echo "$UV_OUTPUT" | grep -q "Installed [0-9]"; then
|
|
87
|
+
PACKAGE_COUNT=$(echo "$UV_OUTPUT" | grep -o "Installed [0-9]\+ package" | grep -o "[0-9]\+")
|
|
88
|
+
echo "✅ Installed ${PACKAGE_COUNT} Python packages"
|
|
89
|
+
elif echo "$UV_OUTPUT" | grep -q "Audited [0-9]"; then
|
|
90
|
+
PACKAGE_COUNT=$(echo "$UV_OUTPUT" | grep -o "Audited [0-9]\+ package" | grep -o "[0-9]\+")
|
|
91
|
+
echo "✅ ${PACKAGE_COUNT} Python packages already installed"
|
|
92
|
+
else
|
|
93
|
+
echo "✅ Python packages ready"
|
|
94
|
+
fi
|
|
95
|
+
echo
|
|
96
|
+
|
|
97
|
+
echo "===================================================================="
|
|
98
|
+
echo "✨ Python dependencies installed successfully!"
|
|
99
|
+
echo "===================================================================="
|
|
100
|
+
echo
|
|
101
|
+
echo
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Data science task
|
|
2
|
+
description: Help describe what you're building and why
|
|
3
|
+
title: "Short title that captures the 'What'"
|
|
4
|
+
labels: []
|
|
5
|
+
assignees: []
|
|
6
|
+
body:
|
|
7
|
+
- type: textarea
|
|
8
|
+
id: what
|
|
9
|
+
attributes:
|
|
10
|
+
label: What
|
|
11
|
+
description: Describe what you're building in 1-2 clear sentences. Focus on the end result, not the implementation details.
|
|
12
|
+
placeholder: "Example: A new residential heat pump model that accounts for variable-speed compressor operation and ambient temperature derating effects."
|
|
13
|
+
validations:
|
|
14
|
+
required: true
|
|
15
|
+
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: why
|
|
18
|
+
attributes:
|
|
19
|
+
label: Why
|
|
20
|
+
description: Explain the problem this solves or the value it creates. Include context about who benefits and why this matters now.
|
|
21
|
+
placeholder: "Example: Current OCHRE heat pump models assume fixed-speed operation, leading to 15-20% overestimation of energy consumption in moderate climates. This enhancement will improve accuracy for policy analyses evaluating electrification incentives and grid impact studies."
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
|
|
25
|
+
- type: textarea
|
|
26
|
+
id: how
|
|
27
|
+
attributes:
|
|
28
|
+
label: How
|
|
29
|
+
description: Outline your approach or key steps. This doesn't need to be exhaustive - just enough to show you have a plan.
|
|
30
|
+
placeholder: "Example:\n1. Implement variable-speed compressor performance curves from AHRI standards\n2. Add ambient temperature correction factors based on manufacturer data\n3. Integrate with existing OCHRE thermal model architecture\n4. Validate against lab test data and field measurements"
|
|
31
|
+
validations:
|
|
32
|
+
required: false
|
|
33
|
+
|
|
34
|
+
- type: textarea
|
|
35
|
+
id: deliverables
|
|
36
|
+
attributes:
|
|
37
|
+
label: Deliverables
|
|
38
|
+
description: List the specific outputs others can expect. Be concrete about what will be delivered.
|
|
39
|
+
placeholder: "- New HeatPumpVarSpeed class extending base OCHRE equipment\n- Performance curve parameter database\n- Unit tests with validation data\n- Documentation with physics equations and policy use cases"
|
|
40
|
+
validations:
|
|
41
|
+
required: true
|
|
@@ -0,0 +1,31 @@
|
|
|
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.13"
|
|
9
|
+
uv-version:
|
|
10
|
+
description: "uv version to use"
|
|
11
|
+
required: true
|
|
12
|
+
default: "0.8.22"
|
|
13
|
+
|
|
14
|
+
runs:
|
|
15
|
+
using: "composite"
|
|
16
|
+
steps:
|
|
17
|
+
- name: Install Python
|
|
18
|
+
uses: actions/setup-python@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ inputs.python-version }}
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v6
|
|
24
|
+
with:
|
|
25
|
+
version: ${{ inputs.uv-version }}
|
|
26
|
+
enable-cache: 'true'
|
|
27
|
+
cache-suffix: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install Python dependencies
|
|
30
|
+
run: uv sync --frozen
|
|
31
|
+
shell: bash
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: release-main
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
set-version:
|
|
9
|
+
runs-on: ubuntu-24.04
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Export tag
|
|
14
|
+
id: vars
|
|
15
|
+
run: echo tag=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
|
|
16
|
+
if: ${{ github.event_name == 'release' }}
|
|
17
|
+
|
|
18
|
+
- name: Update project version
|
|
19
|
+
run: |
|
|
20
|
+
sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml
|
|
21
|
+
env:
|
|
22
|
+
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
|
23
|
+
if: ${{ github.event_name == 'release' }}
|
|
24
|
+
|
|
25
|
+
- name: Upload updated pyproject.toml
|
|
26
|
+
uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: pyproject-toml
|
|
29
|
+
path: pyproject.toml
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
needs: [set-version]
|
|
34
|
+
steps:
|
|
35
|
+
- name: Check out
|
|
36
|
+
uses: actions/checkout@v4
|
|
37
|
+
|
|
38
|
+
- name: Set up the environment
|
|
39
|
+
uses: ./.github/actions/setup-python-env
|
|
40
|
+
|
|
41
|
+
- name: Download updated pyproject.toml
|
|
42
|
+
uses: actions/download-artifact@v4
|
|
43
|
+
with:
|
|
44
|
+
name: pyproject-toml
|
|
45
|
+
|
|
46
|
+
- name: Build package
|
|
47
|
+
run: uv build
|
|
48
|
+
|
|
49
|
+
- name: Publish package
|
|
50
|
+
run: uv publish
|
|
51
|
+
env:
|
|
52
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
53
|
+
|
|
54
|
+
deploy-docs:
|
|
55
|
+
needs: publish
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
steps:
|
|
58
|
+
- name: Check out
|
|
59
|
+
uses: actions/checkout@v4
|
|
60
|
+
|
|
61
|
+
- name: Set up the environment
|
|
62
|
+
uses: ./.github/actions/setup-python-env
|
|
63
|
+
|
|
64
|
+
- name: Deploy documentation
|
|
65
|
+
run: uv run mkdocs gh-deploy --force
|
|
@@ -0,0 +1,72 @@
|
|
|
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@v5
|
|
16
|
+
|
|
17
|
+
- name: Set up the environment
|
|
18
|
+
uses: ./.github/actions/setup-python-env
|
|
19
|
+
|
|
20
|
+
- name: Run ruff, ty and pre-commit hooks
|
|
21
|
+
uses: j178/prek-action@v1
|
|
22
|
+
|
|
23
|
+
tests-and-type-check:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
strategy:
|
|
26
|
+
matrix:
|
|
27
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
28
|
+
fail-fast: false
|
|
29
|
+
defaults:
|
|
30
|
+
run:
|
|
31
|
+
shell: bash
|
|
32
|
+
steps:
|
|
33
|
+
- name: Check out
|
|
34
|
+
uses: actions/checkout@v5
|
|
35
|
+
|
|
36
|
+
- name: Set up the environment
|
|
37
|
+
uses: ./.github/actions/setup-python-env
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python-version }}
|
|
40
|
+
|
|
41
|
+
- name: Run tests
|
|
42
|
+
run: uv run python -m pytest tests
|
|
43
|
+
|
|
44
|
+
- name: Check typing
|
|
45
|
+
run: uv run ty check
|
|
46
|
+
|
|
47
|
+
check-docs:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: Check out
|
|
51
|
+
uses: actions/checkout@v5
|
|
52
|
+
|
|
53
|
+
- name: Set up the environment
|
|
54
|
+
uses: ./.github/actions/setup-python-env
|
|
55
|
+
|
|
56
|
+
- name: Check if documentation can be built
|
|
57
|
+
run: uv run mkdocs build -s
|
|
58
|
+
|
|
59
|
+
deploy-docs:
|
|
60
|
+
if: github.event_name == 'push'
|
|
61
|
+
needs: [check-docs]
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
|
|
65
|
+
- name: Check out
|
|
66
|
+
uses: actions/checkout@v5
|
|
67
|
+
|
|
68
|
+
- name: Set up the environment
|
|
69
|
+
uses: ./.github/actions/setup-python-env
|
|
70
|
+
|
|
71
|
+
- name: Deploy documentation
|
|
72
|
+
run: uv run mkdocs gh-deploy --force
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# PyInstaller
|
|
25
|
+
*.manifest
|
|
26
|
+
*.spec
|
|
27
|
+
|
|
28
|
+
# Unit test / coverage reports
|
|
29
|
+
htmlcov/
|
|
30
|
+
.tox/
|
|
31
|
+
.nox/
|
|
32
|
+
.coverage
|
|
33
|
+
.coverage.*
|
|
34
|
+
.cache
|
|
35
|
+
nosetests.xml
|
|
36
|
+
coverage.xml
|
|
37
|
+
*.cover
|
|
38
|
+
.hypothesis/
|
|
39
|
+
.pytest_cache/
|
|
40
|
+
|
|
41
|
+
# Virtual environments
|
|
42
|
+
.env
|
|
43
|
+
.venv
|
|
44
|
+
env/
|
|
45
|
+
venv/
|
|
46
|
+
ENV/
|
|
47
|
+
env.bak/
|
|
48
|
+
venv.bak/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# IDEs
|
|
54
|
+
.vscode/
|
|
55
|
+
.idea/
|
|
56
|
+
*.swp
|
|
57
|
+
*.swo
|
|
58
|
+
*~
|
|
59
|
+
|
|
60
|
+
# OS
|
|
61
|
+
.DS_Store
|
|
62
|
+
.DS_Store?
|
|
63
|
+
._*
|
|
64
|
+
.Spotlight-V100
|
|
65
|
+
.Trashes
|
|
66
|
+
ehthumbs.db
|
|
67
|
+
Thumbs.db
|
|
68
|
+
|
|
69
|
+
# Project specific
|
|
70
|
+
site/
|
|
71
|
+
tmp/
|
|
72
|
+
main.py
|
|
73
|
+
selenium_error.png
|