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

Deprecate sim.model.params in favour of sim.data #1173

Merged
merged 2 commits into from
Sep 21, 2016
Merged

Conversation

jgosmann
Copy link
Collaborator

@jgosmann jgosmann commented Sep 13, 2016

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 to sim.model (a DeprecationWarning 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 just sim.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 via sim.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 access sim.model. The second commit reintroduces sim.model with a deprecation warning and a test for this warning.

How long should this take to review?

  • Average (neither quick nor lengthy)

Types of changes:

  • Breaking change (fix or feature that causes existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING.rst document.
  • I have updated the documentation accordingly.
  • I have included a changelog entry.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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.

@mention-bot
Copy link

@jgosmann, thanks for your PR! By analyzing the annotation information on this pull request, we identified @tbekolay to be a potential reviewer

@Seanny123
Copy link
Contributor

LGTM. Let me know when you've made a changelog entry.

@tbekolay
Copy link
Member

This LGTM too 👍 Will merge once the changelog is pushed!

@jgosmann
Copy link
Collaborator Author

Doing that now :)

@jgosmann jgosmann removed their assignment Sep 21, 2016
@jgosmann
Copy link
Collaborator Author

done :)

@@ -21,6 +21,15 @@ Release History
2.2.1 (unreleased)
==================

**API changes**
Copy link
Member

@tbekolay tbekolay Sep 21, 2016

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?

Copy link
Collaborator Author

@jgosmann jgosmann Sep 21, 2016

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.
¯\_(ツ)_/¯

Copy link
Member

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants