Skip to content

Drop the timely-beliefs forecast extra (sktime) from the dependencies - #2440

Open
Flix6x wants to merge 8 commits into
mainfrom
chore/drop-timely-beliefs-forecast-extra
Open

Drop the timely-beliefs forecast extra (sktime) from the dependencies#2440
Flix6x wants to merge 8 commits into
mainfrom
chore/drop-timely-beliefs-forecast-extra

Conversation

@Flix6x

@Flix6x Flix6x commented Aug 25, 2026

Copy link
Copy Markdown
Member

Description

Depends on plain timely-beliefs instead of timely-beliefs[forecast], which removes sktime and scikit-base from the image (~28 MB).

Stacked on #2439 — branched off its head. It shares the same changelog entry as #2438 and #2439 rather than adding one, since all three shrink the image.

Why this is safe

The forecast extra exists for timely-beliefs' own belief-formation model, which accepts an sktime forecaster. FlexMeasures never calls it — our forecasting is the darts/lightgbm TrainPredictPipeline. There is no reference to sktime, form_beliefs, BaseForecaster or NaiveForecaster anywhere in flexmeasures/ or tests/.

On the pinned version (3.5.5), timely-beliefs imports sktime only under if TYPE_CHECKING: and inside that one function, so it is never imported at runtime unless you call that API. Plain timely-beliefs therefore behaves identically for us.

About the lock file

The lock edit is hand-applied: it removes the two package blocks, the forecast extra edge from our dependency, and the now-unselected forecast block on timely-beliefs.

Running uv lock produces the same resolution but rewrites ~5,200 lines of environment-marker serialization with zero version changes — unreviewable noise for a two-package removal. The hand-applied version is 40 lines, and uv lock --check passes on it, resolving the same 251 packages. (Same approach as #2407.)

$ uv lock
Resolved 251 packages
Removed scikit-base v1.0.2
Removed sktime v1.1.0
$ # versions changed: none

How to test

uv lock --check
uv sync --frozen
pytest flexmeasures/data/tests/test_forecasting_pipeline.py flexmeasures/data/tests/test_forecasting_jobs.py \
       flexmeasures/api/v3_0/tests/test_forecasting_api.py flexmeasures/cli/tests/test_data_add.py

Verified by blocking sktime at the import hook and running FlexMeasures against it: 72 forecasting tests pass with the package entirely unimportable, and flexmeasures, timely_beliefs and TrainPredictPipeline all import cleanly.

Related Items

Stacked on #2439, which is stacked on #2438. Part of #2437.


Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or another incompatible license.

🤖 Generated with Claude Code

TeaDrinkingProgrammer and others added 7 commits August 25, 2026 09:51
…tray docs/examples

Signed-off-by: Stijn van Houwelingen <teadrinkingprogrammer@proton.me>
Context:
- Review on #2438: the entry still carried the XXXX placeholder, in the label and the URL

Change:
- Pointed both at PR #2438

Signed-off-by: F.N. Claessen <felix@seita.nl>
Context:
- Most wheels ship their compiled extensions unstripped. The symbol tables and debug
  info they carry are never used at runtime, and openturns alone accounts for over a
  fifth of the weight

Change:
- Strip the shared objects in the builder stage, so only the stripped virtual
  environment is copied into the runtime image and no layer keeps the fat copy
- --strip-unneeded retains everything dynamic linking needs, so the extensions
  stay loadable

Signed-off-by: F.N. Claessen <felix@seita.nl>
Context:
- Both PRs shrink the image through the builder stage, so one entry reads better
  than two

Change:
- Expanded the entry #2438 introduced to mention the symbol stripping, and
  appended PR #2439 to its reference list

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>

# Conflicts:
#	Dockerfile
#	documentation/changelog.rst
Context:
- The forecast extra exists for timely-beliefs' own belief-formation model, which
  takes an sktime forecaster. FlexMeasures never calls it: its forecasting is the
  darts/lightgbm TrainPredictPipeline, and nothing imports sktime
- timely-beliefs imports sktime only under TYPE_CHECKING and inside that one
  function, so plain timely-beliefs behaves identically for us

Change:
- Dropped the [forecast] extra from the dependency, which removes sktime and
  scikit-base (~28 MB in the image)
- Hand-applied the lock edit rather than committing a full uv lock regeneration:
  the latter rewrites ~5200 lines of environment-marker serialization while
  changing no resolved version. uv lock --check passes, resolving 251 packages

Signed-off-by: F.N. Claessen <felix@seita.nl>
Context:
- All three image-shrinking PRs share one changelog entry

Change:
- Mentioned the dropped timely-beliefs forecast extra and appended PR #2440

Signed-off-by: F.N. Claessen <felix@seita.nl>
@read-the-docs-community

read-the-docs-community Bot commented Aug 25, 2026

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #34238211 | 📁 Comparing a9a709c against latest (eca2f4c)

  🔍 Preview build  

2 files changed
± changelog.html
± api/v3_0.html

@Flix6x
Flix6x changed the base branch from main to fix/docker-strip-symbols August 25, 2026 21:06
Base automatically changed from fix/docker-strip-symbols to main August 26, 2026 09:02
Signed-off-by: F.N. Claessen <felix@seita.nl>

# Conflicts:
#	Dockerfile
#	documentation/changelog.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants