-
Notifications
You must be signed in to change notification settings - Fork 16
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
asyncio serial impl, optional config files, fix logging #38
Conversation
Supports upload, download and repl subcommands Defaults to the REPL if no subcommand is passed
Ohw, wow that's a lot of changes 😱 For starters: Thanks for the effort!
Yeah, it's definitely a good idea to split this into separate PRs :) Did a quick scan, some high level feedback, might sound a bit harsh, but I do think these things need to addressed:
I guess a more generic comment would be that if someone is planning or working on larger changes it's probably a good idea to create an issue first to discuss those changes. |
wow! curious to look into the design ideas here. thanks for your efforts-- i'll be able to write more this evening. |
TLDR: This is basically all to support more advanced use cases, the issues it addresses can probably be solved with more localized changes, and I don't want reviewing it to be a distraction from more pressing work. I'll try to split out some elements worth keeping into smaller patches.
Not the first time I've been told this! Mostly I get anxious when files get over a few hundred lines. Smaller files are often somewhat easier to merge I think, but it can definitely be more cognitive load to figure out what lives in which file. Classes here I'm mostly trying to use to decouple functionality but I'm willing to be convinced that the boundaries are too granular.
I can see a couple sides to this. The principal advantage of runtime configuration is increased flexibility : I believe these initial options give the ability to customize aspects of the capture pane behavior that were being discussed recently on #13. This can also be empowering to users, since it's easier to make local changes to high level configuration than it is to modify source or put together a pull request. I included style options here because some forum discussion pointed out that the text is difficult to read on some terminal backgrounds, which may be a difficult problem to find good one-size-fits-all solutions for. You can of course change your terminal background color instead, which avoids needing to support / document this configuration, though often that's a system-wide change and this is a simpler example of appearance customization. This seems like the main trade-off to me: flexibility of operation and promotion of more data-driven code structure vs documentation and validation burden. I guess my feeling is that every application wants for runtime configuration eventually, and this can be designed for early or painful to add later. Or not so bad to add later or totally unnecessary, also definite possibilities!
These changes as I see them address a couple of concerns:
Totally fair! Often I find discussion of structural stuff like this hard to articulate without having some code in hand. This all basically grew out of my own harebrained explorations and I thought some of the structural changes might be nice to upstream in order to be working from the same codebase for both simpler and more complex use cases. With the benefit of sleeping on it I agree that this is probably overengineered for druid's primary functionality. |
Fixes #12 , fixes #14
I apologize that this is a lot of stuff at once, I can try and wrangle it into more digestible increments if desired. Tested on Windows and OSX, haven't had a chance to test Linux yet.
Protocol
s +pyserial_asyncio
, which can detect connect/disconnect events and allows for nonblocking serial port operations. This allows the fix for When disconnected druid continually fills the console with messages #14. Some tweaks (in the form of overriding some methods) had to be made to get this cooperating cross-platform. Another class which keeps the polling implementation of the serial code is retained, this is what's used by theupload
anddownload
CLIs to avoid dealing with an event loop and stuff.run_until_complete
? I don't know whether this is okay / safe but it seems to have a clean exit (for the time being)config.py
. It will scan fordruid.yml
or.druid.yml
in either your home directory or the current directory, and merge in configuration from there. For example, you can override the default shell colors:^^stream
,^^change
, or^^ii.*
events appear in the capture panels:druid.yml
checked in which just increases the default log verbosity toDEBUG
on the assumption that if you have this file in your working directory, you're developing druid.