Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bloating of sdists by setuptools-scm #195

Merged
merged 4 commits into from
Nov 27, 2023
Merged

fix: bloating of sdists by setuptools-scm #195

merged 4 commits into from
Nov 27, 2023

Conversation

aryarm
Copy link
Member

@aryarm aryarm commented Nov 24, 2023

PR #193 introduced a new versioning scheme that used setuptools-scm. Unfortunately, it had the unwanted side-effect of adding all files tracked in version control to our source distribution! So we ended up publishing a ~60 MB sdist (instead of the usual ~110 KB sdist) to PyPI. Unfortunately, there isn't currently a way to disable this particular behavior of setuptools-scm -- you can refer to pypa/setuptools-scm#190 for more details.

This PR fixes the issue by removing setuptools-scm and implementing a new versioning scheme where the pyproject.toml file itself becomes the central location for the version declaration. When we want to release a new version, we'll just need to bump it there.

The pyproject.toml file is now the single location for the version to be declared. It will be read by __init__.py automatically.
The old system used setuptools-scm but apparently that has the unintended side-effect of adding all files tracked by version control to the sdist! yikes
Refer to pypa/setuptools-scm#190 for more details
@aryarm aryarm changed the title fix: bloating of sdists by setuptools-scm fix: bloating of sdists by setuptools-scm Nov 24, 2023
@aryarm
Copy link
Member Author

aryarm commented Nov 24, 2023

I checked that my changes restored the previous sdist contents by comparing the sdist contents before and after:

rm -rf trtools.egg-info dist

# check out the code for v5.0.2 and build an sdist for it
git checkout 674f1240f239f1f3607cb7411dec25ed530abce4
python -m build

mv dist dist-org
rm -rf trtools.egg-info

# check out the code for v5.1.1, change the version number temporarily, and build an sdist for it too
git checkout fix/sdist-bloat
sed -i 's/5.1.1/5.0.2/' pyproject.toml
python -m build

# compare the sdist contents
diff -u <(tar -tf dist-orig/trtools-5.0.2.tar.gz) <(tar -tf dist/trtools-5.0.2.tar.gz) > sdist-contents.diff
Click here to view sdist-contents.diff
--- /dev/fd/63	2023-11-24 22:32:57.823274914 +0000
+++ /dev/fd/62	2023-11-24 22:32:57.823274914 +0000
@@ -1,12 +1,11 @@
trtools-5.0.2/
trtools-5.0.2/LICENSE.txt
-trtools-5.0.2/MANIFEST.in
trtools-5.0.2/PKG-INFO
trtools-5.0.2/README.rst
+trtools-5.0.2/pyproject.toml
trtools-5.0.2/scripts/
trtools-5.0.2/scripts/trtools_prep_beagle_vcf.sh
trtools-5.0.2/setup.cfg
-trtools-5.0.2/setup.py
trtools-5.0.2/trtools/
trtools-5.0.2/trtools/__init__.py
trtools-5.0.2/trtools/associaTR/
@@ -36,12 +35,24 @@
trtools-5.0.2/trtools/mergeSTR/tests/
trtools-5.0.2/trtools/mergeSTR/tests/__init__.py
trtools-5.0.2/trtools/mergeSTR/tests/test_mergeSTR.py
+trtools-5.0.2/trtools/prancSTR/
+trtools-5.0.2/trtools/prancSTR/__init__.py
+trtools-5.0.2/trtools/prancSTR/prancSTR.py
+trtools-5.0.2/trtools/prancSTR/tests/
+trtools-5.0.2/trtools/prancSTR/tests/__init__.py
+trtools-5.0.2/trtools/prancSTR/tests/test_prancSTR.py
trtools-5.0.2/trtools/qcSTR/
trtools-5.0.2/trtools/qcSTR/__init__.py
trtools-5.0.2/trtools/qcSTR/qcSTR.py
trtools-5.0.2/trtools/qcSTR/tests/
trtools-5.0.2/trtools/qcSTR/tests/__init__.py
trtools-5.0.2/trtools/qcSTR/tests/test_qcSTR.py
+trtools-5.0.2/trtools/simTR/
+trtools-5.0.2/trtools/simTR/__init__.py
+trtools-5.0.2/trtools/simTR/simTR.py
+trtools-5.0.2/trtools/simTR/tests/
+trtools-5.0.2/trtools/simTR/tests/__init__.py
+trtools-5.0.2/trtools/simTR/tests/test_simTR.py
trtools-5.0.2/trtools/statSTR/
trtools-5.0.2/trtools/statSTR/__init__.py
trtools-5.0.2/trtools/statSTR/statSTR.py
@@ -65,7 +76,6 @@
trtools-5.0.2/trtools/utils/tests/test_utils.py
trtools-5.0.2/trtools/utils/tr_harmonizer.py
trtools-5.0.2/trtools/utils/utils.py
-trtools-5.0.2/trtools/version.py
trtools-5.0.2/trtools.egg-info/
trtools-5.0.2/trtools.egg-info/PKG-INFO
trtools-5.0.2/trtools.egg-info/SOURCES.txt

Copy link
Contributor

@gymreklab gymreklab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

@aryarm aryarm merged commit b5bc498 into master Nov 27, 2023
5 checks passed
@aryarm aryarm deleted the fix/sdist-bloat branch November 27, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants