deepyaman commented on PR #29061: URL: https://github.com/apache/flink/pull/29061#issuecomment-5535265762
@dianfu @autophagy — ready for review when you have a moment. `Deprecated` called `warnings.warn` from `__call__`, which the decorator syntax invokes to *apply* the decorator, so the warning fired at decoration time: importing `pyflink.table` warned once for every deprecated API it defines, calling one warned for none, and `stacklevel=2` pointed inside PyFlink's own source. FLINK-37365 describes the intent as warning "at runtime on their invocation", so I've treated this as an oversight rather than a deliberate choice — @autophagy, you'd know best whether that reading is right. Functions now go through `typing_extensions.deprecated` (PEP 702's backport). Classes keep a small `__init__` wrapper instead, because PEP 702 also warns when a deprecated class is *subclassed*, and `Rowtime`/`Schema` extend the deprecated `Descriptor` at module level — adopting it there would warn on `import pyflink.table.descriptors`, which is the bug being fixed. The message format, the docstring directives and the `__stability_decorators` attribute are unchanged, so `PythonAPICompletenessTestCase` is unaffected. The PR also declares `typing-extensions` in `install_requires`: this module has imported it since FLINK-37365, resolving only because `apache-beam` happens to require it. CI is green (build 78680, all jobs). Three review threads are open where I've explained the current choice rather than changed it — the subprocess-based import test, one `try`/`except`, and two `cast`s — and I'm happy to go either way on those. One thing I deliberately left out of scope: `Rowtime` and `Schema` are `@Deprecated @Internal` on the Java side but carry no decorator in Python, so with PEP 702 subclass semantics they now warn zero times. Happy to file that as a follow-up. -- 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]
