<#17665 pants package generates empty wheels and s...
# github-notifications
q
#17665 pants package generates empty wheels and source distributions New issue created by JordonPhillips Describe the bug A clear and concise description of the bug. Wheels created by running
./pants package ::
contain no source, and therefore do not work. The generated source tars are similarly barren. Pip, on the other hand, is able to create wheels just fine (after I remove the
BUILD
file anyway since pip creates a directory called
build
now). The package in question uses
pyproject.toml
. The BUILD file reads as follows:
Copy code
resource(name="pyproject", source="pyproject.toml")

python_distribution(
    name="dist",
    dependencies=[
        ":pyproject"
    ],
    provides=python_artifact(
        name="example_package",
        version="0.0.1",
    ),
    generate_setup=False
)
BUILD files in the source directories just have
python_sources()
. pyproject.toml:
Copy code
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "example_package"
version = "0.0.1"
description = "description"
authors = [{name = "example"}]
keywords = ["example"]
requires-python = ">=3.11"
license = {text = "Apache License 2.0"}
classifiers = [
    "Development Status :: 2 - Pre-Alpha"
]
dependencies = [
    "requests==2.28.1"
]

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
exclude=["tests*"]
The source directory structure looks something like:
Copy code
.
├── BUILD
├── <http://MANIFEST.in|MANIFEST.in>
├── NOTICE
├── README.md
├── pyproject.toml
├── example_package
│   ├── BUILD
│   ├── __init__.py
│   ├── py.typed
│   └── example.py
└── tests
    ├── __init__.py
    └── unit
        ├── BUILD
        ├── __init__.py
        └── test_example.py
The generated tar contains the following:
Copy code
example_package-0.0.1
├── PKG-INFO
├── backend_shim.py
├── pyproject.toml
├── setup.cfg
└── example_package.egg-info
    ├── PKG-INFO
    ├── SOURCES.txt
    ├── dependency_links.txt
    ├── requires.txt
    └── top_level.txt
Note also
backend_shim.py
- why is that there? The generated wheel only contains the dist-info directory, no source at all. Pants version Which version of Pants are you using? 2.14.0 OS Are you encountering the bug on MacOS, Linux, or both? macOS, I haven't tested on Linux Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. pantsbuild/pants