Skip to content
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

Simplify python generation, gather requirements, and improve documentation #485

Open
cmungall opened this issue Nov 23, 2021 · 1 comment
Assignees
Labels
generator-dataclasses Python classes were generated by dataclass (we are mostly switching to Pydantic, though) generator-pydantic
Milestone

Comments

@cmungall
Copy link
Member

cmungall commented Nov 23, 2021

Currently the python generation has lots of magic in it that should be better documented

We are currently working on pydantic support

It's not yet clear whether we should converge on "one true way" of doing python OMs or continue to have both pythongen and pydanticgen

Here is a start on a list of requirements we can use to guide us in long term decision making

  • expressive validation
    • ranges
    • min value, max value
    • regex
    • boolean combinations
  • delayed validation
    • some validation operations may be expensive, so we may want to allow the ability to create objects pbypassing some expensive checks
  • validation
    • simple instantiation from dicts/json
    • simple serialization to dicts/json
  • automated conversion on instantiation
    • instantiation from nested dicts (must-have)
    • smart conversion
      • e.g. if bars is multivalued, then bars=Bar(...) converts to a list. IMO this is less necessary and can be confusing
  • Union ranges where the schema uses exactly_one_of
  • Any support
  • inlining support
  • flexibility on converting types
    • one option is to use aliases rather than classes
    • e.g. LINKML_STRING = str
  • multiple inheritance support
  • Compatibility with other frameworks
    • pydantic (either direct or via bridge)
    • fastapi
    • flask
    • sqlalchemy
    • pyneo
@nlharris
Copy link
Contributor

This ticket has a lot of things in it, and it's not clear what's not done and what still needs to be done.

@nlharris nlharris added the generator-dataclasses Python classes were generated by dataclass (we are mostly switching to Pydantic, though) label Oct 7, 2022
@sierra-moxon sierra-moxon removed their assignment Dec 22, 2022
@cmungall cmungall modified the milestones: 1.3 release, 1.7 Release Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator-dataclasses Python classes were generated by dataclass (we are mostly switching to Pydantic, though) generator-pydantic
Projects
None yet
Development

No branches or pull requests

5 participants