-
Notifications
You must be signed in to change notification settings - Fork 175
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
Deprecate sim.model.params
in favour of sim.data
#1173
Conversation
LGTM. Let me know when you've made a changelog entry. |
This LGTM too 👍 Will merge once the changelog is pushed! |
Doing that now :) |
done :) |
@@ -21,6 +21,15 @@ Release History | |||
2.2.1 (unreleased) | |||
================== | |||
|
|||
**API changes** |
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.
In >2.2.0 we're switching the changelog format to be Added/Removed/Changed/Fixed; removed probably makes sense right? Or do we want a deprecated section?
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.
Deprecated would be more precise. Could also be changed. But I'm also fine wtih removed.
¯\_(ツ)_/¯
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.
I'll go with deprecated then, no harm in more sections ;)
This enforces access to build data via sim.data which is supposed to be the standard way of accessing this information (addresses #1145).
d19fd48
to
b07a200
Compare
Motivation and context:
As discussed and decided in #1145 static data generated during the build (e.g. eval points, encoders) should be accessed via the
sim.data
attribute. This PR deprecates the access tosim.model
(aDeprecationWarning
will be issued when accessing the attribute).One thing that might be controversial is whether there might be legit use cases to access
sim.model
(as it provides more than justsim.model.params
). But to me it seems like the model does not necessarily belong in the public interface of the simulator and all tests were easily adjusted for the change.Just deprecating
sim.model.params
would be more complicated because it should only be deprecated when accessed viasim.model.params
, but not when accessed within the build process.How has this been tested?
The first commit completely removes the access to
sim.model
to make all tests where it is used fail. All those places where fixed in the same commit. Thus all tests (including--slow
tests) pass without the need to accesssim.model
. The second commit reintroducessim.model
with a deprecation warning and a test for this warning.How long should this take to review?
Types of changes:
Checklist:
Still to do:
In theory, it should be documented that backends should provide access to certain things via
sim.data
. But we do not have a general guide for backend developers yet, so I have no idea where I put this information.We should also add some documentation on how to “probe” those static build data, but couldn't figure out a good place for that so far.