Skip to content

Move configuration use in main over to new configuration#1122

Merged
davidorme merged 43 commits intodevelopfrom
1118-move-configuration-use-in-main-over-to-new-configuration
Nov 4, 2025
Merged

Move configuration use in main over to new configuration#1122
davidorme merged 43 commits intodevelopfrom
1118-move-configuration-use-in-main-over-to-new-configuration

Conversation

@davidorme
Copy link
Copy Markdown
Collaborator

@davidorme davidorme commented Oct 27, 2025

Description

This PR removes the last remaining uses of the old configuration system and strips out all remaining calls to old Config objects in the model code and tests.

The PR does not

A lot of files are affected. The broad changes are:

  • Tests of input validity when using model.from_config - because the new system pre-validates, these checks are redundant and can be removed.
  • Removal of the now superseded from_config(..., config, ...) argument from the BaseModel and then everywhere else. This was needed in parallel during the switch over but Move animals over to the new configuration system #1116, Move hydrology over to the new configuration system #1114, Move both abiotic models over to the new configuration system #1115 and Snagging the config system switch over in science models #1124 have replaced all cases where this input was used.
  • Removing any imports from the modules that will be removed.
  • Skipping the testing of the old system - this uses autouse fixtures to skip the whole test module. I've retained them rather than deleting them to allow me to cannibalise them in the next PR to strip the code.
  • Removing expected schema and constant loading logger entries from tests, since these are no longer emitted.
  • A few cases of un-typing variables in animal tests - some checking was moaning about partially typed functions. We don't type the tests, so I've simply retained the types as comments.
  • Removal of fixtures providing old-style configs.
  • A couple of missed cases where old configs were still being used in tests.
  • Crippled the old style config_merge in core/config.py - it was looking for schema that no longer exist. The same is true for load_constants - it was looking for the now removed constants classes from the registry. Both function have had the problematic code commented out.
  • Added an info class attribute onto the CompiledConfiguration class that gets populated with a list of the models and BaseModel subclasses used in it. This was present in the old Config and is used in main for getting run order and other things.
  • Updated the core load_data_config to use the new configuration and also simplified the signatures of functions in core/data.py that were passing in whole config dicts but only needed a single path out of them.
  • Stripped schema and old style constants dataclasses from the Model registry.

That's about it 😬

Fixes #1118

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@davidorme davidorme linked an issue Oct 27, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 90.16393% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.76%. Comparing base (54d5001) to head (ec374c9).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
virtual_ecosystem/core/data.py 88.88% 3 Missing ⚠️
virtual_ecosystem/core/constants_loader.py 0.00% 1 Missing ⚠️
virtual_ecosystem/entry_points.py 66.66% 1 Missing ⚠️
virtual_ecosystem/main.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1122      +/-   ##
===========================================
- Coverage    94.69%   87.76%   -6.93%     
===========================================
  Files           90       90              
  Lines         7872     7803      -69     
===========================================
- Hits          7454     6848     -606     
- Misses         418      955     +537     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…m' into 1118-move-configuration-use-in-main-over-to-new-configuration
…system' into 1118-move-configuration-use-in-main-over-to-new-configuration
… into 1118-move-configuration-use-in-main-over-to-new-configuration
… into 1118-move-configuration-use-in-main-over-to-new-configuration
… into 1118-move-configuration-use-in-main-over-to-new-configuration
…move-configuration-use-in-main-over-to-new-configuration
…move-configuration-use-in-main-over-to-new-configuration
…move-configuration-use-in-main-over-to-new-configuration
@davidorme davidorme marked this pull request as ready for review November 3, 2025 02:45
@davidorme davidorme requested a review from sallymatson November 3, 2025 09:29
@davidorme
Copy link
Copy Markdown
Collaborator Author

@sallymatson Finally got docs fixed. Could you have a look? It's very sprawling so please add as many "What the hell is happening here" questions as you need! Or we can chat IRL 😄

@davidorme davidorme merged commit 41e7951 into develop Nov 4, 2025
33 of 35 checks passed
@davidorme davidorme deleted the 1118-move-configuration-use-in-main-over-to-new-configuration branch November 4, 2025 02:35
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.

Move configuration use in main over to new configuration

3 participants