Skip to content

BUILD: Remove tests folder in package distribution #60606

Closed
@zhan9san

Description

@zhan9san

Installation check

Platform

macOS-15.1-x86_64-i386-64bit

Installation Method

pip install

pandas Version

2.2.3

Python Version

3.11.9

Installation Logs

I discovered that the tests folder is included in the package distribution, which I believe is not a good practice.

Consider this real scenario: I use pandas in an AWS Lambda function, where the layer size limitation is 250 MB. This means all dependencies must be smaller than this limit, necessitating a reduction in the package size.

Here is what setuptools says,

final users will end up installing not only timmins.foo, but also docs and tests.tests_foo. A simple way to fix this is to adopt the aforementioned src-layout, or make sure to properly configure the include and/or exclude accordingly.

How to reproduce it

$ pip install pandas -t test-install
$ cd test-install
$ du -sh * | sort -rh
 38M	tests
 21M	_libs
 12M	core
3.6M	io
692K	plotting
224K	_testing
208K	util
140K	__pycache__
116K	compat
112K	tseries
108K	_config
 64K	errors
 48K	conftest.py
 48K	api
 24K	pyproject.toml
 24K	_version.py
 16K	_typing.py
 12K	__init__.py
8.0K	arrays
4.0K	testing.py
4.0K	_version_meson.py

Reference

AWS Lambda limitation: 250 MB The maximum size of the contents of a deployment package, including layers and custom runtimes. (unzipped)

Python setup tool: exclude tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    BuildLibrary building on various platformsNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions