pennpolygons / cv-boilerplate

Open-source boilerplate for computer vision research
MIT License
16 stars 2 forks source link

Clean Code & Typing #8

Open mchiquier opened 4 years ago

mchiquier commented 4 years ago

@goodmattg How do you imagine we have boilerplate that checks for this?

Useful links: https://docs.python.org/3/library/typing.html

goodmattg commented 4 years ago

I mean that our code in this boilerplate should be well typed 😄. You're totally correct we aren't going to typecheck the researcher's code. IDE's actually do support that, but no researcher would want it.

ChickenTarm commented 4 years ago

one way for researchers to have typing for their code is to define schemas that is some custom schema they define that gets passed around. They could just use a dictionary like i see a lot of people using, but one problem with dictionaries is that people just cram in whatever garbage they want leading to bad readability.

goodmattg commented 4 years ago

We're addressing this in a few ways:

  1. All of our code should be typed in case researchers want to add custom logging, actions, etc.
  2. We're YAML first in terms of configuration. Hydra makes it easy to split configurations into multiple files and keep things clean. Our repo is a good example of using the "defaults" section to keep things clean. The release version of Hydra does support something called "Structured Config" which is like strongly typed YAML, but I think that would just confuse researchers

https://hydra.cc/docs/next/tutorials/structured_config/intro/#internaldocs-banner