Add type definitions for HSSM package and refactor imports#680
Merged
cpaniaguam merged 1 commit intomainfrom Mar 4, 2025
Merged
Add type definitions for HSSM package and refactor imports#680cpaniaguam merged 1 commit intomainfrom
cpaniaguam merged 1 commit intomainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
digicosmos86
approved these changes
Mar 4, 2025
Collaborator
digicosmos86
left a comment
There was a problem hiding this comment.
Looks good to me! Let's just use types.py as the name of this file. I see no reason to keep types "private"
| @@ -0,0 +1,54 @@ | |||
| """Type definitions for the HSSM package.""" | |||
Collaborator
There was a problem hiding this comment.
This is a great move. Since type info is accessible by type checkers and IDEs, we can simply use types.py as a convention
Collaborator
Author
There was a problem hiding this comment.
The name types is used by Python, hence the choice.
$ python
>>> import types
>>> print(types.__doc__)
Define names for built-in types that aren't directly accessible as a builtin.
>>> Can you suggest alternative names?
Collaborator
There was a problem hiding this comment.
I see. My bad. I am happy with it as-is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request includes changes to improve the organization and readability of type definitions in the HSSM package by moving them to a separate
_types.pyfile. The most important changes include defining new types and updating import statements across multiple files.Type definitions:
src/hssm/_types.py: Added type definitions forLogLik,ParamSpec,SupportedModels,LoglikKind,LoglikConfig,LoglikConfigs,DefaultConfig, andDefaultConfigs.Import updates:
src/hssm/config.py: Updated import statements to use the new_types.pyfile.src/hssm/defaults.py: Updated import statements to use the new_types.pyfile and removed the old type definitions. [1] [2] [3]src/hssm/hssm.py: Updated import statements to use the new_types.pyfile.src/hssm/register.py: Updated import statements to use the new_types.pyfile.