Skip to content

Simplify use_spatial_hash flag #1730

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

Merged
merged 4 commits into from
Apr 28, 2023

Conversation

codeguru42
Copy link
Contributor

This changes the flag to a bool instead of Optional[bool]. The behavior should remain unchanged, even when the parameter is not passed in because the default is False.

@einarf
Copy link
Member

einarf commented Apr 27, 2023

This breaks other code in arcade. Historically None was "make a choice for me", but that might not be needed any more. Check the failing tests and see if that can be cleaned up.

@codeguru42
Copy link
Contributor Author

@einarf There are some cases where a default of None makes sense. I am proposing that we directly set use_spatial_hash directly to False as the default.

I'll work on getting the tests to pass.

@Cleptomania
Copy link
Member

I think setting to False by default with no None option makes the most sense, we just need to update the typing for the other stuff in TileMap that passes down to that.

We should probably also put this in the breaking changes section of the release notes. While it’s not necessarily a big breaking thing, there could be users passing None to this(and I think functionally that would still work, but type checkers would complain).

@codeguru42
Copy link
Contributor Author

codeguru42 commented Apr 27, 2023

@Cleptomania Thanks for the input. I pushed the change last night and am looking at the failing tests now. I love that we have those to catch these kinds of things. I think I've updated all the places in tilemap now.

Also, I hadn't considered anyone passing an explicit None as the value. I think you have the right idea. Do I need to note the breaking change in some file on this branch? Or how is that handled in our documentation? Nevermind, I found the release notes.

This changes the flag to a bool instead of Optional[bool]. The behavior
should remain unchanged, even when the parameter is not passed in
because the default is False.
@einarf
Copy link
Member

einarf commented Apr 27, 2023

I think setting to False by default with no None option makes the most sense,

Agree. I don't think we're doing the auto select thing any more. We usually fall back to gpu collision.

@codeguru42
Copy link
Contributor Author

@einarf @Cleptomania This is ready for review now that tests are passing.

@einarf
Copy link
Member

einarf commented Apr 28, 2023

This change is fairly straight forward. It's simpy just removing a legacy option None, so I'll just merge.

Thanks for the contribution!

@einarf einarf merged commit 3b94e5a into pythonarcade:development Apr 28, 2023
@codeguru42 codeguru42 deleted the use_spatial_hash branch December 26, 2023 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants