-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Conversation
…into config-explorer
…into config-explorer
…into config-explorer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
|
||
def full_name(cla55: type) -> str: | ||
def full_name(cla55: Optional[type]) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I feel obligated to point out cla55
after our in-person conversation. Clearly it should be clazz
! Just teasing.
return f"""{_remove_prefix(str(origin))}[{", ".join(full_name(arg) for arg in args)}]""" | ||
elif origin == Union: | ||
# Special special case to handle optional types: | ||
if len(args) == 2 and args[-1] == type(None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes! This is how options are implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically, options aren't "implemented", they don't exist other than as type annotations.
so while it looks ugly, it's precisely what an Optional[T]
type hint means.
try: | ||
config = configure(class_name) | ||
except: | ||
# TODO(joelgrus): better error handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pointing out the TODO. I assume you meant to leave it but wanted to make sure.
This is super cool! One idea for a next iteration / even more useful interface: instead of having links to new pages, have a single page that contains the full JSON. When you click on something configurable, the list of options shows up in a modal dialog. When you pick something from that list, instead of going to a new page, the original link is replaced by the nested configuration, and you continue. Then, when you're done clicking on all of the links, you have a fully-formed configuration file that you can use. Does this make sense? |
Also, I was clicking through things and found the initializers and regularizers aren't treated correctly yet. |
@matt-gardner I have something similar in my mind. My hope is that we can re-use an off-the-shelf JSON autocompleter rather than extending a web application of our own. |
@schmmd, I'd be surprised if there were a library that would just work for this. Maybe we can find one, but I'm skeptical. It doesn't seem that hard, though, as all of the pieces are already here in what @joelgrus has. You just capture the clicks and instead of following links, you put the response in a modal dialog, or replace the text in the clicked element. You just need a bit of instrumentation on the displayed JSON (doesn't seem likely that there's a library that already does this), and some handling for removing the |
We'd likely need to exact flow we envision to the software we find--if we found something. |
ok, with some pretty ugly (but unavoidable) hacks, I got initializers and regularizers working. I had to make one small tweak: our initializers are anonymous classes that wrap a curried function, so there was no easy to way to check if you had one. I added a class variable |
* config explorer * wip * wip * progress * work * config tool * configuration * configuration command line tool * add test for configure command * fix test collisions * fix docs * scope suppress FutureWarning to only h5py imports * fix import ordering * fix docs * fix docs (again) * add web based config explorer * add test for include-packages * rename new package to avoid collision with other tests * fix config explorer on initializers and regularizers (via some nasty hacks) * fix test for _init_function now being a class method * fix some tests * revert some initializer changes * reorder * fix pylint issues * fix mypy
there's some ugly hacks in here, but so be it