Skip to content

Dependency cleanup: remove pandas, torchvision, and onnx as core dependencies - #2002

Open
coreyjadams wants to merge 4 commits into
NVIDIA:mainfrom
coreyjadams:refactor/drop-unused-core-deps
Open

coreyjadams wants to merge 4 commits into
NVIDIA:mainfrom
coreyjadams:refactor/drop-unused-core-deps

Conversation

@coreyjadams

Copy link
Copy Markdown
Collaborator

PhysicsNeMo Pull Request

Onnx and Torchvision are never actually imported anywhere in the repository. They are removed "for free". Onnx is brought back in the dev list for some tests.

pandas is trickier, we used it in utils for this insolation file. I move that calculation to numpy since it is 100% equivalent to datatime work.

Description

Checklist

Dependencies

Review Process

All PRs are reviewed by the PhysicsNeMo team before merging.

Depending on which files are changed, GitHub may automatically assign a maintainer for review.

We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.

AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.

@copy-pr-bot

copy-pr-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS review map

Current for commit da1e3ad40ce1. An approval covers every file listed for that owner; one owner is sufficient for shared files.

@CharlelieLrt — 1 file(s)
  • physicsnemo/core/version_check.py
@coreyjadams — 2 file(s)
  • physicsnemo/core/version_check.py
  • pyproject.toml
@ktangsali — 2 file(s)
  • physicsnemo/core/version_check.py
  • pyproject.toml
@mnabian — 1 file(s)
  • physicsnemo/datapipes/gnn/drivaernet_dataset.py
@pzharrington — 12 file(s)
  • physicsnemo/datapipes/healpix/coupledtimeseries_dataset.py
  • physicsnemo/datapipes/healpix/couplers.py
  • physicsnemo/datapipes/healpix/timeseries_dataset.py
  • physicsnemo/experimental/datapipes/healda/configs/sensors.py
  • physicsnemo/experimental/datapipes/healda/dataset.py
  • physicsnemo/experimental/datapipes/healda/loaders/era5.py
  • physicsnemo/experimental/datapipes/healda/loaders/ufs_obs.py
  • physicsnemo/experimental/datapipes/healda/loaders/zarr_loader.py
  • physicsnemo/experimental/datapipes/healda/protocols.py
  • physicsnemo/experimental/datapipes/healda/time_utils.py
  • physicsnemo/models/dlwp_healpix/HEALPixRecUNet.py
  • physicsnemo/utils/insolation.py

No CODEOWNER

  • CHANGELOG.md
  • uv.lock

Comment /codeowners-info to refresh.

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Retrigger

Fix the pandas-dependent test collection failure before merging.

Findings

  1. P1 Minimal-install test collection breaks
  2. P2 Coarse-resolution datetime inputs fail

Summary

Removes onnx, torchvision, and pandas from the direct core requirements, moves pandas into feature extras, and converts remaining pandas imports to lazy optional imports.

  • Replaces pandas-based year-start calculations in insolation with NumPy arithmetic.
  • Uses string coupler defaults while preserving constructor-time Timedelta normalization.
  • Updates installation hints, the changelog, and lockfile metadata.
  • Needs a minimal-install test-collection fix and preservation of coarse-resolution datetime inputs.

Reviews (1) · Last reviewed commit: "Remove pandas from utils entirely, pushi..."

Comment thread pyproject.toml
"vtk",
]
datapipes-extras = [
"pandas>=2.2.0",

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.

P1 Minimal-install test collection breaks

The minimal-install CI jobs install core plus dev, without model-extras or datapipes-extras, then run all of test/. Moving pandas into these extras leaves that environment without pandas, but test/datapipes/healda/test_time_utils.py:21 still imports it unconditionally. Collection therefore fails with ModuleNotFoundError before the tests can run or skip. Change that import to pytest.importorskip("pandas"), or explicitly include pandas in the test dependencies.

Comment thread physicsnemo/utils/insolation.py Outdated
)
# Get the day of year as a float: elapsed days since Jan 1 of each date's year.
dates_arr = np.array(dates, dtype="datetime64")
days_arr = (dates_arr - dates_arr.astype("datetime64[Y]")) / np.timedelta64(1, "D")

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.

P2 Coarse-resolution datetime inputs fail

For an input such as np.array(["2024-02"], dtype="datetime64[M]"), this subtraction produces timedelta64[M]. Dividing it by timedelta64[D] raises TypeError because NumPy cannot convert variable-length months to days. Previously, the pandas-created January 1 timestamps promoted the subtraction to a fixed-duration unit, so this input worked. Cast the year-start array to datetime64[D] before subtraction, and add regression tests for monthly/yearly inputs alongside sub-day and leap-year dates.

Suggested change
days_arr = (dates_arr - dates_arr.astype("datetime64[Y]")) / np.timedelta64(1, "D")
start_years = dates_arr.astype("datetime64[Y]").astype("datetime64[D]")
days_arr = (dates_arr - start_years) / np.timedelta64(1, "D")

@CharlelieLrt CharlelieLrt 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.

LGTM

Comment thread physicsnemo/utils/insolation.py Outdated
days_arr = (np.array(dates, dtype="datetime64") - start_years) / np.timedelta64(
1, "D"
)
# Get the day of year as a float: elapsed days since Jan 1 of each date's year.

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.

This implementation is not exactly equivalent. Make sure it does not break downstream tasks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added more complexity but Claude thinks it checks out....

@mnabian mnabian 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.

LGTM

@ktangsali ktangsali 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.

LGTM. Good to check about the downstream applications with the changes to insolation (Mohammad's comment)

Comment thread pyproject.toml
"treelib>=1.2.5",
"numpy>=1.22.4",
"torch>=2.10.0",
"torchvision>=0.25.0a0",

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.

Goodbye! You will not be missed 😅

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.

Insolation was fully untested before?? Sheesh

def test_pandas_timestamps_match_datetime():
"""pandas Timestamps and a tz-aware DatetimeIndex behave like datetime objects."""
pd = pytest.importorskip("pandas")
ts = [pd.Timestamp("2020-12-31 21:00", tz="US/Eastern")]

@pzharrington pzharrington Sep 18, 2026

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.

Out of pure superstition I think we should test a few more trial dates/timezones (or lack thereof) 😅

@pzharrington pzharrington 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.

LGTM as long as the insolation results are identical (already-released models are trained using that quantity)

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.

5 participants