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

Cleaner External Device Referencing #260

Open
MikeHart85 opened this issue Jul 13, 2017 · 1 comment
Open

Cleaner External Device Referencing #260

MikeHart85 opened this issue Jul 13, 2017 · 1 comment

Comments

@MikeHart85
Copy link
Contributor

This came up while reviewing #259.

Currently, Lewis requires this sort of layout for a custom device directory:

/some/host/path         <-- Must point -a here
├─ devices/             <-- Must name this using -k
│  ├─ epics_device/     <-- Must name this as positional argument
│  │  └─ ...
│  ├─ stream_device/
│  │  └─ ...
│  └ __init__.py        <-- Must exist

From an internal implementation perspective, I understand why this is the case. But from a user's perspective, this is all very counter-intuitive, strange and inconvenient... because a user will be looking at it this way:

/path/to/my/devices   <-- Lewis needs to know where my devices are
├─ epics_device/      <-- Lewis needs to know which device I want to start
│  └─ ...
├─ stream_device/
│  └─ ...
└ __init__.py         <-- Why do I have to add this? Shouldn't be necessary!

I have some devices. I've put them all in a folder.
I understand Lewis needs to know where they are and which one to start. But...
Why is /path/to/my/devices split into two options?
Why does Lewis even care about /path/to/my? That has nothing to do with my devices/!
Why do I have to put this weird __init__.py thing in path/to/my/devices? It's just a folder where I happened to put my devices!"

I think a cleaner syntax would be something like:

$ docker run -it -v /path/to/my/devices:/external dmscid/lewis -m /external epics_device
$ lewis -m /path/to/my/devices epics_device

Or maybe we could even integrate path detection with the device name parameter (If a / or \ is present, treat device_name as a path/to/device_name):

$ docker run -it -v /path/to/my/devices:/external dmscid/lewis /external/epics_device
$ lewis /path/to/my/devices/epics_device
@MichaelWedel
Copy link
Contributor

I mostly agree with this...after having written a few "external devices" this has become quite inconvenient.

The only part I am not so sure about is whether it's possible to import stuff in the absence of an __init__.py. I guess a good start would be to cut out the -k option (easy to remain backwards compatible - could just be appended to whatever else we decide to call the "new" option).

@MikeHart85 MikeHart85 modified the milestones: Release 1.2, Release 1.3 Sep 21, 2017
@mattclarke mattclarke removed this from the Release 1.3 milestone Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants