-
Notifications
You must be signed in to change notification settings - Fork 336
CircuitPython backend: WIP #1814
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
base: develop
Are you sure you want to change the base?
Conversation
106fd8e to
e7f1f5a
Compare
|
This can be done if #1815 will be merged |
|
I know quite a few people disagree with me on this, but I am not a fan of mixing CPython code and MicroPython code. I think MicroPython/CircuitPython code should be written in a highly optimized way that makes sense for embedded systems and CPython code should be easier to use and understand and take advantage of all of the additional libraries that are available. Writing a MicroPython or CircuitPython library that has the same high-level API is fine if you want to have the same code run on both embedded systems and desktop, but trying to combine the two in a single code base just makes both worse. |
I understand about highly optimized code, but currently there is no normal high-level solution for CircuitPython. When I started doing this, the main criterion was to do everything possible not to modify bleak this PR at a very early stage, in fact I am trying to make the backend compatible, and it is quite possible with almost no modification to bleak. This is possible because the main codebase is already almost completely compatible, except for some annotations and a few modules missing from CircuitPython, which can be easily bypassed or replaced with native alternatives. I suggest you wait until I finish at least the main part and see the result, I hope it will pleasantly surprise you. For now it is a test ground. |
|
If it is not approved in the end, and I put a separate optimized fork. But before that, I’ll at least try. |
9be1b50 to
f4e351b
Compare
|
It is just still sample, the backend realisation is totally dumb now, and there are a lot of patches aplying in runtime. But It is already allows to run bleak on CircuitPython with just 45 lines modified in the original code base. It's much simplier to make specially optimized fork for micropython/circuitpython, so If you still not agree with approaches like that I will move it all to 3rd party fork (circuitpython-bleak or kinda) and optimize it specially for micropython/circuitpython Also if you can please change this PR to draft |
This is the work in progress PR that tries to implement
bleak-compatible backend forCircuitPythonThis PR is relative to #1812 issue
Keynotes
BleakScannerworks,BleakClientis not complete.bleakhave a lot of conditional imports that is not DRY (Too much repeating conditional imports #1813), as you can see that creates the need to make many changes to the original code, i can create a separate PR to refactor it