.agents/skills/flet-deprecation/SKILL.md
Use this skill when you:
Annotated[..., V.deprecated(...)],flet.utils.deprecated helpers,deprecated label).Do not use this skill for non-deprecation validation logic; use
flet-validation.
sdk/python/packages/flet/src/flet/utils/deprecated.pysdk/python/packages/flet/src/flet/utils/validation.py (V.deprecated)sdk/python/packages/flet/src/flet/utils/griffe_deprecations.pyUse this order and stop at the first option that fits:
Annotated[..., V.deprecated(...)].@deprecated(...).@deprecated_class(...).Do not add parallel custom warning logic in before_update() when V.deprecated
already covers the field.
Follow the non-copying model:
before_update().Removal phase:
delete_version cleanup, remove old Python property/deprecation and remove
Dart fallback in the same migration.0.82.0 -> remove in 0.85.0.delete_version unless there is an approved exception.When working on a release for {new_version}, treat deprecations with
delete_version == {new_version} as mandatory audit items.
@deprecated(...), @deprecated_class(...),
and V.deprecated(...) entries whose delete_version equals {new_version}.rg -n 'delete_version\\s*=\\s*"{new_version}"|delete_version\\s*=\\s*\\x27{new_version}\\x27' -S sdk/python/packages{new_version} cleanup
edits into one grouped commit instead of splitting them across multiple commits.
Use commit message format: release: remove deprecated APIs for {new_version}{new_version} removals remain.version.delete_version using the 3-minor policy by default.reason plain text for runtime warnings.docs_reason for docs-only markdown text.reason and docs_reason.from typing import Annotated, Optional
from flet.utils.validation import V
class ExampleControl:
old_prop: Annotated[
Optional[str],
V.deprecated(
"new_prop",
version="0.17.0",
delete_version="0.20.0",
reason="Use new_prop instead.",
docs_reason="Use :attr:`new_prop` or [`new_prop`](../controls/examplecontrol.md#flet.ExampleControl.new_prop) instead.",
),
] = None
from flet.utils.deprecated import deprecated
class ExampleControl:
@deprecated(
reason="Use new_func instead.",
docs_reason="Use :meth:`new_func` or [`new_func()`](../controls/examplecontrol.md#flet.ExampleControl.new_func) instead.",
version="0.17.0",
delete_version="0.20.0",
)
def old_func(self):
...
from flet.utils.deprecated import deprecated_class
@deprecated_class(
reason="Use NewControl instead.",
docs_reason="Use :class:`~flet.NewControl` or [`NewControl`](../controls/newcontrol.md) instead.",
version="0.17.0",
delete_version="0.20.0",
)
class OldControl:
...
from flet.utils.deprecated import deprecated
class ExampleControl:
@property
@deprecated(
reason="Use new_value instead.",
docs_reason="Use :attr:`new_value` or [`new_value`](../controls/examplecontrol.md#flet.ExampleControl.new_value) instead.",
version="0.17.0",
delete_version="0.20.0",
)
def value(self):
...
reason vs docs_reasonreason.docs_reason; fallback is reason.reason to avoid noisy runtime output.docs_reasonIn docs_reason, use reST roles for simple references when the auto-derived label is
sufficient, and use Markdown links when you need more control over the displayed text.
See docs-conventions for details on supported cross-ref patterns and their syntax.
For supported patterns, docs should auto-render:
Deprecated admonition section,deprecated label/badge on the item.Do not duplicate with manual deprecation admonitions in docstrings unless there is a special case not covered by the extension.
Do not add one-off tests for every API that gets deprecated when it uses an
existing, already-tested pattern (V.deprecated, @deprecated, or
@deprecated_class). For routine deprecation metadata updates, rely on the
shared helper and docs extraction tests.
Add or update tests only when the change affects deprecation infrastructure or introduces meaningful new behavior, for example:
Prefer these locations for infrastructure tests:
sdk/python/packages/flet/tests/test_deprecated.pysdk/python/packages/flet/tests/test_griffe_deprecations.pysdk/python/packages/flet/tests/test_validation.py (for V.deprecated)reason.delete_version when a removal target is already known.docs_reason.