Skip to content

fix(packaging): include .config and .json data files in wheel - #124

Closed
0x5t4l1n wants to merge 1 commit into
intel:mainfrom
0x5t4l1n:fix/include-config-files-in-wheel
Closed

0x5t4l1n wants to merge 1 commit into
intel:mainfrom
0x5t4l1n:fix/include-config-files-in-wheel

Conversation

@0x5t4l1n

Copy link
Copy Markdown

Summary

Fixes #97.

Importing any xmlcli module that loads the config at import time (e.g. xmlcli.modules.nvram) raises configparser.NoSectionError: No section: 'GENERAL_SETTINGS' when xmlcli is installed from a wheel.

Root cause

The project uses poetry-core as its build backend ([build-system] in pyproject.toml). Poetry's build backend does not read setup.cfg or MANIFEST.in, so the non-Python data files (xmlcli.config, messages.json, everything under cfg/) are silently omitted from the wheel even though MANIFEST.in lists them for sdist builds.

Fix

Add an explicit include list to [tool.poetry] so Poetry bundles the required data files in both the sdist and the wheel:

[tool.poetry]
packages = [{include = "xmlcli", from = "src"}]
include = [
    {path = "src/xmlcli/xmlcli.config", format = ["sdist", "wheel"]},
    {path = "src/xmlcli/messages.json",  format = ["sdist", "wheel"]},
    {path = "src/xmlcli/cfg/**/*",       format = ["sdist", "wheel"]},
]

Verification

python -m build          # build the wheel
pip install dist/*.whl   # install from wheel
python -c "import xmlcli.modules.nvram"  # no longer raises NoSectionError

The build backend is poetry-core, which does not read setup.cfg or
MANIFEST.in. As a result, xmlcli.config and messages.json were absent
from the built wheel, causing a NoSectionError on import of any module
that reads the config at load time (e.g. xmlcli.modules.nvram).

Add an explicit 'include' list to [tool.poetry] so that:
  - src/xmlcli/xmlcli.config
  - src/xmlcli/messages.json
  - src/xmlcli/cfg/**  (all supporting config data)

are bundled in both the sdist and the wheel.

Fixes intel#97

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A clean wheel build and install is needed to verify poetry-core’s resource placement and the nvram import, which cannot be validated in the dependency-free review environment.

No open issues 🎉

What changed in this PR

Addresses #97 by updating Poetry’s packaging configuration to include runtime data needed by wheel-installed modules such as xmlcli.modules.nvram.

Changes:

  • Explicitly includes xmlcli.config, messages.json, and cfg/**/* in both source and wheel distributions.
  • Adds comments explaining why the package-data entries are needed.
File Description
pyproject.toml Adds explicit Poetry inclusion rules for runtime configuration and data files.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The added packaging block is redundant and does not change wheel contents or fix #97, leaving a misleading comment and the actual cause of the missing files unresolved.

1 open issue

Review effort: Max

Comment thread pyproject.toml
Comment on lines +33 to +40
# Include non-Python data files that the package reads at runtime.
# Poetry's build backend ignores setup.cfg/MANIFEST.in, so these must be
# listed here to be bundled in the wheel (fixes #97).
include = [
{path = "src/xmlcli/xmlcli.config", format = ["sdist", "wheel"]},
{path = "src/xmlcli/messages.json", format = ["sdist", "wheel"]},
{path = "src/xmlcli/cfg/**/*", format = ["sdist", "wheel"]},
]
@0x5t4l1n

0x5t4l1n commented Dec 3, 2026

Copy link
Copy Markdown
Author

Thanks @copilot, you were right. I built the package both ways on current main (without this PR), using python -m build (sdist, then wheel from the sdist) and python -m build --wheel. In both cases the wheel already contains xmlcli/xmlcli.config and xmlcli/messages.json, and the sdist contains src/xmlcli/xmlcli.config. Adding the include block gives an identical wheel (86 files in both builds), so this PR does not change the output and does not fix #97.

The report in #97 is for 2.2.6 installed under /usr/lib/python3/dist-packages, so it is probably a distro or different-version build rather than the Poetry build in this repo. I'm closing this PR rather than leaving a redundant block and a misleading comment. If #97 can be reproduced from a specific build command and version, I'm happy to look again.

@0x5t4l1n 0x5t4l1n closed this Dec 3, 2026
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.

[BUG] xmlcli 2.2.6 doesn't include xmlcli.config when built as wheel

2 participants