Skip to content

automatic platform detection should not be done in ev3dev package __init__ #70

Closed

Description

@EricPobot

The automatic detection based on the current architecture makes impossible to have the appropriate imports done when working on the dev system and targeting something else than an EV3. When developing an app for a BrickPi for instance, IDE code hints, completion and checking mechanisms will not work since the ev3 import will always be done.

The platform dependant import should be left to the responsibility of the robot code developer, who is supposed to know which platform he targets. Instead of using  import ev3dev in the application code modules, he will use something like form ev3dev import ev3.

To have this mechanism work properly platform specific modules must include from .core import *, so that the generic definitions will be made available automatically to them. BTW doing this makes possible for platform specific modules to override generic definitions by re-defining them if needed.

Activity

  1. dlech commented on Nov 6, 2015

    @dlech
    Member
  2. ddemidov commented on Nov 6, 2015

    @ddemidov
    Member

    I agree the way its implemented now is not right. For some reason I assumed that import * from ev3dev.brickpi would not load ev3dev.__init__. I just checked and __init__ does get loaded. I still would like for a way to autoload default platform. May be could move the code from ev3dev.__init__ to ev3dev.auto.

    I also like what @dlech is saying in ev3dev/ev3dev#412. Basically, we don't need a lot of platform-specific code, we just look at platform properties and expose what's available.

  3. EricPobot commented on Nov 6, 2015

    @EricPobot
    ContributorAuthor

    Beware that specificities go beyond properties only.

    For instance, the current implementation of the LEDs for the EV3 is not satisfying, because they are dual colour ones (I'm modifying the ev3.py module to illustrate this, and the point will be more explicit then). Platform specificities will include behaviours, and thus logic. I'm not sure that a declarative mechanism for properties will be enough.

  4. dwalton76 commented on Sep 1, 2017

    @dwalton76
    Collaborator

    @ddemidov should we just close this one? It has been 2 years, if we haven't fixed it by now...

  5. WasabiFan commented on Sep 1, 2017

    @WasabiFan
    Member
  6. ddemidov commented on Sep 1, 2017

    @ddemidov
    Member

    Yeah, it looks like it was resolved in #72.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions