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 947DF43D6D; Thu, 28 Mar 2024 17:48:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 213E7402E7; Thu, 28 Mar 2024 17:48:36 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 188F2402D8 for ; Thu, 28 Mar 2024 17:48:35 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-29f1686ff12so933983a91.1 for ; Thu, 28 Mar 2024 09:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1711644514; x=1712249314; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hZ/v8+nma9+xO11I1tUp7A/P8tvkfrrwLbQAnW74aYo=; b=LTb6zWtlyUMa5i/dFg0W9GO2v03I+ZVHrmDS32rtJeanPyZj5ec9OylWuDV2YdVzMB GI0Uhye4WVh5SookMn542z0vv2xQtjqbyIkSO5IxnS/yaWuDKxCwuDR1UY+Ioz4arzZg Jjqjr+Ks4+wxY7TkflcbLwCl98B7qTmfI8wHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711644514; x=1712249314; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZ/v8+nma9+xO11I1tUp7A/P8tvkfrrwLbQAnW74aYo=; b=W1zYrGz/9cjVOiry8oJsiraEaQUKiEs7juXPCLrDTRAEWmdQKWuM5wW/g5sHUhIP+x CdMnhkm1fTB5rX5GdeIgUE5rAGnBpkztQIOPnr5mMcta36/q8UCG/uVBdihRF8/URQY0 mY610FdxRL62eBJDG5UJnaLDm5epjxfp8g6AItKr+HcLXBVhOLtP8xYMwmuj2JkpbK5N c3IfymfwtJTEKBxZvm0h1dfjZaMvt5c9fBRAXs58FKzrSZE+IwhYWe3Nm0x1N1OOu7eP gJ/qnFBvIOBpatnOy0Ocq/BLfz5zEFU8wyOqcpYOsA8cSyxoi8txUZQbhhaKxS9BoyrN Ie9Q== X-Gm-Message-State: AOJu0Yz9jqnNIZq0PAKsVuctIEk0mXCjMyXa9Lt3ghF0aZwYIiBAcmOj svRg/kBEn6u7akBNffqMWvO/hn9Jc85x2uGD5wTkpneTl92h656ZS6DJ4eaTTkKIuz5I19UfS+u QZNd/RifatUzoHbIL+i4fhtRj4EcE2rxZjBlh08bsWcfDEAyZ X-Google-Smtp-Source: AGHT+IFpouD+qog/vIRgKLIX0Yzy0NlJ4J9JuKi6KrZcbVD4kJBQqm4GYpfqMTAtXZchjOLNbOnrXL5dM+G5+kqHzDM= X-Received: by 2002:a17:90a:4a8b:b0:2a0:8d1a:d44d with SMTP id f11-20020a17090a4a8b00b002a08d1ad44dmr3234231pjh.36.1711644514205; Thu, 28 Mar 2024 09:48:34 -0700 (PDT) MIME-Version: 1.0 References: <20240326190422.577028-1-luca.vizzarro@arm.com> <20240326190422.577028-2-luca.vizzarro@arm.com> In-Reply-To: <20240326190422.577028-2-luca.vizzarro@arm.com> From: Jeremy Spewock Date: Thu, 28 Mar 2024 12:48:23 -0400 Message-ID: Subject: Re: [PATCH 1/6] dts: add parameters data structure To: Luca Vizzarro Cc: dev@dpdk.org, =?UTF-8?Q?Juraj_Linke=C5=A1?= , Jack Bond-Preston , Honnappa Nagarahalli Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Overall I like the idea of having a structured way of passing command-line arguments to applications as strings and I think that this is a well-abstracted approach. I also like that this approach still supports the ability to pass strings "as-is" and use them as parameters as well. That opens the door for potentially creating dataclasses which only detail key-parameters that we assume you will use, without blocking you from inputting whatever you want. On Tue, Mar 26, 2024 at 3:04=E2=80=AFPM Luca Vizzarro wrote: > +META_VALUE_ONLY =3D "value_only" > +META_OPTIONS_END =3D "options_end" > +META_SHORT_NAME =3D "short_name" > +META_LONG_NAME =3D "long_name" > +META_MULTIPLE =3D "multiple" > +META_MIXINS =3D "mixins" > + > + I might add some kind of block comment here as a separator that delimits that metadata modifiers start here. Something like what is written in scapy.py which creates sections for XML-RPC method vs ones that are run by the docker container. This isn't something strictly necessary, but it might help break things up and add a little more explanation. > +def value_only(metadata: dict[str, Any] =3D {}) -> dict[str, Any]: > + """Injects the value of the attribute as-is without flag. Metadata m= odifier for :func:`dataclasses.field`.""" > + return {**metadata, META_VALUE_ONLY: True} > + > + You could do the same thing here for mixins, but again, I'm not sure it's really necessary. > +def field_mixins(*mixins: Mixin, metadata: dict[str, Any] =3D {}) -> dic= t[str, Any]: > + """Takes in a variable number of mixins to manipulate the value's re= ndering. Metadata modifier for :func:`dataclasses.field`. > + > + The ``metadata`` keyword argument can be used to chain metadata modi= fiers together. > + > + Mixins can be chained together, executed from right to left in the a= rguments list order. > + > + Example: > + > + .. code:: python > + > + hex_bitmask: int | None =3D field(default=3D0b1101, metadata=3Df= ield_mixins(hex, metadata=3Dparam_name("mask"))) > + > + will render as ``--mask=3D0xd``. The :func:`hex` built-in can be use= d as a mixin turning a valid integer into a hexadecimal representation. > + """ > + return {**metadata, META_MIXINS: mixins} > 2.34.1 >