nssalian opened a new pull request, #3692:
URL: https://github.com/apache/iceberg-python/pull/3692

   ## Rationale for this change
   
   `FileFormatModel` had only abstract methods (no shared implementation), so 
an `ABC` was heavier than needed. This PR converts it to `typing.Protocol`, 
which is the more Pythonic pattern for a pure interface. `FileFormatWriter` 
remains an `ABC` since it has shared `__enter__`/`__exit__`/`result` 
implementations that inheritance carries for free. `FileFormatFactory` is 
unchanged - it matches the existing `AuthManagerFactory` pattern.
   
   ## Changes
   
   New format implementations can now conform structurally without inheriting 
from `FileFormatModel`. Net: 2 `ABC`s → 1 `ABC` + 1 `Protocol`. No signature 
change for existing callers; `ParquetFormatModel(FileFormatModel)` inheritance 
is retained (`Protocol` supports explicit conformance).
   
   ## Are these changes tested?
   
   Yes. `tests/io/test_fileformat.py` adds two tests using a shared 
`_StructuralModel` helper:
   
   - `test_file_format_model_is_protocol` - a structurally-conforming class (no 
inheritance) passes `isinstance()` against `FileFormatModel`.
   - `test_structural_model_works_with_factory` - a structurally-conforming 
class can be registered and retrieved via `FileFormatFactory` end-to-end.
   
   ## Are there any user-facing changes?
   
   No. Default behavior is unchanged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to