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

   # Rationale for this change
   
   Four enums move from `class X(str, Enum)` to `enum.StrEnum`, which Python 
3.11 provides: `HttpMethod`, `FileFormat`, `IsolationLevel` and 
`SnapshotRefType`.
   
   `StrEnum` states the intent directly, and ruff's `UP042` (preview) asks for 
it. It was the only remaining pyupgrade finding outside `vendor/` after #4170 
raised the floor to Python 3.11.
   
   ## Behaviour change
   
   `str()` and f-strings render the value instead of the class-qualified name:
   
   - `str(FileFormat.AVRO)` gives `AVRO`, where it gave `FileFormat.AVRO`. The 
same applies to `HttpMethod` and `IsolationLevel`.
   - `SnapshotRefType.__str__` is removed because `StrEnum` already returns the 
value, so its output does not change.
   - `repr()`, equality, hashing and JSON output are unchanged.
   
   Nothing in the repository relied on the old strings. The only place that 
formats `HttpMethod` uses `.value` (`Endpoint.describe`), and the CLI already 
rendered `SnapshotRefType` through its own `__str__`.
   
   ## Are these changes tested?
   
   Existing suites only, since this is a type-level change with no new logic. 
Locally: `prek run -a` (ruff, mypy) passes, and `pytest tests/table 
tests/catalog tests/cli tests/utils/test_manifest.py 
tests/io/test_fileformat.py tests/expressions tests/avro -m unit` gives 2606 
passed with the same 11 environment failures as `main` (missing polars, 
hive-kerberos and azure-identity extras, plus two fastavro order-pollution 
tests).
   
   ## Are there any user-facing changes?
   
   Yes, in logs and string output only: a user who formats one of these enums 
themselves sees `AVRO` instead of `FileFormat.AVRO`. Values, comparisons and 
serialised results do not change.
   


-- 
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