• Bug#1104654: litestar: FTBFS: E DeprecationWarning: Use of deprecated p

    From Santiago Vila@21:1/5 to All on Sun May 4 01:40:03 2025
    Package: src:litestar
    Version: 2.15.2-1
    Severity: serious
    Tags: ftbfs trixie sid

    Dear maintainer:

    During a rebuild of all packages in unstable, your package failed to build:

    --------------------------------------------------------------------------------
    [...]
    docs/examples/testing/test_get_session_data_async.py . [ 99%] docs/examples/testing/test_health_check_async.py . [ 99%] docs/examples/testing/test_health_check_sync.py . [ 99%] docs/examples/testing/test_set_session_data.py . [ 99%] docs/examples/testing/test_set_session_data_async.py . [ 99%] docs/examples/testing/test_websocket.py . [100%]

    =================================== FAILURES ===================================
    ___________________________ test_create_examples[v1] ___________________________

    pydantic_version = 'v1'

    def test_create_examples(pydantic_version: PydanticVersion) -> None:
    lib = pydantic_v1 if pydantic_version == "v1" else pydantic_v2

    class Model(lib.BaseModel): # type: ignore[name-defined, misc]
    foo: str = lib.Field(examples=["32"])
    bar: str

    @get("/example")
    async def handler() -> Model:
    return Model(foo="1", bar="2")

    app = Litestar(
    [handler],
    openapi_config=OpenAPIConfig(
    title="Test",
    version="0",
    create_examples=True,
    ),
    )
    schema = app.openapi_schema.to_schema()

    tests/unit/test_plugins/test_pydantic/test_openapi.py:584:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ litestar/app.py:674: in openapi_schema
    return self.plugins.get(OpenAPIPlugin).provide_openapi() litestar/_openapi/plugin.py:94: in provide_openapi
    self._openapi = self._build_openapi()
    litestar/_openapi/plugin.py:83: in _build_openapi
    path_item = create_path_item_for_route(context, route) litestar/_openapi/path_item.py:139: in create_path_item_for_route
    return path_item_factory.create_path_item() litestar/_openapi/path_item.py:44: in create_path_item
    operation = self.create_operation_for_handler_method(route_handler, HttpMethod(http_method))
    litestar/_openapi/path_item.py:73: in create_operation_for_handler_method
    responses = create_responses_for_handler( litestar/_openapi/responses.py:340: in create_responses_for_handler
    return ResponseFactory(context, route_handler).create_responses(raises_validation_error=raises_validation_error)
    litestar/_openapi/responses.py:91: in create_responses
    str(self.route_handler.status_code): self.create_success_response(), litestar/_openapi/responses.py:150: in create_success_response
    result = self.schema_creator.for_field_definition(field_def) litestar/_openapi/schema_generation/schema.py:315: in for_field_definition
    result = self.for_plugin(field_definition, plugin_for_annotation) litestar/_openapi/schema_generation/schema.py:499: in for_plugin
    schema = plugin.to_openapi_schema(field_definition=field_definition, schema_creator=self)
    litestar/plugins/pydantic/plugins/schema.py:247: in to_openapi_schema
    return self.for_pydantic_model(field_definition=field_definition, schema_creator=schema_creator)
    litestar/plugins/pydantic/plugins/schema.py:264: in for_pydantic_model
    return schema_creator.create_component_schema( litestar/_openapi/schema_generation/schema.py:663: in create_component_schema
    schema.properties = {k: self.for_field_definition(v) for k, v in property_fields.items()}
    litestar/_openapi/schema_generation/schema.py:345: in for_field_definition
    return self.process_schema_result(field_definition, result) if isinstance(result, Schema) else result
    litestar/_openapi/schema_generation/schema.py:625: in process_schema_result
    schema.examples = get_json_schema_formatted_examples(create_examples_for_field(field))
    litestar/_openapi/schema_generation/examples.py:80: in create_examples_for_field
    field_meta = _create_field_meta(replace(field, annotation=_normalize_example_value(field.annotation)))
    litestar/_openapi/schema_generation/examples.py:62: in _create_field_meta
    return FieldMeta.from_type( /usr/lib/python3/dist-packages/polyfactory/field_meta.py:132: in from_type
    check_for_deprecated_parameters( /usr/lib/python3/dist-packages/polyfactory/utils/deprecation.py:141: in check_for_deprecated_parameters
    warn_deprecation(
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    version = '2.11.0', deprecated_name = 'random', kind = 'parameter'

    def warn_deprecation(
    version: str,
    deprecated_name: str,
    kind: DeprecatedKind,
    *,
    removal_in: str | None = None,
    alternative: str | None = None,
    info: str | None = None,
    pending: bool = False,
    ) -> None:
    """Warn about a call to a (soon to be) deprecated function.

    Args:
    version: Polyfactory version where the deprecation will occur.
    deprecated_name: Name of the deprecated function.
    removal_in: Polyfactory version where the deprecated function will be removed.
    alternative: Name of a function that should be used instead.
    info: Additional information.
    pending: Use ``PendingDeprecationWarning`` instead of ``DeprecationWarning``.
    kind: Type of the deprecated thing.
    """
    parts = []

    if kind == "import":
    access_type = "Import of"
    elif kind in {"function", "method"}:
    access_type = "Call to"
    else:
    access_type = "Use of"

    if pending:
    parts.append(f"{access_type} {kind} awaiting deprecation {deprecated_name!r}")
    else:
    parts.append(f"{access_type} deprecated {kind} {deprecated_name!r}")

    parts.extend(
    (
    f"Deprecated in polyfactory {version}",
    f"This {kind} will be removed in {removal_in or 'the next major version'}",
    )
    )
    if alternative:
    parts.append(f"Use {alternative!r} instead")

    if info:
    parts.append(info)

    text = ". ".join(parts)
    warning_class = PendingDeprecationWarning if pending else DeprecationWarning

    warn(text, warning_class, stacklevel=2)
    E DeprecationWarning: Use of deprecated parameter 'random'. Deprecated in polyfactory 2.11.0. This parameter will be removed in the next major version

    /usr/lib/python3/dist-packages/polyfactory/utils/deprecation.py:68: DeprecationWarning
    ___________________________ test_create_examples[v2] ___________________________

    pydantic_version = 'v2'

    def test_create_examples(pydantic_version: PydanticVersion) -> None:
    lib = pydantic_v1 if pydantic_version == "v1" else pydantic_v2

    class Model(lib.BaseModel): # type: ignore[name-defined, misc]
    foo: str = lib.Field(examples=["32"])
    bar: str

    @get("/example")
    async def handler() -> Model:
    return Model(foo="1", bar="2")

    app = Litestar(
    [handler],
    openapi_config=OpenAPIConfig(
    title="Test",
    version="0",
    create_examples=True,
    ),
    )
    schema = app.openapi_schema.to_schema()

    tests/unit/test_plugins/test_pydantic/test_openapi.py:584:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ litestar/app.py:674: in openapi_schema
    return self.plugins.get(OpenAPIPlugin).provide_openapi() litestar/_openapi/plugin.py:94: in provide_openapi
    self._openapi = self._build_openapi()
    litestar/_openapi/plugin.py:83: in _build_openapi
    path_item = create_path_item_for_route(context, route) litestar/_openapi/path_item.py:139: in create_path_item_for_route
    return path_item_factory.create_path_item() litestar/_openapi/path_item.py:44: in create_path_item
    operation = self.create_operation_for_handler_method(route_handler, HttpMethod(http_method))
    litestar/_openapi/path_item.py:73: in create_operation_for_handler_method
    responses = create_responses_for_handler( litestar/_openapi/responses.py:340: in create_responses_for_handler
    return ResponseFactory(context, route_handler).create_responses(raises_validation_error=raises_validation_error)
    litestar/_openapi/responses.py:91: in create_responses
    str(self.route_handler.status_code): self.create_success_response(), litestar/_openapi/responses.py:150: in create_success_response
    result = self.schema_creator.for_field_definition(field_def) litestar/_openapi/schema_generation/schema.py:315: in for_field_definition
    result = self.for_plugin(field_definition, plugin_for_annotation) litestar/_openapi/schema_generation/schema.py:499: in for_plugin
    schema = plugin.to_openapi_schema(field_definition=field_definition, schema_creator=self)
    litestar/plugins/pydantic/plugins/schema.py:247: in to_openapi_schema
    return self.for_pydantic_model(field_definition=field_definition, schema_creator=schema_creator)
    litestar/plugins/pydantic/plugins/schema.py:264: in for_pydantic_model
    return schema_creator.create_component_schema( litestar/_openapi/schema_generation/schema.py:663: in create_component_schema
    schema.properties = {k: self.for_field_definition(v) for k, v in property_fields.items()}
    litestar/_openapi/schema_generation/schema.py:345: in for_field_definition
    return self.process_schema_result(field_definition, result) if isinstance(result, Schema) else result
    litestar/_openapi/schema_generation/schema.py:625: in process_schema_result
    schema.examples = get_json_schema_formatted_examples(create_examples_for_field(field))
    litestar/_openapi/schema_generation/examples.py:80: in create_examples_for_field
    field_meta = _create_field_meta(replace(field, annotation=_normalize_example_value(field.annotation)))
    litestar/_openapi/schema_generation/examples.py:62: in _create_field_meta
    return FieldMeta.from_type( /usr/lib/python3/dist-packages/polyfactory/field_meta.py:132: in from_type
    check_for_deprecated_parameters( /usr/lib/python3/dist-packages/polyfactory/utils/deprecation.py:141: in check_for_deprecated_parameters
    warn_deprecation(
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    version = '2.11.0', deprecated_name = 'random', kind = 'parameter'

    def warn_deprecation(
    version: str,
    deprecated_name: str,
    kind: DeprecatedKind,
    *,
    removal_in: str | None = None,
    alternative: str | None = None,
    info: str | None = None,
    pending: bool = False,
    ) -> None:
    """Warn about a call to a (soon to be) deprecated function.

    Args:
    version: Polyfactory version where the deprecation will occur.
    deprecated_name: Name of the deprecated function.
    removal_in: Polyfactory version where the deprecated function will be removed.
    alternative: Name of a function that should be used instead.
    info: Additional information.
    pending: Use ``PendingDeprecationWarning`` instead of ``DeprecationWarning``.
    kind: Type of the deprecated thing.
    """
    parts = []

    if kind == "import":
    access_type = "Import of"
    elif kind in {"function", "method"}:
    access_type = "Call to"
    else:
    access_type = "Use of"

    if pending:
    parts.append(f"{access_type} {kind} awaiting deprecation {deprecated_name!r}")
    else:
    parts.append(f"{access_type} deprecated {kind} {deprecated_name!r}")

    parts.extend(
    (
    f"Deprecated in polyfactory {version}",
    f"This {kind} will be removed in {removal_in or 'the next major version'}",
    )
    )
    if alternative:
    parts.append(f"Use {alternative!r} instead")

    if info:
    parts.append(info)

    text = ". ".join(parts)
    warning_class = PendingDeprecationWarning if pending else DeprecationWarning

    warn(text, warning_class, stacklevel=2)
    E DeprecationWarning: Use of deprecated parameter 'random'. Deprecated in polyfactory 2.11.0. This parameter will be removed in the next major version

    /usr/lib/python3/dist-packages/polyfactory/utils/deprecation.py:68: DeprecationWarning
    =============================== warnings summary ===============================
    tests/unit/test_concurrency.py::test_trio_uses_limiter
    /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=1, type=1, proto=0>

    Traceback (most recent call last):
    File "/usr/lib/python3.13/unittest/mock.py", line 459, in __new__
    instance = _safe_super(NonCallableMock, cls).__new__(new)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
    ResourceWarning: unclosed <socket.socket fd=22, family=1, type=1, proto=0>

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

    tests/unit/test_connection/test_base.py::test_connection_base_properties
    /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=1, type=1, proto=0>

    Traceback (most recent call last):
    File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_litestar/build/litestar/handlers/base.py", line 319, in resolve_layered_parameters
    parameter_kwargs.update(getattr(layer, "parameters", {}) or {})
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
    ResourceWarning: unclosed <socket.socket fd=16, family=1, type=1, proto=0>

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

    tests/unit/test_contrib/test_htmx/test_htmx_request.py::test_triggering_event_bad_json
    /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=1, type=1, proto=0>

    Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/anyio/_backends/_asyncio.py", line 715, in __init__
    self._tasks: set[asyncio.Task] = set()
    ~~~^^
    ResourceWarning: unclosed <socket.socket fd=13, family=1, type=1, proto=0>

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

    -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================
    FAILED tests/unit/test_plugins/test_pydantic/test_openapi.py::test_create_examples[v1]
    FAILED tests/unit/test_plugins/test_pydantic/test_openapi.py::test_create_examples[v2]
    = 2 failed, 4641 passed, 3 skipped, 23 deselected, 1 xfailed, 3 warnings in 64.02s (0:01:04) =
    <sys>:0: ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fccec7f9e40>
    <sys>:0: ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fccf0a60c70>
    <sys>:0: ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fccee9107c0>
    <sys>:0: ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fccd016c310>
    E: pybuild pybuild:389: test: plugin pyproject failed with: [too-long-redacted] rtal and not test_with_stores '
    dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.13 returned exit code 13
    make: *** [debian/rules:32: binary] Error 25
    dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2 --------------------------------------------------------------------------------

    The above is just how the build ends and not necessarily the most relevant part.
    If required, the full build log is available here:

    https://people.debian.org/~sanvila/build-logs/202505/

    About the archive rebuild: The build was made on virtual machines from AWS, using sbuild and a reduced chroot with only build-essential packages.

    If you could not reproduce the bug please contact me privately, as I
    am willing to provide ssh access to a virtual machine where the bug is
    fully reproducible.

    If this is really a bug in one of the build-depends, please use
    reassign and add an affects on src:litestar, so that this is still
    visible in the BTS web page for this package.

    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Debian Bug Tracking System@21:1/5 to All on Sun May 4 13:00:01 2025
    This is a multi-part message in MIME format...

    Your message dated Sun, 04 May 2025 10:49:48 +0000
    with message-id <[email protected]>
    and subject line Bug#1104654: fixed in litestar 2.15.2-2
    has caused the Debian Bug report #1104654,
    regarding litestar: FTBFS: E DeprecationWarning: Use of deprecated parameter 'random'.
    to be marked as done.

    This means that you claim that the problem has been dealt with.
    If this is not the case it is now your responsibility to reopen the
    Bug report if necessary, and/or fix the problem forthwith.

    (NB: If you are a system administrator and have no idea what this
    message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected]
    immediately.)


    --
    1104654: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1104654
    Debian Bug Tracking System
    Contact [email protected] with problems

    Received: (at submit) by bugs.debian.org; 3 May 2025 23:29:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.6-bugs.debian.org_2005_01_02
    (2021-04-09) on buxtehude.debian.org
    X-Spam-Level:
    X-Spam-Status: No, score=-121.7 required=4.0 tests=ALL_TRUSTED,BAYES_00,
    BODY_INCLUDES_PACKAGE,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,
    DKIM_VALID_AU,DKIM_VALID_EF,FROMDEVELOPER,HAS_PACKAGE,SPF_HELO_PASS,
    SPF_NONE,USER_IN_DKIM_WELCOMELIST,USER_IN_DKIM_WHITELIST,X_DEBBUGS_CC
    autolearn=ham autolearn_force=no
    version=3.4.6-bugs.debian.org_2005_01_02
    X-Spam-Bayes: score:0.0000 Tokens: new, 136; hammy, 150; neutral, 371; spammy,
    0. spammytokens: hammytokens:0.000-+--python3, 0.000-+--trixie,
    0.000-+--pkgbuilddir, 0.000-+--PKGBUILDDIR, 0.000-+--H*F:U*sanvila Return-path: <[email protected]>
    Received: from mailly.debian.org ([2001:41b8:202:deb:6564:a62:52c3:4b72]:5