Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting 3 database3.py classes into 3 files #955

Merged
merged 15 commits into from
Nov 1, 2022

Conversation

john-science
Copy link
Member

Description

The old database3.py file had 3 classes and several functions in it. But a better standard in Python is "1 class = 1 file" for big, meaty classes like this.

Also, I was not sure it was obvious to people what all was in this file.

Since the default GitHub diff for this PR is so large, I tried to keep my commits atomic, so you could see what all was being done more easily. So, I would suggest looking at the commits, and not the diff. Though, to help, here is a brief synopsis of the changes in this PR:

  • db/database3.py:Database3 → no change
  • db/database3.py:DatabaseInterfacedb/databaseInterface.py:DatabaseInterface
  • db/database3.py:Layoutdb/layout.py:Layout
  • bookkeeping/tests/test_databaseInterface.pybookkeeping/db/tests/test_databaseInterface.py

I also updated the major docstrings for db/database3.py, db/init.py, and Layout` to be up-to-date.


Checklist

  • This PR has only one purpose or idea.
  • Tests have been added/updated to verify that the new/changed code works.
  • The release notes (location doc/release/0.X.rst) are up-to-date with any bug fixes or new features.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in setup.py.

@john-science john-science added the architecture Issues related to big picture system architecture label Oct 31, 2022
@keckler
Copy link
Member

keckler commented Oct 31, 2022

Just a note to any users, this changes where you need to import the databaseInterface from, if you import it directly.

@john-science
Copy link
Member Author

john-science commented Oct 31, 2022

Just a note to any users, this changes where you need to import the databaseInterface from, if you import it directly.

Just to be transparent: of course I reviewed every usage of DatabaseInterface in every repository that TerraPower has, and this does not break a single import or repo.

(It appears that since DatabaseInterface is a default Interface added to every ARMI run, no one imports it directly. )

@keckler
Copy link
Member

keckler commented Oct 31, 2022

Yeah, probably most people pull up that interface via getInterface(name="database"), because like you said it is always generated in a run.

I think its a good change. Just highlighting the API change.

Copy link
Member

@opotowsky opotowsky left a comment

Choose a reason for hiding this comment

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

Wow, great work! I found one downstream import of DatabaseInterface, but that doesn't block this in any way.

I didn't look hard at the tests or much of the code since it was just being moved around, but I did follow your commits as suggested so I did see the changes you made.

I think it looks really good.

doc/release/0.2.rst Outdated Show resolved Hide resolved
@john-science john-science linked an issue Oct 31, 2022 that may be closed by this pull request
@john-science
Copy link
Member Author

Thanks for the save @opotowsky !

@john-science john-science merged commit bc3cf47 into terrapower:main Nov 1, 2022
@john-science john-science deleted the db_refactor branch November 1, 2022 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Issues related to big picture system architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database code cleanup/architecture
3 participants