Skip to content

Commit 8e2e949

Browse files
committed
Merge branch 'main' into scenarios/main
# Conflicts: # .github/workflows/deploy-docs.yaml # pyproject.toml
2 parents 5c2900a + 050f6fa commit 8e2e949

15 files changed

Lines changed: 256 additions & 289 deletions

File tree

.github/workflows/deploy-docs.yaml

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +0,0 @@
1-
name: Deploy Stable Documentation
2-
3-
on:
4-
release:
5-
types: [published]
6-
7-
jobs:
8-
check-release:
9-
runs-on: ubuntu-latest
10-
outputs:
11-
is_stable: ${{ steps.check_version.outputs.is_stable }}
12-
version: ${{ steps.check_version.outputs.version }}
13-
steps:
14-
- name: Check if stable release
15-
id: check_version
16-
run: |
17-
# Extract version from the tag
18-
VERSION="${GITHUB_REF#refs/tags/v}"
19-
echo "Raw version: $VERSION"
20-
21-
# Check if version contains any pre-release identifiers using regex
22-
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23-
echo "is_stable=true" >> $GITHUB_OUTPUT
24-
echo "version=$VERSION" >> $GITHUB_OUTPUT
25-
echo "Stable version detected: $VERSION"
26-
else
27-
echo "is_stable=false" >> $GITHUB_OUTPUT
28-
echo "Pre-release version detected: $VERSION"
29-
fi
30-
31-
deploy-docs:
32-
needs: check-release
33-
if: needs.check-release.outputs.is_stable == 'true'
34-
runs-on: ubuntu-latest
35-
steps:
36-
- name: Checkout repository
37-
uses: actions/checkout@v4
38-
with:
39-
fetch-depth: 0 # Fetch all history for proper versioning
40-
41-
- name: Configure Git Credentials
42-
run: |
43-
git config user.name github-actions[bot]
44-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
45-
46-
- name: Set up Python
47-
uses: actions/setup-python@v5
48-
with:
49-
python-version: 3.11
50-
51-
- name: Install documentation dependencies
52-
run: |
53-
python -m pip install --upgrade pip
54-
pip install -e ".[docs]"
55-
56-
- name: Deploy docs
57-
run: |
58-
VERSION="${{ needs.check-release.outputs.version }}"
59-
echo "Deploying documentation for version $VERSION"
60-
mike deploy --push --update-aliases $VERSION latest
61-
62-
- name: Verify deployment
63-
run: |
64-
# Simple verification that the deployment succeeded
65-
git checkout gh-pages
66-
if [ -d "${{ needs.check-release.outputs.version }}" ]; then
67-
echo "Documentation successfully deployed"
68-
else
69-
echo "Documentation deployment failed!"
70-
exit 1
71-
fi

.github/workflows/python-app.yaml

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,49 @@ jobs:
5656
- name: Run tests
5757
run: pytest -v -p no:warnings
5858

59+
create-release:
60+
name: Create Release with Changelog
61+
runs-on: ubuntu-22.04
62+
needs: [test]
63+
if: startsWith(github.ref, 'refs/tags/v')
64+
65+
steps:
66+
- name: Checkout repository
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Set up Python
72+
uses: actions/setup-python@v4
73+
with:
74+
python-version: "3.11"
75+
76+
- name: Sync changelog to docs
77+
run: |
78+
cp CHANGELOG.md docs/changelog.md
79+
echo "✅ Synced changelog to docs"
80+
81+
- name: Extract release notes
82+
run: |
83+
VERSION=${GITHUB_REF#refs/tags/v}
84+
echo "Extracting release notes for version: $VERSION"
85+
python scripts/extract_release_notes.py $VERSION > current_release_notes.md
86+
87+
- name: Create GitHub Release
88+
uses: softprops/action-gh-release@v1
89+
with:
90+
body_path: current_release_notes.md
91+
draft: false
92+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
5996
publish-testpypi:
6097
name: Publish to TestPyPI
6198
runs-on: ubuntu-22.04
62-
needs: [test] # Only run after tests pass
63-
if: github.event_name == 'release' && github.event.action == 'created' # Only on release creation
64-
99+
needs: [test, create-release] # Run after tests and release creation
100+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only on tag push
101+
65102
steps:
66103
- name: Checkout repository
67104
uses: actions/checkout@v4
@@ -86,7 +123,7 @@ jobs:
86123
env:
87124
TWINE_USERNAME: __token__
88125
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
89-
126+
90127
- name: Test install from TestPyPI
91128
run: |
92129
# Create a temporary environment to test installation
@@ -104,8 +141,8 @@ jobs:
104141
publish-pypi:
105142
name: Publish to PyPI
106143
runs-on: ubuntu-22.04
107-
needs: [test] # Only run after TestPyPI publish succeeds
108-
if: github.event_name == 'release' && github.event.action == 'created' # Only on release creation
144+
needs: [publish-testpypi] # Only run after TestPyPI publish succeeds
145+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only on tag push
109146

110147
steps:
111148
- name: Checkout repository
@@ -144,4 +181,38 @@ jobs:
144181
# Install from PyPI
145182
pip install $PACKAGE_NAME
146183
# Basic import test
147-
python -c "import flixopt; print('PyPI installation successful!')"
184+
python -c "import flixopt; print('PyPI installation successful!')"
185+
186+
deploy-docs:
187+
name: Deploy Documentation
188+
runs-on: ubuntu-22.04
189+
needs: [publish-pypi] # Deploy docs after successful PyPI publishing
190+
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
191+
192+
steps:
193+
- name: Checkout repository
194+
uses: actions/checkout@v4
195+
with:
196+
fetch-depth: 0 # Fetch all history for proper versioning
197+
198+
- name: Set up Python
199+
uses: actions/setup-python@v4
200+
with:
201+
python-version: "3.11"
202+
203+
- name: Install documentation dependencies
204+
run: |
205+
python -m pip install --upgrade pip
206+
pip install -e ".[docs]"
207+
208+
- name: Configure Git Credentials
209+
run: |
210+
git config user.name github-actions[bot]
211+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
212+
213+
- name: Deploy docs
214+
run: |
215+
VERSION=${GITHUB_REF#refs/tags/v}
216+
echo "Deploying docs after successful PyPI publish: $VERSION"
217+
mike deploy --push --update-aliases $VERSION latest
218+
mike set-default --push latest

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [2.1.2] - 2025-06-14
11+
12+
### Fixed
13+
- Storage losses per hour where not calculated correctly, as mentioned by @brokenwings01. This might have lead to issues with modeling large losses and long timesteps.
14+
- Old implementation: $c(\text{t}_{i}) \cdot (1-\dot{\text{c}}_\text{rel,loss}(\text{t}_i)) \cdot \Delta \text{t}_{i}$
15+
- Correct implementation: $c(\text{t}_{i}) \cdot (1-\dot{\text{c}}_\text{rel,loss}(\text{t}_i)) ^{\Delta \text{t}_{i}}$
16+
17+
### Known issues
18+
- Just to mention: Plotly >= 6 may raise errors if "nbformat" is not installed. We pinned plotly to <6, but this may be fixed in the future.
19+
20+
## [2.1.1] - 2025-05-08
21+
22+
### Fixed
23+
- Fixed bug in the `_ElementResults.constraints` not returning the constraints but rather the variables
24+
25+
### Changed
26+
- Improved docstring and tests
27+
28+
## [2.1.0] - 2025-04-11
29+
30+
### Added
31+
- Python 3.13 support added
32+
- Logger warning if relative_minimum is used without on_off_parameters in Flow
33+
- Greatly improved internal testing infrastructure by leveraging linopy's testing framework
34+
35+
### Fixed
36+
- Fixed the lower bound of `flow_rate` when using optional investments without OnOffParameters
37+
- Fixed bug that prevented divest effects from working
38+
- Added lower bounds of 0 to two unbounded vars (numerical improvement)
39+
40+
### Changed
41+
- **BREAKING**: Restructured the modeling of the On/Off state of Flows or Components
42+
- Variable renaming: `...|consecutive_on_hours``...|ConsecutiveOn|hours`
43+
- Variable renaming: `...|consecutive_off_hours``...|ConsecutiveOff|hours`
44+
- Constraint renaming: `...|consecutive_on_hours_con1``...|ConsecutiveOn|con1`
45+
- Similar pattern for all consecutive on/off constraints
46+
47+
## [2.0.1] - 2025-04-10
48+
49+
### Added
50+
- Logger warning if relative_minimum is used without on_off_parameters in Flow
51+
52+
### Fixed
53+
- Replace "|" with "__" in filenames when saving figures (Windows compatibility)
54+
- Fixed bug that prevented the load factor from working without InvestmentParameters
55+
56+
## [2.0.0] - 2025-03-29
57+
58+
### Changed
59+
- **BREAKING**: Complete migration from Pyomo to Linopy optimization framework
60+
- **BREAKING**: Redesigned data handling to rely on xarray.Dataset throughout the package
61+
- **BREAKING**: Framework renamed from flixOpt to flixopt (`import flixopt as fx`)
62+
- **BREAKING**: Results handling completely redesigned with new `CalculationResults` class
63+
64+
### Added
65+
- Full model serialization support - save and restore unsolved Models
66+
- Enhanced model documentation with YAML export containing human-readable mathematical formulations
67+
- Extend flixopt models with native linopy language support
68+
- Full Model Export/Import capabilities via linopy.Model
69+
- Unified solution exploration through `Calculation.results` attribute
70+
- Compression support for result files
71+
- `to_netcdf/from_netcdf` methods for FlowSystem and core components
72+
- xarray integration for TimeSeries with improved datatypes support
73+
- Google Style Docstrings throughout the codebase
74+
75+
### Fixed
76+
- Improved infeasible model detection and reporting
77+
- Enhanced time series management and serialization
78+
- Reduced file size through improved compression
79+
80+
### Removed
81+
- **BREAKING**: Pyomo dependency (replaced by linopy)
82+
- Period concepts in time management (simplified to timesteps)

docs/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
- [Examples](examples/)
55
- [FAQ](faq/)
66
- [API-Reference](api-reference/)
7-
- [Release Notes](release-notes/)
7+
- [Release Notes](changelog.md)

docs/release-notes/_template.txt

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/release-notes/index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)