-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Branch: feat/804-exclude-tests-from-wheels
Summary
Test packages and testing utilities are currently being included in the wheel distribution, accounting for 23.5% (567KB of 2.4MB) of the package size. This unnecessarily increases the distribution size and exposes internal testing code to end users. The wheel should only contain production code needed to run HARP.
Context
HARP uses Hatchling as its build backend, configured in pyproject.toml. The current wheel build configuration includes entire harp and harp_apps directories without excluding test-related files:
-
Test directories found: 132 test-related files across multiple locations
*/tests/directories in harp and harp_apps modulesharp/utils/testing/andharp_apps/storage/utils/testing/utility modules- Test fixtures, snapshots, and conftest.py files
-
Impact: Increases wheel size by ~567KB (23.5% of total)
-
Security consideration: Exposes internal testing utilities and fixtures
The testing utilities in harp.utils.testing are only used internally for HARP development and are not needed by end users or plugin developers.
Input
Current pyproject.toml wheel configuration:
[tool.hatch.build.targets.wheel]
include = [
"harp",
"harp_apps",
]
exclude = [
"**/node_modules/",
"harp_apps/dashboard/frontend",
]Output and Testing Scenarios
Expected Output:
- Wheel package contains only production code
- Wheel size reduced by approximately 567KB
- No test files or testing utilities in the distribution
Testing Scenarios:
- Happy Path: Build wheel, verify no test files included, install and run HARP successfully
- Package integrity: Verify all production code still included and functional
- Developer experience: Confirm tests still run correctly from source checkout
Possible Implementation
Add exclude patterns to pyproject.toml for the wheel target:
[tool.hatch.build.targets.wheel]
include = [
"harp",
"harp_apps",
]
exclude = [
"**/node_modules/",
"harp_apps/dashboard/frontend",
"**/tests/",
"**/test_*.py",
"**/*_test.py",
"**/testing/",
"**/conftest.py",
"**/__pycache__/",
"**/*.pyc",
"**/__snapshots__/",
]This approach:
- Uses glob patterns to exclude all test-related directories and files
- Maintains the simple include/exclude structure
- Covers all common test file naming conventions
- Also excludes Python cache files for cleaner distributions
Current Challenges
- Need to verify that all test patterns are covered
- Must ensure no production code is accidentally excluded
- Should validate that the wheel still installs and functions correctly after exclusion