one line import #420#447
Conversation
Example:
import ev3dev2.auto as ev3
ts = ev3.TouchSensor(ev3.INPUT_1)
|
I am not married to this approach, this is just the first way to solve this that popped in my head. |
|
@WasabiFan do you know of a way to make the CI tests run again? It failed for some non-obvious reason. |
|
It looks like the problem with tests was on Travis-CI side. I've restarted the build and it passed this time. |
ddemidov
left a comment
There was a problem hiding this comment.
I like this. Also, it is optional, so if someone does not like the approach (for example, because it loads modules that are unnecessary for the current robot), there is always an option to do it manually instead.
|
Thanks Denis yeah seems like this makes it about as easy as it can get but with the penalty of slower startup times due to import every module. Will leave this open for a day so folks have a chance to look at it and then will merge. |
|
This seems reasonable to me. We need to figure out whether we want to recommend the "auto" module or individual imports in e.g. the README (in my WIP PR it uses the individual ones). Also, one of the first things on my to-do list is properly supporting Micropython; I'll need to modify this to exclude some modules in that environment, I think. |
|
My preference would be to steer folks towards explicitly importing only what they need, that is more of standard python best practice and it makes it more obvious as to where to look to find the code you are using. Something I need to test is how long importing everything takes with and without |
|
Agreed. In fact, I'd say the same about GyroBalancer and rc_tank. |
|
k I am going to drop the |
Example:
import ev3dev2.auto as ev3
ts = ev3.TouchSensor(ev3.INPUT_1)
Example: