Skip to content

Add type definitions for HSSM package and refactor imports#680

Merged
cpaniaguam merged 1 commit intomainfrom
create-types-module
Mar 4, 2025
Merged

Add type definitions for HSSM package and refactor imports#680
cpaniaguam merged 1 commit intomainfrom
create-types-module

Conversation

@cpaniaguam
Copy link
Copy Markdown
Collaborator

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.py file. The most important changes include defining new types and updating import statements across multiple files.

Type definitions:

  • src/hssm/_types.py: Added type definitions for LogLik, ParamSpec, SupportedModels, LoglikKind, LoglikConfig, LoglikConfigs, DefaultConfig, and DefaultConfigs.

Import updates:

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/hssm/_types.py 100.00% <100.00%> (ø)
src/hssm/config.py 87.50% <100.00%> (+0.13%) ⬆️
src/hssm/defaults.py 49.46% <100.00%> (-7.42%) ⬇️
src/hssm/hssm.py 77.88% <100.00%> (+0.03%) ⬆️
src/hssm/register.py 94.11% <100.00%> (ø)

@cpaniaguam cpaniaguam marked this pull request as ready for review March 4, 2025 12:31
@cpaniaguam cpaniaguam self-assigned this Mar 4, 2025
@cpaniaguam cpaniaguam added the enhancement New feature or request label Mar 4, 2025
Copy link
Copy Markdown
Collaborator

@digicosmos86 digicosmos86 left a comment

Choose a reason for hiding this comment

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

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."""
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 is a great move. Since type info is accessible by type checkers and IDEs, we can simply use types.py as a convention

Copy link
Copy Markdown
Collaborator Author

@cpaniaguam cpaniaguam Mar 4, 2025

Choose a reason for hiding this comment

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

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?

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 see. My bad. I am happy with it as-is

@cpaniaguam cpaniaguam merged commit 620e908 into main Mar 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants