Skip to content

Conversation

@mintlu8
Copy link
Contributor

@mintlu8 mintlu8 commented Jun 4, 2024

Objective

Re-exports of accesskit, tracing, tracing_subscribers and hashbrown are very annoying when using auto-complete.

Solution

  • Applied #[doc(hidden)] to re-exports of accesskit, tracing, and hashbrown, that causes issues when using editors.

  • Removed tracing_subscribers re-export.

  • Added feature unhide_reexports to un-hide them.

Testing

Tested with with VSCode.

Migration Guide

  • bevy_log::tracing_subscribers has been removed.
  • bevy_utils::hashbrown, bevy_utils::tracing and bevy_a11y::accesskit are no longer a part of bevy's public API and are no longer guaranteed to be exported in future versions.

@alice-i-cecile
Copy link
Member

Why do this rather than just removing the re-exports?

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Cross-Cutting Impacts the entire engine labels Jun 4, 2024
@mintlu8
Copy link
Contributor Author

mintlu8 commented Jun 4, 2024

Why do this rather than just removing the re-exports?

Maximum backwards compatibility 😄, I'm fine with cutting them.

@alice-i-cecile alice-i-cecile requested a review from mockersf June 4, 2024 17:04
@alice-i-cecile
Copy link
Member

I'd prefer to cut them: I haven't seen anyone clamoring for these, unlike those from glam.

@mintlu8 mintlu8 marked this pull request as ready for review June 4, 2024 17:08
@alice-i-cecile alice-i-cecile added the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jun 4, 2024
@mintlu8
Copy link
Contributor Author

mintlu8 commented Jun 4, 2024

I'd prefer to cut them: I haven't seen anyone clamoring for these, unlike those from glam.

None of them are "cuttable" due to them all being used by various macros. I removed the feature and used #[doc(hidden)] directly.

@alice-i-cecile alice-i-cecile added the M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Jun 4, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2024

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

@alice-i-cecile
Copy link
Member

Hmm, I like this better than the status quo.

Can't we just use absolute imports in the macros instead?

@mintlu8
Copy link
Contributor Author

mintlu8 commented Jun 4, 2024

Hmm, I like this better than the status quo.

Can't we just use absolute imports in the macros instead?

Removed tracing_subscribers. The other three are good for project organization imo.

  • hashbrown is exported because bevy_util::HashMap is a typedef with a pre-set hasher, while Reflect is implemented on a generic hasher.
  • accesskit is currently not on the latest version, keeping it in bevy_a11y keeps things consistent.
  • tracing is used by crates lower on the dependency chain than bevy_log like bevy_ecs.
    Replacing it with absolute import is an option though.

@mockersf mockersf added the X-Controversial There is active debate or serious implications around merging this PR label Jun 4, 2024
@mockersf
Copy link
Member

mockersf commented Jun 4, 2024

I would prefer to keep the re-export, otherwise people using Bevy API need to keep the dependencies at the same version as Bevy or risk incompatibilities

@mockersf mockersf added X-Contentious There are nontrivial implications that should be thought through and removed X-Controversial There is active debate or serious implications around merging this PR labels Jun 4, 2024
@alice-i-cecile
Copy link
Member

Alright, I can get behind that. So keep the re-exports, but hide them so they don't junk up the auto-complete.

@mockersf
Copy link
Member

mockersf commented Jun 4, 2024

I don't know for others, but I use the re-exports of tracing and tracing-subscriber and usually relies on auto-complete to get them right, so I would prefer them to not be hidden

@mintlu8
Copy link
Contributor Author

mintlu8 commented Jun 4, 2024

I don't know for others, but I use the re-exports of tracing and tracing-subscriber and usually relies on auto-complete to get them right, so I would prefer them to not be hidden

Let me counter this a little bit. tracing is very stable, tracing-subscriber is somewhat stable so I don't expect version mismatch to be a huge problem, without bevy exporting them it takes one import per project to get them working, vs Handle being autocompleted to tracing-subscriber::..::Handle which takes a lot of time.

hashbrown is probably not pulled in by the user, since it's in bevy_utils.

The only contentious crate is accesskit. I think maybe add a feature flag like accesskit just to publicly re-export it?

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Jun 4, 2024

accesskit's naming is really prone to clashing with existing functionality in Bevy's apps. IMO a feature flag is less discoverable / typical than the standard "just pull your own dependency" pattern, and cargo-deny is solid at catching duplicate versions in tree. And it's not really any more convenient either.

@mockersf
Copy link
Member

mockersf commented Jun 4, 2024

could we re-export the few items most often used instead of a blanket re-export of the whole crates?

@mintlu8
Copy link
Contributor Author

mintlu8 commented Jun 4, 2024

could we re-export the few items most often used instead of a blanket re-export of the whole crates?

What would be the common used items?

I can only think of span! and Span from tracing, which are currently not in bevy_log.

Not sure what you would want from tracing_subscriber as a user since bevy takes care of logging pretty well. It's hard to get anything out of it if you don't have the whole crate.

No idea about accesskit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Cross-Cutting Impacts the entire engine C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Contentious There are nontrivial implications that should be thought through

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants