From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FE1345C0A; Tue, 29 Oct 2024 13:41:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B5904014F; Tue, 29 Oct 2024 13:41:43 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 33BFB40144 for ; Tue, 29 Oct 2024 13:41:42 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BC8813D5; Tue, 29 Oct 2024 05:42:11 -0700 (PDT) Received: from [10.57.58.134] (unknown [10.57.58.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 975493F73B; Tue, 29 Oct 2024 05:41:40 -0700 (PDT) Message-ID: Date: Tue, 29 Oct 2024 12:41:39 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/5] dts: use Pydantic in the configuration Content-Language: en-GB To: Nicholas Pratte Cc: dev@dpdk.org, Honnappa Nagarahalli , =?UTF-8?Q?Juraj_Linke=C5=A1?= , Paul Szczepanek References: <20240822163941.1390326-1-luca.vizzarro@arm.com> <20240822163941.1390326-4-luca.vizzarro@arm.com> From: Luca Vizzarro In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 30/09/2024 18:56, Nicholas Pratte wrote: >> +the YAML test run configuration file and validates it against the :class:`Configuration` Pydantic >> +dataclass model. The Pydantic model is also available as > > Out of curiosity, what is the reason for maintaining use of > dataclasses here as opposed to creating BaseModel subclasses for the > Pydantic library? I suppose both implementations would lead to the > same result, but is it mostly for the sake of familiarity and > consistency that we're still using dataclasses here? The original idea was as you said, familiarity and consistency, but it actually brings extra headaches and it's unnecessary. I've used BaseModel for everything in the newer versions. >> @unique >> -class TrafficGeneratorType(StrEnum): >> +class TrafficGeneratorType(str, Enum): >> """The supported traffic generators.""" >> >> #: >> - SCAPY = auto() >> + SCAPY = "SCAPY" > > Going off of Juraj's comments, would you be able to provide an deeper > explanation as how this new parameterization of str and enum works > with respect to the Pydantic field discriminators? This is something I am not able to explain unfortunately. For some reason – I am not 100% sure how Pydantic works in this case – the original implementation was incompatible with the discriminator. Retaining the original setup made Pydantic use values of: "" instead of plain "SCAPY", for some reason. So it's an incompatibility issue.