pypa / build

A simple, correct Python build frontend

Home Page:https://build.pypa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`build --sdist` propagating `egg.info/SOURCES.txt` despite being excluded via `MANIFEST.in`

jamesbraza opened this issue · comments

I have a MANIFEST.in that looks like this:

# Ignore .gitignore and requirements files
exclude [.r]*
# Ignore .github and tests directories
recursive-exclude [.t]* *
# Exclude all eggs
global-exclude *.egg-info/*

When I editably install, its SOURCES.txt looks like this, and it looks great:

LICENSE
MANIFEST.in
README.md
pyproject.toml
src/package/__init__.py
src/package/foo.py
src/package/py.typed

Next, when I run python -m build --sdist, I get the following output:

* Creating isolated environment: virtualenv+pip...
* Installing packages in isolated environment:
  - setuptools>=64
  - setuptools_scm>=8
* Getting build dependencies for sdist...
running egg_info
writing src/package.egg-info/PKG-INFO
writing dependency_links to src/package.egg-info/dependency_links.txt
writing requirements to src/package.egg-info/requires.txt
writing top-level names to src/package.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/package.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing src/package.egg-info/PKG-INFO
writing dependency_links to src/package.egg-info/dependency_links.txt
writing requirements to src/package.egg-info/requires.txt
writing top-level names to src/package.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/package.egg-info/SOURCES.txt'
running check
creating package-6.4.2.dev1+gabdd294.d20240723
creating package-6.4.2.dev1+gabdd294.d20240723/src
creating package-6.4.2.dev1+gabdd294.d20240723/src/package
creating package-6.4.2.dev1+gabdd294.d20240723/src/package.egg-info
copying files to package-6.4.2.dev1+gabdd294.d20240723...
copying LICENSE -> package-6.4.2.dev1+gabdd294.d20240723
copying MANIFEST.in -> package-6.4.2.dev1+gabdd294.d20240723
copying README.md -> package-6.4.2.dev1+gabdd294.d20240723
copying pyproject.toml -> package-6.4.2.dev1+gabdd294.d20240723
copying src/package/__init__.py -> package-6.4.2.dev1+gabdd294.d20240723/src/package
copying src/package/foo.py -> package-6.4.2.dev1+gabdd294.d20240723/src/package
copying src/package/py.typed -> package-6.4.2.dev1+gabdd294.d20240723/src/package
copying src/package/version.py -> package-6.4.2.dev1+gabdd294.d20240723/src/package
copying src/package.egg-info/SOURCES.txt -> package-6.4.2.dev1+gabdd294.d20240723/src/package.egg-info
Writing package-6.4.2.dev1+gabdd294.d20240723/setup.cfg
Creating tar archive
removing 'package-6.4.2.dev1+gabdd294.d20240723' (and everything under it)
Successfully built package-6.4.2.dev1+gabdd294.d20240723.tar.gz

Please note that it copies the .egg-info/SOURCES.txt. This is not supposed to happen, as I excluded it as part of the global-exclude in my MANIFEST.in.

I think the SOURCES.txt being copied into the dist is a bug, but I am not really sure if I am missing something

I doubt you can exclude egg info from sdists but you can ask on the setuptools tracker. Think of build as an orchestrator - it’s not responsible for what goes into your builds.

Ah I follow @layday thanks for clarifying and makes sense. Cheers!