Skip to content

fix: setuptools package discovery picks up build/ — use an include allow-list #194

Closed

Description

@Jammy2211

Overview

[tool.setuptools.packages.find] in seven library pyproject.toml files has only an exclude list. Any directory with an __init__.py gets packaged, so each local pip install . / python -m build re-packages the previous build/ one level deeper (build/lib/build/lib/…); autonerves.egg-info/top_level.txt lists build. Also, exclude = ["docs"] excludes only the top-level name, so the published autofit-2026.10.4.1 wheel installs stray top-level docs/, files/, paper/ and scripts/ directories into site-packages (105 files). An include allow-list, mirroring PyAutoHeart (include = ["heart*"]), fixes both.

Plan

  • Add include = ["<pkg>*"] to [tool.setuptools.packages.find] in each library, keeping the existing excludes (tests stay out).
  • Add build/ to PyAutoLens's .gitignore, which is the only one that doesn't ignore it.
  • Build a wheel per repo into a scratch dir and confirm its top level is only <pkg>/ + *.dist-info, with no build/ left in the repo.
  • Confirm imports still work, then refresh the stale PyAutoNerves editable-install egg-info.
  • Ship one PR per library repo in library order (Nerves → Array → Fit → Galaxy → Lens, then CTI, Reduce).

Tier: judge — merge mode: human /prm

Detailed implementation plan

Work Classification

Library

Affected Repositories

  • PyAutoNerves (primary) — include = ["autonerves*"]
  • PyAutoArray — include = ["autoarray*"]
  • PyAutoFit — include = ["autofit*"] (drops the stray scripts/ top-level package from the wheel)
  • PyAutoGalaxy — include = ["autogalaxy*"]
  • PyAutoLens — include = ["autolens*"] + .gitignore build/
  • PyAutoCTI — include = ["autocti*"]
  • PyAutoReduce — include = ["autoreduce*"]

Branch Survey

All seven main checkouts are on main and clean. Claims were reviewed with worktree_check_conflict: Nerves is held by dashboard-section-disclosures; Array, Fit, Galaxy and Lens are held by community-pages and scribbler-wave2, both awaiting release. The human authorised coordination on 2026-10-07; this task touches pyproject.toml/.gitignore only, on separate branches.

Suggested branch: feature/setuptools-include-packages
Worktree root: ~/Code/PyAutoLabs-wt/setuptools-include-packages/

Implementation Steps

  1. In each pyproject.toml, add include = ["<pkg>*"] above the existing exclude in [tool.setuptools.packages.find].
  2. Add build/ to lens/PyAutoLens/.gitignore.
  3. Run python -m build --wheel --outdir <scratch> per repo; list the wheel's top-level entries and delete any build/ this creates.
  4. Import check per package; run the existing unit tests as the ship gate.
  5. In the PyAutoNerves main checkout, regenerate autonerves.egg-info (legacy editable) so top_level.txt is just autonerves.

Key Files

  • <repo>/pyproject.toml — [tool.setuptools.packages.find]
  • lens/PyAutoLens/.gitignore

Original Prompt

Click to expand starting prompt

See PyAutoMind active/setuptools_include_packages.md (request copied verbatim there).

Activity

  1. Jammy2211 commented on Oct 7, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped

    All seven PRs merged 2026-10-07 (library order):

    setuptools package discovery now uses an include allow-list, so build/ (and other stray top-level dirs) can no longer be picked up as packages. For autofit this also removes the stray top-level docs/, files/, paper/ and scripts/ from the published wheel. Nerves/Array/Fit/Galaxy/Lens are pending release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions