Skip to content

Change module scope - #71

Merged
Jacob-Chmura merged 3 commits into
mainfrom
dev/module_scope
Jul 2, 2025
Merged

Change module scope#71
Jacob-Chmura merged 3 commits into
mainfrom
dev/module_scope

Conversation

@Jacob-Chmura

@Jacob-Chmura Jacob-Chmura commented Jun 27, 2025

Copy link
Copy Markdown
Member

Purpose

The purpose of this PR is to move DGraph and DGBatch into top level scope. This enables imports like:

from tgm import DGraph, DGBatch

which seems better (in the same was DataFrame and tensors are in top level pandas and pytorch scope, for instance).

Key Changes

  • Move DGraph and DGBatch into top level scope
  • Changed all examples to use the new imports
  • Removed pandas import for type check in DGraph (since user may not have it). This was caught by the docker image build smoke test

Things to keep in mind

  • Kept hooks in their own module as they will likely soon be split into separate files
  • Kept DGDataLoader in separate module similar to torch
  • DGData is left as is since its mostly private (users can just construct DGraphs, not worry about internal IO)
  • TimeDeltaDG is on the fence, but I will likely change DGraph constructor to take a string so that user never has to explicitly construct a time delta (Let DGraph constructor take TimeDelta as a string #72):
DGraph('tgbl-wiki', 's') # instead of `DGraph('tgbl-wiki', TimeDeltaDG('s'))

Relevant Prs

Close #68

@Jacob-Chmura Jacob-Chmura self-assigned this Jun 27, 2025
@Jacob-Chmura
Jacob-Chmura marked this pull request as ready for review June 27, 2025 10:48

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

I agree with this change, much more intuitive

@Jacob-Chmura
Jacob-Chmura merged commit 2a37d17 into main Jul 2, 2025
4 checks passed
@Jacob-Chmura
Jacob-Chmura deleted the dev/module_scope branch July 2, 2025 16:08
@codecov

codecov Bot commented Jul 2, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

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.

Bump some objects up to top-level module scope

2 participants