{"action":"created","issue":{"url":"https://api.github.com/repos/ufal/neuralmonkey/issues/17","repository_url":"https://api.github.com/repos/ufal/neuralmonkey","labels_url":"https://api.github.com/repos/ufal/neuralmonkey/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/ufal/neuralmonkey/issues/17/comments","events_url":"https://api.github.com/repos/ufal/neuralmonkey/issues/17/events","html_url":"https://github.com/ufal/neuralmonkey/issues/17","id":161970213,"number":17,"title":"Discussion on configuration","user":{"login":"tomasmcz","id":4395563,"avatar_url":"https://avatars.githubusercontent.com/u/4395563?v=3","gravatar_id":"","url":"https://api.github.com/users/tomasmcz","html_url":"https://github.com/tomasmcz","followers_url":"https://api.github.com/users/tomasmcz/followers","following_url":"https://api.github.com/users/tomasmcz/following{/other_user}","gists_url":"https://api.github.com/users/tomasmcz/gists{/gist_id}","starred_url":"https://api.github.com/users/tomasmcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomasmcz/subscriptions","organizations_url":"https://api.github.com/users/tomasmcz/orgs","repos_url":"https://api.github.com/users/tomasmcz/repos","events_url":"https://api.github.com/users/tomasmcz/events{/privacy}","received_events_url":"https://api.github.com/users/tomasmcz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ufal/neuralmonkey/labels/discussion","name":"discussion","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ufal/neuralmonkey/milestones/1","html_url":"https://github.com/ufal/neuralmonkey/milestones/pre-MTM","labels_url":"https://api.github.com/repos/ufal/neuralmonkey/milestones/1/labels","id":1850276,"number":1,"title":"pre-MTM","description":"Issues that should be solved before MT Marathon.","creator":{"login":"tomasmcz","id":4395563,"avatar_url":"https://avatars.githubusercontent.com/u/4395563?v=3","gravatar_id":"","url":"https://api.github.com/users/tomasmcz","html_url":"https://github.com/tomasmcz","followers_url":"https://api.github.com/users/tomasmcz/followers","following_url":"https://api.github.com/users/tomasmcz/following{/other_user}","gists_url":"https://api.github.com/users/tomasmcz/gists{/gist_id}","starred_url":"https://api.github.com/users/tomasmcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomasmcz/subscriptions","organizations_url":"https://api.github.com/users/tomasmcz/orgs","repos_url":"https://api.github.com/users/tomasmcz/repos","events_url":"https://api.github.com/users/tomasmcz/events{/privacy}","received_events_url":"https://api.github.com/users/tomasmcz/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":16,"state":"open","created_at":"2016-06-27T11:52:52Z","updated_at":"2016-07-08T18:20:29Z","due_on":"2016-09-14T22:00:00Z","closed_at":null},"comments":11,"created_at":"2016-06-23T16:47:16Z","updated_at":"2016-07-11T09:40:15Z","closed_at":"2016-07-05T23:29:47Z","body":"@jlibovicky, in #15 you mentioned that it would be hard to generate an ini file. Why do we need to do that?\r\n\r\nI'm not quite sure what is the design (if any) of the configuration manipulation. I thought that there is an ini file, that gets parsed into an abstract representation (some terrible Python object), then we build a computation graph according to the representation and run it. Is there anything else happening?"},"comment":{"url":"https://api.github.com/repos/ufal/neuralmonkey/issues/comments/231687775","html_url":"https://github.com/ufal/neuralmonkey/issues/17#issuecomment-231687775","issue_url":"https://api.github.com/repos/ufal/neuralmonkey/issues/17","id":231687775,"user":{"login":"jindrahelcl","id":1842355,"avatar_url":"https://avatars.githubusercontent.com/u/1842355?v=3","gravatar_id":"","url":"https://api.github.com/users/jindrahelcl","html_url":"https://github.com/jindrahelcl","followers_url":"https://api.github.com/users/jindrahelcl/followers","following_url":"https://api.github.com/users/jindrahelcl/following{/other_user}","gists_url":"https://api.github.com/users/jindrahelcl/gists{/gist_id}","starred_url":"https://api.github.com/users/jindrahelcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jindrahelcl/subscriptions","organizations_url":"https://api.github.com/users/jindrahelcl/orgs","repos_url":"https://api.github.com/users/jindrahelcl/repos","events_url":"https://api.github.com/users/jindrahelcl/events{/privacy}","received_events_url":"https://api.github.com/users/jindrahelcl/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T09:40:15Z","updated_at":"2016-07-11T09:40:15Z","body":"Nechci zakládat žádnej novej thread o konfiguraci a nevyhovuje mi google-dokumentovej mini-widget na diskusi. Proto znovuotevírám tohleto s následujícíma nápadama. Nutno poznamenat, že ačkoli mi ty věci, co se chystám napsat přijdou, jako že by byly fajn, vlastně nakonec vůbec fajn bejt nemusej.\r\n\r\nMyslím si, že by z designovýho hlediska by bylo nejlepší celou konfiguraci pojmout tak, že si každej objekt svoje konfiguráky bude deklarovat sám, něco ve stylu argparse, ale pro náš neuralmonkey INI soubor. To by mohlo vypadat nějak následovně:\r\n\r\nINI soubor:\r\n```\r\n[frobnicator]\r\nclass=omgs.frobnicator\r\nfrobnication_size=256\r\nomg_size=31415927\r\nfoo_here=\"/tmp/foos\"\r\n```\r\n\r\nTřída `frobnicator` (a všechny ostatní neuralmonkey konfigurovatelný třídy) by pak uměly něco jako tohle:\r\n```\r\n@staticmethod\r\ndef gather_configuration_args(self, argparser):\r\n  argparser.add_argument(self, \"frobnication_size\", required=True, type=int)\r\n  argparser.add_argument(self, \"omg_size\", required=False, type=int)\r\n  argparser.add_argument(self, \"foo_here\", required=True, type=ArgParse.filetype) #nebo jak to je\r\n\r\ndef __init__(self, **kwargs):\r\n  self.frobnication_size = kwargs.get(\"frobnication_size\", DEFAULT_FROB_SIZE)\r\n```\r\n\r\nVýhodou tohohle vzoru je, že při parsingu konfigurace by se napřed na každý třídě zavolalo `gather_configuration_args`, který by dělalo kontrolu argumentů před tím, než by se zavolal konstruktor, takže chyby v konfiguraci by se projevily hned na začátku.\r\n\r\nTaky by nám to pomohlo zlikvidovat megakonstruktory. Když se dá `[main]` do samostatnýho objektu, tak to bude chodit zadarmo rovnou.\r\n\r\nBlbý je, že by se rozbily ty helper funkce. Teď mě nenapadá jak tohleto udělat. Ale ani mě, když na to koukám nenapadá, proč to není v konstruktorech těch objektů (ale to už bylo předmětem jiný diskuse)\r\n\r\nTaky bych na parsing zkusil použít https://docs.python.org/3/library/configparser.html místo našeho. Přineslo by to mimo jiné spoustu pěknejch vlastností, jako třeba zadarmo interpolaci proměnných nebo možnost odkázat se v manuálu na manuál toho parseru.\r\n\r\nDisclaimer: Nenavrhuju, že to takhle máme dělat a uvědomuju si, že je to příliš velká změna v návrhu. Pokud tahle diskuse dospěje do místa, kdy si budu jistej tím, že je to hezčí, tak to udělám sám. Nestane se to, pokud to dospěje do příliš abstraktních témat. Pro abstraktní komentáře proto využijte smajlíky v \"pick your reaction\" a pokuste se nekomentovat tenhle disclaimer. Ď"}}
{"actor":{"display_login":"jindrahelcl"}}