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

feat!: don't import backends by default #243

Merged
merged 1 commit into from
Sep 7, 2023
Merged

feat!: don't import backends by default #243

merged 1 commit into from
Sep 7, 2023

Conversation

dlech
Copy link
Collaborator

@dlech dlech commented Sep 7, 2023

Since the top-level __init__.py is always imported when any subpackage is imported, this caused both backends (glib and aio) to always be imported. This is not desirable, since it means that the glib backend will always be imported, even if the user only wants to use the aio. This wastes resources and in some cases can even cause a crash.

Fixes: #242

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: +0.03% 🎉

Comparison is base (14f52f2) 82.81% compared to head (d2a0104) 82.84%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #243      +/-   ##
==========================================
+ Coverage   82.81%   82.84%   +0.03%     
==========================================
  Files          28       28              
  Lines        3259     3259              
  Branches      674      674              
==========================================
+ Hits         2699     2700       +1     
+ Misses        343      342       -1     
  Partials      217      217              
Files Changed Coverage Δ
src/dbus_fast/__version__.py 0.00% <0.00%> (ø)
src/dbus_fast/__init__.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@dlech
Copy link
Collaborator Author

dlech commented Sep 7, 2023

Technically, this is an API breaking change, but I think the only thing it would break is:

import dbus_fast

dbus_fast.aio.something

or

from dbus_fast import *

aio.something

which I hope would be quite rare.

@bdraco
Copy link
Member

bdraco commented Sep 7, 2023

We should probably mark it as a breaking change.

Testing this now

@dlech dlech force-pushed the no-backend-import branch from 0a7dbb1 to b86dd85 Compare September 7, 2023 23:28
BREAKING CHANGE:
Since the top-level `__init__.py` is always imported when any subpackage
is imported, this caused both backends (glib and aio) to always be
imported. This is not desirable, since it means that the glib backend
will always be imported, even if the user only wants to use the aio.
This wastes resources and in some cases can even cause a crash.

Fixes: #242
@dlech dlech force-pushed the no-backend-import branch from b86dd85 to d2a0104 Compare September 7, 2023 23:30
@bdraco bdraco changed the title feat: don't import backends by default feat!: don't import backends by default Sep 7, 2023
@bdraco bdraco merged commit 091d421 into main Sep 7, 2023
@bdraco bdraco deleted the no-backend-import branch September 7, 2023 23:35
@bdraco
Copy link
Member

bdraco commented Sep 7, 2023

Pushed to all my production. Nothing broke. Let's hope thats the case for everyone else

@bdraco
Copy link
Member

bdraco commented Sep 7, 2023

Thanks @dlech

@bdraco
Copy link
Member

bdraco commented Sep 7, 2023

Everything was ok with the dep bump except bleak

bleak 0.21.0 depends on dbus-fast<2.0.0 and >=1.83.0; platform_system == "Linux"

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.

Allow use without importing glib backend.
2 participants