Skip to content

Commit 1ed381f

Browse files
Merge pull request #309 from TemoaProject/unstable
setting up ci bots, fixing pytest warnings, improving docs
2 parents ded760f + d668133 commit 1ed381f

40 files changed

Lines changed: 349 additions & 219 deletions

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Please provide details about your environment. This helps us reproduce the issue
7575
* **Operating System:**
7676
* **Python Version:**
7777
* **Project Version:**
78-
* **Relevant Dependencies:**
78+
* **Relevant Dependencies:**
7979

8080
## Checklist
8181

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ jobs:
5959
- name: Run tests
6060
env:
6161
CI: 1
62-
run: uv run pytest tests
62+
run: uv run pytest tests --cov --cov-branch --cov-report=xml
6363

64+
- name: Upload coverage reports to Codecov
65+
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.3.1
66+
with:
67+
token: ${{ secrets.CODECOV_TOKEN }}
6468
type-check:
6569
name: type check
6670
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ repos:
99
files: ^pyproject\.toml$
1010

1111
# Compile requirements
12-
- id: pip-compile
13-
name: pip-compile requirements.txt (core dependencies)
12+
- id: uv-export
13+
name: uv export requirements.txt (core dependencies)
1414
args:
15-
- pyproject.toml # Input file
16-
- -o # Output flag
17-
- requirements.txt # Output file name
18-
files: ^pyproject\.toml$
15+
- --no-dev
16+
- -o
17+
- requirements.txt
18+
files: ^(pyproject\.toml|uv\.lock)$
1919

20-
- id: pip-compile
21-
name: pip-compile requirements-dev.txt (core + all optional dependencies)
20+
- id: uv-export
21+
name: uv export requirements-dev.txt (core + all optional dependencies)
2222
args:
23-
- pyproject.toml
24-
- --all-extras # Include all optional dependency groups
23+
- --all-extras
24+
- --dev
2525
- -o
26-
- requirements-dev.txt # Output file name
27-
files: ^pyproject\.toml$
26+
- requirements-dev.txt
27+
files: ^(pyproject\.toml|uv\.lock)$
2828

2929
# Code quality and formatting
3030
- repo: https://github.com/pre-commit/pre-commit-hooks

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![PyPI](https://img.shields.io/pypi/v/temoa?label=pypi%20package)](https://pypi.org/project/temoa/)
44
[![CI](https://github.com/TemoaProject/temoa/actions/workflows/ci.yml/badge.svg?branch=unstable)](https://github.com/TemoaProject/temoa/actions/workflows/ci.yml)
5+
[![codecov](https://codecov.io/gh/TemoaProject/temoa/graph/badge.svg?token=ZAXU1VM8YN)](https://codecov.io/gh/TemoaProject/temoa)
6+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/TemoaProject/temoa/main.svg)](https://results.pre-commit.ci/latest/github/TemoaProject/temoa/main)
57
[![Documentation Status](https://readthedocs.org/projects/temoa/badge/?version=latest)](https://temoa.readthedocs.io/en/latest/?badge=latest)
68
[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue)](https://pyreadiness.org/3.12/)
79
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

docs/source/References.bib

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ @article{Hunter_etal_2013
3939
pages = "339--349",
4040
year = "2013"
4141
}
42-

docs/source/database.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,81 @@ recommend that you populate input tables in the following order:
106106
* limit_tech_output_split
107107

108108

109+
---------------------------------------
110+
Group Region and Technology Constraints
111+
---------------------------------------
112+
113+
Some constraint tables support summation over groups of regions or technologies. Note that each row in these tables will still only create one constraint, but that constraint will be a summation over the defined group. For example, the ``limit_capacity`` table will limit the total summed capacity of all technologies in the technology group (if used) and over all the regions in the region group (if used). Consider behaviour carefully. For example, the ``limit_annual_capacity_factor`` table will constrain the total summed capacity factor of the group, which would allow for varying capacity factors of processes within that group as long as the limit is met in aggregate.
114+
115+
**Group Regions:**
116+
117+
For the supported tables, the ``region`` column can be populated with either a single region (e.g., ``"east"``), a subset of regions delineated with a ``+`` (e.g., ``"east+west"``), or ``"global"`` to indicate summation over all model regions.
118+
119+
.. important::
120+
When grouped or global region constraints are used with exchange technologies,
121+
exchange flows are only counted if the relevant exchange-technology keys are
122+
explicitly included in the region string used by the constraint row.
123+
Exchange-technology keys are directional and use a hyphen to separate the
124+
two regions (e.g., ``east-west`` and ``west-east`` are distinct keys).
125+
126+
For example, to constrain activity across the ``east`` and ``west`` regions
127+
including all exchange flows between them, the region string should be:
128+
129+
.. code-block:: none
130+
131+
east+east-west+west-east+west
132+
133+
If exchange keys are omitted (e.g., using only ``east+west``), flows through
134+
exchange technologies between those regions will *not* be included in the
135+
constrained summation.
136+
137+
Supported tables:
138+
139+
* limit_annual_capacity_factor
140+
* limit_seasonal_capacity_factor
141+
* limit_resource
142+
* limit_activity
143+
* limit_capacity
144+
* limit_new_capacity
145+
* limit_activity_share
146+
* limit_capacity_share
147+
* limit_new_capacity_share
148+
* limit_emission
149+
* limit_growth_capacity
150+
* limit_growth_new_capacity
151+
* limit_growth_new_capacity_delta
152+
* limit_degrowth_capacity
153+
* limit_degrowth_new_capacity
154+
* limit_degrowth_new_capacity_delta
155+
156+
**Technology Groups:**
157+
158+
For the supported tables, the following columns accept either technologies or technology groups, over which the constraint is summed. Technology groups are defined in the ``tech_group`` and ``tech_group_member`` tables.
159+
160+
* tech
161+
* tech_or_group
162+
* sub_group
163+
* super_group
164+
165+
Supported tables:
166+
167+
* limit_annual_capacity_factor
168+
* limit_seasonal_capacity_factor
169+
* limit_resource
170+
* limit_activity
171+
* limit_capacity
172+
* limit_new_capacity
173+
* limit_activity_share
174+
* limit_capacity_share
175+
* limit_new_capacity_share
176+
* limit_growth_capacity
177+
* limit_growth_new_capacity
178+
* limit_growth_new_capacity_delta
179+
* limit_degrowth_capacity
180+
* limit_degrowth_new_capacity
181+
* limit_degrowth_new_capacity_delta
182+
183+
109184
For help getting started, consider using the ``temoa tutorial``
110185
command to generate a template project or inspect the example SQL file at
111186
``temoa/tutorial_assets/utopia.sql``. To begin building your own database file, use

docs/source/default/layout.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@
1313
{%- endblock %}
1414

1515
{% set script_files = script_files + ['_static/google_analytics.js'] %}
16-

docs/source/default/static/google_analytics.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ _gaq.push(['_trackPageview']);
77
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
88
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
99
})();
10-

docs/source/default/static/my_theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ max-width: 1200px !important;
1414
display: inline-block;
1515
visibility: visible;
1616
margin-right: -0.7em;
17-
}
17+
}

docs/source/images/TemoaLogo.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)