-
Notifications
You must be signed in to change notification settings - Fork 12
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
Unify constructors to always allow a .stan file to be passed #188
Conversation
Caused by loading non-THREADS model in same instance as THREADS=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great. Just a general questions about putting deprecation warnings in doc strings, to compliment error messages.
model_lib: str, | ||
model_data: Optional[str] = None, | ||
model_lib: Union[str, PathLike], | ||
data: Union[str, PathLike, None] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is None
better here than ""
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None ends up being passed as nullptr
to C++, which then creates an empty_var_context
:
If you pass ""
instead, this string is then treated as an empty JSON, which creates a json parser/var_context and populates it with nothing.
So they're semantically equivalent, but trigger different code paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Closes #187.
Changes:
StanModel.from_stan_file
is deprecated. The logic is subsumed in the constructor, which will trigger compilation if the file provided ends in.stan
model_data
argument is renamed todata
. The previous argument still works but issues a warning.os.PathLike
interfaceStanModel(;stan_file,...)
overload is deprecated. This logic is now subsumed in the constructor, which will trigger compilation if the file provided ends in.stan