Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
uses: astral-sh/setup-uv@v6

- name: Sync dependencies
run: uv sync --frozen --all-groups

- name: Run tests
run: uv run python -m pytest tests -q
8 changes: 3 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-ast
- id: check-added-large-files
Expand All @@ -18,20 +18,18 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys']
exclude: examples/.*.ipynb
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.9.1
hooks:
- id: nbstripout
# https://docs.astral.sh/ruff/integrations/#pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.15.20
hooks:
# Run the linter
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributors

- Nicholas Long, NREL <https://github.com/nllong>
- Nicholas Long, NLR <https://github.com/nllong>
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ git clone git@github.com:SEED-platform/py-seed.git
git checkout develop
```

Then install the poetry-based dependencies. Note that installing a package from GitHub through poetry can cause some issues with updating, therefore, it is easiest (for now) to clone the dependencies manually.
This repository uses uv for environment and dependency management.

Supported Python versions are 3.10 through 3.12.

```
pip install poetry
poetry install
uv sync --all-groups
```

### Configuring
Expand Down
1 change: 1 addition & 0 deletions examples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Example scripts package."""
1 change: 1 addition & 0 deletions examples/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Shared helpers for pyseed examples."""
13 changes: 7 additions & 6 deletions examples/lib/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import calendar
from itertools import islice


Expand All @@ -15,7 +16,7 @@ def chunks(data, size):
def map_months_to_date(year, values=None):
month_map = {
"JANUARY": {"start_time": f"{year}-01-01", "end_time": f"{year}-01-31"},
"FEBRUARY": {"start_time": f"{year}-02-01", "end_time": f"{year}-02-{29 if (year % 4) == 0 else 28}"},
"FEBRUARY": {"start_time": f"{year}-02-01", "end_time": f"{year}-02-{29 if calendar.isleap(year) else 28}"},
"MARCH": {"start_time": f"{year}-03-01", "end_time": f"{year}-03-31"},
"APRIL": {"start_time": f"{year}-04-01", "end_time": f"{year}-04-30"},
"MAY": {"start_time": f"{year}-05-01", "end_time": f"{year}-05-31"},
Expand All @@ -42,12 +43,12 @@ def map_months_to_date(year, values=None):
# "ELECTRICITYUSE_KBTU_MARCH": 2728590.7,

for key, value in values.items():
for month in month_map:
for month, month_value in month_map.items():
if month in key:
month_map[month]["reading"] = value
month_map[month]["source_unit"] = "kBtu (Thousand BTU)"
month_map[month]["conversion_factor"] = 1
results.append(month_map[month])
month_value["reading"] = value
month_value["source_unit"] = "kBtu (Thousand BTU)"
month_value["conversion_factor"] = 1
results.append(month_value)
else:
for key, value in month_map.items():
results.append(value)
Expand Down
2 changes: 1 addition & 1 deletion examples/seed_better.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./manage.py create_test_user_json --username nicholas.long@nrel.gov --file ../py-seed/seed-config.json --pyseed
# ./manage.py create_test_user_json --username nicholas.long@nlr.gov --file ../py-seed/seed-config.json --pyseed
# Make sure that the host is localhost and not 127.0.0.1. For some reason the organization endpoints only work on
# localhost.

Expand Down
2 changes: 1 addition & 1 deletion examples/seed_bps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # ./manage.py create_test_user_json --username nicholas.long@nrel.gov --file ../py-seed/seed-config.json --pyseed
# # ./manage.py create_test_user_json --username nicholas.long@nlr.gov --file ../py-seed/seed-config.json --pyseed

import sys
from datetime import date
Expand Down
Loading
Loading