{"id":15733395,"url":"https://github.com/yukinarit/okome","last_synced_at":"2025-06-22T21:37:15.557Z","repository":{"id":83343176,"uuid":"420125509","full_name":"yukinarit/okome","owner":"yukinarit","description":"dataclass comment parser 🍚","archived":false,"fork":false,"pushed_at":"2021-12-09T15:51:11.000Z","size":742,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T03:45:16.727Z","etag":null,"topics":["comments","dataclasses","parser","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukinarit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-22T14:15:12.000Z","updated_at":"2022-09-17T23:42:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c00b20a-1821-4e9f-9440-96f1a7bd8fe7","html_url":"https://github.com/yukinarit/okome","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yukinarit/okome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fokome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fokome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fokome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fokome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukinarit","download_url":"https://codeload.github.com/yukinarit/okome/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fokome/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261373579,"owners_count":23148917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comments","dataclasses","parser","python"],"created_at":"2024-10-04T00:41:54.820Z","updated_at":"2025-06-22T21:37:10.541Z","avatar_url":"https://github.com/yukinarit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `okome` 🍚\n\n*dataclass comment parser*\n\n```python\n@dataclasses.dataclass\nclass Foo:\n    \"\"\"\n    This is a comment for class `Foo`.\n    \"\"\"\n\n    a: int\n    \"\"\" This is valid comment for field that can be parsed by okome \"\"\"\n    b: str\n    \"\"\"\n    Multi line comment\n    also works!\n    \"\"\"\n```\n\nIt's known to be impossible to get comments declared for dataclass and its fields. Eric V. Smith, the author of `dataclasses` module said in https://bugs.python.org/issue38401\n\n\u003e To change this is beyond the scope of dataclasses, and would need to be a language change. I can't think of a good way to attach the string to the annotation before it\n\n---\n\nWith `okome`, you can get comments from dataclass!\n\n```python\nc = okome.parse(Foo)\nprint(f\"Class comment: {c.comment}\")\nfor f in c.fields:\n    print(f'Field \"{f.name}\" comment: {f.comment}')\n```\n\n![](magic.gif)\n\n```python\n$ python simple.py\nClass comment: ['This is a comment for class `Foo`.']\nField \"a\" comment: ['This is valid comment for field that can be parsed by okome']\nField \"b\" comment: ['Multi line comment', 'also works!']\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinarit%2Fokome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukinarit%2Fokome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinarit%2Fokome/lists"}