Skip to content

Change from pandas to polars in GeneralInput - #965

Merged
SAKavli merged 4 commits into
equinor:mainfrom
SAKavli:change-from-pandas-to-polars
Sep 1, 2026
Merged

Change from pandas to polars in GeneralInput#965
SAKavli merged 4 commits into
equinor:mainfrom
SAKavli:change-from-pandas-to-polars

Conversation

@SAKavli

@SAKavli SAKavli commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

As polars have stricter typing of columns, the behavior is now changed to reading the excel file into all strings in the dataframe.
This new assumption eases some of the logic in GeneralInput, while we leave the casting to the correct datatypes to Pydantic.

At the same time, _read_general_input is moved into the GeneralInput class as a static method, as it is only used there.

@SAKavli SAKavli self-assigned this Aug 28, 2026
@SAKavli SAKavli added this to SCOUT Aug 28, 2026
@SAKavli SAKavli moved this to In Progress in SCOUT Aug 28, 2026
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch 9 times, most recently from 2c73761 to 1bae6a3 Compare August 31, 2026 10:50
@SAKavli SAKavli moved this from In Progress to Ready for Review in SCOUT Aug 31, 2026
Comment thread src/semeio/fmudesign/general_input.py
Comment thread src/semeio/fmudesign/general_input.py
Comment thread src/semeio/fmudesign/general_input.py Outdated
Comment thread tests/fmudesign/test_general_input.py Outdated
Comment thread src/semeio/fmudesign/general_input.py
Comment thread tests/fmudesign/test_general_input.py Outdated
Comment thread tests/fmudesign/test_general_input.py
@larsevj larsevj moved this from Ready for Review to Reviewed in SCOUT Aug 31, 2026
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch 4 times, most recently from 5444b9b to 6ee992c Compare August 31, 2026 13:29
Comment thread src/semeio/fmudesign/_excel_to_dict.py Outdated
@SAKavli SAKavli moved this from Reviewed to Ready for Review in SCOUT Aug 31, 2026
@SAKavli
SAKavli requested a review from larsevj August 31, 2026 13:40
Comment thread pyproject.toml Outdated
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch 3 times, most recently from f92d4e0 to 1b53191 Compare September 1, 2026 07:08
@SAKavli SAKavli moved this from Ready for Review to In Progress in SCOUT Sep 1, 2026
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from 1b53191 to bcf8f39 Compare September 1, 2026 07:24
Comment thread src/semeio/fmudesign/general_input.py
@SAKavli SAKavli moved this from In Progress to Ready for Review in SCOUT Sep 1, 2026
Comment thread pyproject.toml Outdated
Comment thread src/semeio/fmudesign/general_input.py Outdated
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from bcf8f39 to ab8563a Compare September 1, 2026 07:54
Comment thread pyproject.toml Outdated
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from f969fdd to b95ee8e Compare September 1, 2026 10:13
@SAKavli

SAKavli commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

One unhandled edge case is given empty general_input sheet, but this raises a nasty traceback on main as well.

@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from e2c7bb6 to aa0faae Compare September 1, 2026 11:41
These tests are documenting the behavior of the pandas functionality
applied to the excel input.
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from aa0faae to 8ac0848 Compare September 1, 2026 11:41
This is only used to read input values for GeneralInput and
therefore it makes sense to move it closer to that part of
the code.
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from 8ac0848 to 9acf9e9 Compare September 1, 2026 11:42
@larsevj
larsevj requested a balanced review from Copilot September 1, 2026 11:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Migrates FMU Design’s general_input Excel parsing from pandas to Polars and delegates type conversion to Pydantic.

Changes:

  • Adds Polars/Fastexcel dependencies.
  • Moves Excel parsing into GeneralInput.
  • Updates and expands parser tests.
File summaries
File Description
src/semeio/fmudesign/general_input.py Implements Polars parsing and validation flow.
src/semeio/fmudesign/_excel_to_dict.py Delegates parsing to GeneralInput.
tests/fmudesign/test_general_input.py Tests string-based Excel ingestion.
tests/fmudesign/test_excel_to_dict.py Reformats helper imports.
pyproject.toml Adds runtime and test dependencies.
uv.lock Locks the added dependencies.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/semeio/fmudesign/general_input.py Outdated
@SAKavli
SAKavli force-pushed the change-from-pandas-to-polars branch from c4711d9 to 479755e Compare September 1, 2026 12:22

@larsevj larsevj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 🚀

@github-project-automation github-project-automation Bot moved this from Ready for Review to Reviewed in SCOUT Sep 1, 2026
@SAKavli
SAKavli merged commit 1f22bbd into equinor:main Sep 1, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in SCOUT Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants