Skip to content

tools: ynl: pyynl: pull the --family resolution logic into the lib

Jakub Kicinski netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied 2/2
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- fix the ethtool script (Donald)
- fix --family=X --validate (Clashiko)
v1: https://lore.kernel.org/[email protected]

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2tools: ynl: pyynl: re-export the library API from the package roottools/net/ynl/pyynl/__init__.py+9 -00 repliesApplied
2/2tools: ynl: pyynl: pull the --family resolution logic into the libtools/net/ynl/pyynl/cli.py tools/net/ynl/pyynl/lib/__init__.py tools/net/ynl/pyynl/lib/nlspec.py +3 more+102 -561 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJan StancekDonald Hunter
1/2A-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 0/2] tools: ynl: pyynl: pull the --family resolution logic into the lib

When packaging YNL as a system level utility we added a --family argument which auto-resolves the full spec path from a well known path in /usr/share. Spelling out full YAML spec files is at this point only done in-tree, for example in the selftests which need the very latest YAML. But the selftests have their own wrapping classes for each family so test authors aren't really bothered by having to spell the paths out.

Afford the same ease of use to the Python library users. Move the path resolution from the CLI code to the library. This simplifies the pyynl use by a lot:

from pyynl import YnlFamily

ynl = YnlFamily(family="netdev")

Unless I'm missing a trick, resolving the /usr/share path is hard enough for most users to lean towards shelling out to ynl CLI with --output-json, which is sad.

v2:
- fix the ethtool script (Donald)
- fix --family=X --validate (Clashiko)
v1: https://lore.kernel.org/[email protected]

Jakub Kicinski (2):
tools: ynl: pyynl: re-export the library API from the package root
tools: ynl: pyynl: pull the --family resolution logic into the lib

 tools/net/ynl/pyynl/__init__.py     |  9 +++++
 tools/net/ynl/pyynl/cli.py          | 56 +++++++----------------------
 tools/net/ynl/pyynl/lib/__init__.py |  3 +-
 tools/net/ynl/pyynl/lib/nlspec.py   | 22 ++++++++++--
 tools/net/ynl/pyynl/lib/specdir.py  | 51 ++++++++++++++++++++++++++
 tools/net/ynl/pyynl/lib/ynl.py      | 19 ++++++++--
 tools/net/ynl/tests/ethtool.py      |  7 +---
 7 files changed, 111 insertions(+), 56 deletions(-)
 create mode 100644 tools/net/ynl/pyynl/lib/specdir.py
Signature · 1 line
2.54.0