Skip to content

chore: optimize package contents for distribution#9

Merged
mldangelo merged 1 commit intomainfrom
chore/optimize-package-contents
Jan 6, 2026
Merged

chore: optimize package contents for distribution#9
mldangelo merged 1 commit intomainfrom
chore/optimize-package-contents

Conversation

@mldangelo
Copy link
Copy Markdown
Member

Summary

Optimizes the Python package distribution by excluding unnecessary files from the source distribution (sdist). This ensures users only download what they need.

Problem

Currently, the sdist includes many files that aren't needed by end users:

  • CI/CD workflows (.github/)
  • Test suite (tests/)
  • Developer documentation (AGENTS.md, CLAUDE.md)
  • Release automation configs (release-please-config.json, .release-please-manifest.json)
  • Dependency automation (renovate.json)
  • Development lock files (uv.lock)
  • Auto-generated changelog (CHANGELOG.md - tracked in GitHub releases)

Solution

Added [tool.hatch.build.targets.sdist] configuration to pyproject.toml to explicitly exclude these files.

Changes

Before:

promptfoo-0.2.0/.release-please-manifest.json
promptfoo-0.2.0/CHANGELOG.md
promptfoo-0.2.0/renovate.json
promptfoo-0.2.0/uv.lock
promptfoo-0.2.0/.github/CODEOWNERS
promptfoo-0.2.0/.github/workflows/release-please.yml
promptfoo-0.2.0/.github/workflows/test.yml
promptfoo-0.2.0/src/promptfoo/__init__.py
promptfoo-0.2.0/src/promptfoo/cli.py
promptfoo-0.2.0/tests/__init__.py
promptfoo-0.2.0/tests/test_cli.py
promptfoo-0.2.0/.gitignore
promptfoo-0.2.0/LICENSE
promptfoo-0.2.0/README.md
promptfoo-0.2.0/pyproject.toml

After:

promptfoo-0.2.0/src/promptfoo/__init__.py
promptfoo-0.2.0/src/promptfoo/cli.py
promptfoo-0.2.0/.gitignore
promptfoo-0.2.0/LICENSE
promptfoo-0.2.0/README.md
promptfoo-0.2.0/pyproject.toml
promptfoo-0.2.0/PKG-INFO

What's Included Now

Source Distribution (sdist):

  • src/promptfoo/ - Python source code
  • LICENSE - License file
  • README.md - User documentation
  • pyproject.toml - Required for building from source
  • PKG-INFO - Auto-generated package metadata

Wheel Distribution (unchanged):

  • promptfoo/ - Compiled Python code
  • promptfoo-X.Y.Z.dist-info/ - Package metadata

Benefits

  1. Smaller package size - Less data to download for users
  2. Cleaner distribution - Only essential files included
  3. Better separation - Developer tools stay in the repo, not in user installations
  4. Faster installs - Fewer files to extract and process
  5. Professional packaging - Follows Python packaging best practices

Testing

Built and verified both distributions:

$ uv build
Building source distribution...
Building wheel from source distribution...
Successfully built dist/promptfoo-0.2.0.tar.gz
Successfully built dist/promptfoo-0.2.0-py3-none-any.whl

$ tar -tzf dist/promptfoo-0.2.0.tar.gz
# Only essential files listed ✅

$ tar -tzf dist/promptfoo-0.2.0.tar.gz | grep -E "(\.github|tests|CHANGELOG|release-please|renovate|uv\.lock|AGENTS|CLAUDE)"
# No matches ✅ All excluded as expected

Notes

  • The wheel distribution was already optimal and remains unchanged
  • .gitignore is still included (minor, many projects include it)
  • This change only affects future releases (0.2.0 and later)
  • No impact on development workflow

🤖 Generated with Claude Code

Configure hatchling to exclude unnecessary files from the source
distribution (sdist). This reduces package size and ensures only
essential files are distributed to users.

Excluded from sdist:
- .github/ - CI/CD workflows and GitHub-specific configs
- tests/ - Test suite (not needed by end users)
- CHANGELOG.md - Auto-generated, tracked in GitHub releases
- AGENTS.md, CLAUDE.md - Developer documentation
- release-please-config.json - Release automation config
- .release-please-manifest.json - Release version tracking
- renovate.json - Dependency update automation
- uv.lock - Development lock file

The wheel (binary) distribution already only includes the necessary
Python code and is unchanged.

Before:
- sdist included ~15 files (tests, .github, configs, etc.)

After:
- sdist includes only 7 essential files (src/, LICENSE, README, pyproject.toml)
- wheel unchanged (still optimal with just Python code)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mldangelo mldangelo merged commit 1341fbb into main Jan 6, 2026
9 checks passed
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.

1 participant