Skip to content

Fix missing packages and unneeded imports at runtime - #129

Merged
pont-us merged 10 commits into
mainfrom
pont-us/128-dependencies
Dec 1, 2026
Merged

pont-us merged 10 commits into
mainfrom
pont-us/128-dependencies

Conversation

@pont-us

@pont-us pont-us commented Nov 24, 2026

Copy link
Copy Markdown
Member

Closes Issue #128.

See Issue #128.

xarray and pandas are of course still required for any associated
functionality (e.g. exporting Datasets and Dataframes, respectively),
but util.py will no longer crash on import if they are absent.
@pont-us
pont-us marked this pull request as draft November 24, 2026 15:04
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.45%. Comparing base (bdf0662) to head (4ff246d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
+ Coverage   98.41%   98.45%   +0.03%     
==========================================
  Files           6        6              
  Lines         759      776      +17     
  Branches       95       99       +4     
==========================================
+ Hits          747      764      +17     
  Misses          8        8              
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 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.

Both pandas.DataFrame and pandas.core.frame.DataFrame are
now supported.
xarray is now imported locally as and when needed.
See Issue #128.
See Issue #128. If a generated EOAP produces xarray Datasets,
xcengine must ensure that the zarr and netcdf4 packages are in
the environment so that they can be exported.
- Add test coverage for new zarr and netcdf4 package inclusion.

- Improve said package inclusion by detecting more variants of
  xarray dependencies and ignoring non-string dependency specs.
@pont-us
pont-us marked this pull request as ready for review November 27, 2026 11:38
@pont-us
pont-us requested a review from Hneuschmidt November 27, 2026 15:04

@Hneuschmidt Hneuschmidt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Besides the yaml/pyyaml question, LGTM.

Comment thread xcengine/core.py Outdated
)

LOGGER.info("Adding any additional required packages to environment.")
extra_packages = ["yaml"] # always needed for parameter data files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the package we are looking for here is pyyaml, which gets imported with

import yaml

There is a package yaml on conda-forge, but its just a C library, with no Python interface (I believe).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you, you're quite correct. Fixed in commit c85acbe.

Comment thread test/test_core.py Resolved
Comment thread xcengine/util.py Resolved
Bug found in review in PR #129. Built packages were getting the
yaml conda package (which provides the LibYAML C library) rather
than the intended pyyaml package (which provides the Python yaml
import package). Fixed in this commit.
@pont-us
pont-us merged commit 95fa137 into main Dec 1, 2026
8 checks passed
@pont-us
pont-us deleted the pont-us/128-dependencies branch December 1, 2026 17:47
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