Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3816

Replace the properties sidecar with first-class attributes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • python

    Description

      The Python Schema classes have manually implemented "properties" that I've always struggled to understand.

      Python has "always" had a very flexible meta-object protocol, by which I mean you can always attach arbitrary properties to an object. So attaching an entire "properties" dictionary distinct from the object's own attributes only makes sense if you need to isolate some set of properties from others in some way. And maybe that's the case: We want to be able to distinguish canonical and standard properties from custom ones. But lang/py uses these "sidecar" properties for everything, canonical and otherwise. name, type, fields, symbols, and arbitrary properties alike. The cost for this is high, making the objects larger, more mutable, and cumbersome to typecheck.

      I've tried not to mess with them, because I didn't want to break backwards compatibility, but the property implementation is the main thing holding back further efforts to type hint the library.

      I think it's possible to remove "get_prop", "set_prop" etc from Schema without breaking most of the API, but if someone is using those functions directly, well, they won't be there anymore.

      I'll create a PoC and we can discuss the implications of backwards incompat.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kojiromike Michael A. Smith
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m