Skip to content

Add package data and data files to setup.py for requirements management#960

Open
sarthakpati wants to merge 1 commit into
meta-pytorch:masterfrom
sarthakpati:fix_sdist
Open

Add package data and data files to setup.py for requirements management#960
sarthakpati wants to merge 1 commit into
meta-pytorch:masterfrom
sarthakpati:fix_sdist

Conversation

@sarthakpati

Copy link
Copy Markdown
Contributor

This fixes #959

Summary:

Added package_data and data_files to setup.py to ensure the sdist gets created correctly.

Test plan:

Checked using a basic build command:

(base) PS C:\Projects> git clone https://github.com/sarthakpati/tnt.git tnt_mine
[SNIP!]
(base) PS C:\Projects> cd tnt_mine
(base) PS C:\Projects\tnt_mine> conda create -p ./venv python=3.11
[SNIP!]
(base) PS C:\Projects\tnt_mine> conda activate ./venv
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine> pip install build
[SNIP!]
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine> git rev-parse HEAD
5e01a89e2c41f1b63e4030bc1370d33e76b37182
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine> python -m build
[SNIP!]
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine> cd .\dist\
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine\dist> tar -xf .\torchtnt-0.2.4.tar.gz
(C:\Projects\venv\tnt_mine) PS C:\Projects\tnt_mine\dist> ls .\torchtnt-0.2.4\

    Directory: C:\Projects\tnt_mine\dist\torchtnt-0.2.4

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          2025-01-15    15:20                torchtnt
d----          2025-01-15    15:20                torchtnt.egg-info
-a---          2025-01-15    15:15             70 dev-requirements.txt
-a---          2025-01-15    15:15           1563 LICENSE
-a---          2025-01-15    15:20           3381 PKG-INFO
-a---          2025-01-15    15:15             47 pyproject.toml
-a---          2025-01-15    15:15           1820 README.md
-a---          2025-01-15    15:15            133 requirements.txt
-a---          2025-01-15    15:20             42 setup.cfg
-a---          2025-01-15    15:20           3187 setup.py

Fixes #959

@sethc555

Copy link
Copy Markdown

Independent verification: with this PR checked out, python -m build (sdist → wheel) succeeds in a clean python:3.12 container with current setuptools. Without it, the published torchtnt 0.2.4 sdist is incomplete — setup.py reads requirements.txt, which is not shipped — so pip install --no-binary :all: torchtnt fails, confirming #959. Found while build-checking the top-5000 PyPI packages for source-install breakage.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The distribution package is incomplete

3 participants