Skip to content

Integrate <desc> and <category> for JSON#155

Merged
tomschr merged 6 commits intomainfrom
toms/deliverable_groups
Feb 18, 2026
Merged

Integrate <desc> and <category> for JSON#155
tomschr merged 6 commits intomainfrom
toms/deliverable_groups

Conversation

@tomschr
Copy link
Copy Markdown
Contributor

@tomschr tomschr commented Feb 3, 2026

The <desc> and ` elements in the XML configuration contains language-specific descriptions. It is used in the index pages of each product release.

This PR integrate these elements into the JSON output (the keys descriptions and categories):

{
  "productname": "...",
  "acronym": "...",
  "version": "...",
  "lifecycle": "supported",
  "hide-productname": false,
  "descriptions": [
    {
      "lang": "en-us",
      "default": true,
      "description": "..."
    }
  ],
  "categories": [
    {
      "categoryId": "best-practice",
      "rank": 1, 
      "translations": [
        {
          "lang": "en-us",
          "default": true,
          "title": "Best practices"
        }
      ]
    }
  ]
}

This PR adds the missing handling of these elements.

  • Build Description model for Manifest
  • In Deliverable, create new methods (see below). They transform the <desc> element
    • all_categories: Return the categories of the deliverable.
    • categories: Return the categories from the product node.
    • categories_from_root: Return the categories from the root node.
  • For sub-models of Manifest, add serialization method (e.g., for lang attribute)
  • Improve test cases
  • Make Category.rank set automatically
  • Add translations to Category.translations

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Coverage Report

For commit dcd3511

Click to expand Coverage Report
  Name                                           Stmts   Miss Branch BrPart  Cover
  --------------------------------------------------------------------------------
+ src/docbuild/models/deliverable.py               180      1     22      0  99.5%
+ src/docbuild/cli/cmd_check/process.py             58      0     22      1  98.8%
+ src/docbuild/cli/cmd_cli.py                       93      1      8      1  98.0%
+ src/docbuild/utils/pidlock.py                     79      1     14      1  97.8%
+ src/docbuild/config/xml/stitch.py                 48      1     12      1  96.7%
+ src/docbuild/cli/cmd_validate/process.py         178      5     52      4  96.1%
+ src/docbuild/cli/callback.py                      35      0     10      2  95.6%
+ src/docbuild/cli/cmd_metadata/metaprocess.py     172     10     42      7  92.1%
- src/docbuild/cli/cmd_config/__init__.py            9      1      0      0  88.9%
- src/docbuild/cli/cmd_check/__init__.py            18      5      2      0  65.0%
- src/docbuild/cli/cmd_build/__init__.py            13      5      0      0  61.5%
- src/docbuild/cli/cmd_metadata/__init__.py         27     10      2      0  58.6%
- src/docbuild/cli/cmd_config/environment.py        11      6      2      0  38.5%
  --------------------------------------------------------------------------------
+ TOTAL                                           2840     46    646     17  98.0%
  
  47 files skipped due to complete coverage.

@tomschr tomschr force-pushed the toms/deliverable_groups branch 3 times, most recently from 63d3746 to d6a35b9 Compare February 9, 2026 13:27
@tomschr tomschr changed the title WIP: Add serialization of missing Description WIP: Integrate <desc> and <category> for JSON Feb 10, 2026
@tomschr tomschr force-pushed the toms/deliverable_groups branch 2 times, most recently from 8092473 to 93c4776 Compare February 16, 2026 15:54
@tomschr tomschr requested a review from sushant-suse February 16, 2026 15:56
@tomschr tomschr changed the title WIP: Integrate <desc> and <category> for JSON Integrate <desc> and <category> for JSON Feb 16, 2026
@tomschr tomschr marked this pull request as ready for review February 16, 2026 15:56
Comment thread docs/source/reference/_autoapi/docbuild/models/manifest/Category.rst Outdated
@sushant-suse
Copy link
Copy Markdown
Collaborator

sushant-suse commented Feb 17, 2026

The <desc> and ` elements in the XML configuration contains language-specific descriptions. It is used in the index pages of each product release.

[...]

Hi @tomschr, thanks for the great work.

The PR successfully implements the extraction and serialization of localized descriptions and categories from the XML configuration into the JSON manifest. The architecture is robust, particularly in how it handles the inheritance of categories from both the product and root nodes.

I noticed that Category.rank uses a class-level counter (ClassVar). While this works perfectly for individual manifest builds (as verified in the tests by resetting the counter), we should keep in mind that in a long-running process handling multiple products, the rank will increment globally across all products. If we want the rank to reset to 1 for every new JSON file, we may need a minor reset call in the metaprocess.py loop in a future task. WDYT?

Overall, this is a great addition to the metadata pipeline. LGTM.

@tomschr
Copy link
Copy Markdown
Contributor Author

tomschr commented Feb 17, 2026

I noticed that Category.rank uses a class-level counter (ClassVar). While this works perfectly for individual manifest builds (as verified in the tests by resetting the counter), we should keep in mind that in a long-running process handling multiple products, the rank will increment globally across all products

Ahh, good point! Haven't thought about this. Yes, I've added it to "number" the categories so I can avoid any arbitrary attribute or element.

If we want the rank to reset to 1 for every new JSON file, we may need a minor reset call in the metaprocess.py loop in a future task.

That sounds like a good idea! I will investigate that.

tomschr and others added 4 commits February 18, 2026 12:42
The `<desc>` element in the XML configuration contains language-specific
descriptions. It is used in the index pages of each product release.

This PR adds the missing handling of this element.

* Build `Description` model for `Manifest`
* In `Deliverable`, create new methods (see below). They transform the
  `<desc>` element
  * `all_categories`: Return the categories of the deliverable.
  * `categories`: Return the categories from the product node.
  * `categories_from_root`: Return the categories from the root node.
* For submodels of `Manifest`, add serialization method (e.g., for `lang` attribute)
* Improve test cases
* Update doc sources of auto API
* Make `Category.rank` set automatically
* Add translations to `Category.translations`
@tomschr tomschr force-pushed the toms/deliverable_groups branch from 109fa25 to 0b21971 Compare February 18, 2026 11:43
@tomschr tomschr force-pushed the toms/deliverable_groups branch from 0b21971 to 1cbd4eb Compare February 18, 2026 11:44
@tomschr tomschr merged commit 0ab85cc into main Feb 18, 2026
9 checks passed
@tomschr tomschr deleted the toms/deliverable_groups branch February 18, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants