Skip to content

fix: include config directory in hatch build#54

Open
zza-830 wants to merge 4 commits into
TruFoundation:mainfrom
zza-830:fix/config-build-include
Open

fix: include config directory in hatch build#54
zza-830 wants to merge 4 commits into
TruFoundation:mainfrom
zza-830:fix/config-build-include

Conversation

@zza-830

@zza-830 zza-830 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The config manifest files (builtin_commands.md, plugins.md) in trushell/config/ are not listed in the hatch build include list. Hatchling will include them implicitly only if they fall under packages = ["trushell"], but the explicit include list may override that on some hatchling versions, causing a broken PyPI install where the kernel can't find any manifests.

Closes #48

Fix

Add trushell/config/* to the include list in pyproject.toml:

# Before
include = ["README.md", "LICENSE", "trushell/sounds/"]

# After
include = ["README.md", "LICENSE", "trushell/sounds/*", "trushell/config/*"]

Summary by CodeRabbit

  • Chores
    • Updated build configuration to include config files in the packaged distribution.
    • Enhanced test infrastructure to improve validation of help documentation.

The config manifest files (builtin_commands.md, plugins.md) in
trushell/config/ were not listed in the hatch build include list,
which could cause a broken PyPI install where the kernel can't find
any manifests.

Fix: add 'trushell/config/*' to the include list in pyproject.toml.

Closes TruFoundation#48
Ziang Zhang added 2 commits June 8, 2026 14:32
The test_run_help_prints_docstring_for_known_command test was failing
because the fake kernel lacked a _import_module method, causing the
module import to fail silently and fall through to the error message.

Add a working _fake_import_module that uses importlib to resolve
the module path, allowing run_help to read and print the docstring.
The  function referenced a bare name  that was
never imported or defined, causing a NameError crash on every invocation.

Fix: move  before the conditional block so it is
always defined when reached by the comparison at the end of the function.

Closes TruFoundation#40
@AkshajSinghal

Copy link
Copy Markdown
Collaborator

The argv fix and test mock updates are nice bonuses, but let’s clear that merge conflict in cli.py first (likely clashing with the recent shell injection hardening). Also, can you quickly verify the built .whl actually contains the config/ folder? Just want to be 100% sure Hatchling isn’t being tricky.

Fix the conflict and confirm the wheel contents, and I’ll merge. Great work keeping the packaging tight!

Take upstream's improved version that only lowercases the command name
(first argument) while preserving case of subsequent arguments (e.g.
filenames), instead of lowercasing the entire command string.
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cae3aa6-b24f-470f-bde0-3cd6b0afff89

📥 Commits

Reviewing files that changed from the base of the PR and between 7ab2e53 and 34b2597.

📒 Files selected for processing (2)
  • pyproject.toml
  • tests/test_help_docs.py

📝 Walkthrough

Walkthrough

Config manifest files are added to the Hatch build packaging to ensure distribution completeness. Test fixtures are updated with module import infrastructure to support verifying command documentation retrieval.

Changes

Config Directory Distribution and Test Infrastructure

Layer / File(s) Summary
Build packaging includes config directory
pyproject.toml
Hatch build include list now packages trushell/config/* files alongside README, LICENSE, and sounds assets to ensure config manifests are available in distributed packages.
Test module import support for help documentation
tests/test_help_docs.py
Test fixture adds importlib and _import_module helper to fake kernel initialization, enabling the help test to simulate importing command modules and verifying their docstrings.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

📦 A rabbit packs config files tight,
In hatch distribution, shiny and bright,
With test modules shimmer and import so true,
The config finds home—now users have clue! 🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive Changes to tests/test_help_docs.py appear related to supporting the config directory changes, though the PR title focuses only on the pyproject.toml modification. Clarify whether the test_help_docs.py changes are directly required for the config directory fix or represent scope creep beyond the pyproject.toml include list modification.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding the config directory to the hatch build include configuration in pyproject.toml.
Linked Issues check ✅ Passed The pull request addresses issue #48 by adding trushell/config/* to the include list in pyproject.toml, ensuring config manifest files are packaged in built distributions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Config directory trushell/config/ missing from hatch build include

2 participants