From 516221a2b0e072948607507d1da80913b29e610a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 23 Jun 2023 12:31:47 +0100 Subject: [PATCH] build: Port from MANIFEST.in to setuptools_scm Using `setuptools_scm` allows us to reliably ensure that all files in git are in the sdist, which avoids problems caused by occasionally forgetting to update `MANIFEST.in` when adding a new directory. `MANIFEST.in` still needs to be kept (in a reduced form) because there are a few files needed by webpack and by kolibri-installer-android which are only created at dist time, and exist outside setuptools. References: - https://github.com/pypa/setuptools_scm#readme - https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/ - https://github.com/pypa/setuptools_scm/issues/190 - https://packaging.python.org/en/latest/guides/using-manifest-in/ Signed-off-by: Philip Withnall https://github.com/endlessm/kolibri-explore-plugin/issues/647 --- MANIFEST.in | 27 +++++++++------------------ pyproject.toml | 8 ++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index fa6543a41..ed2f18b06 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,19 +1,10 @@ -include AUTHORS.rst -include CONTRIBUTING.rst -include CHANGELOG.rst -include LICENSE -include README.rst -include kolibri_explore_plugin/VERSION -include kolibri_explore_plugin/content_types.json -recursive-exclude kolibri_explore_plugin/* *pyc -recursive-exclude kolibri_explore_plugin/assets * -recursive-include kolibri_explore_plugin/migrations * -recursive-include kolibri_explore_plugin/management * -recursive-include kolibri_explore_plugin/templates *.* -recursive-include kolibri_explore_plugin/static *.* -recursive-exclude kolibri_explore_plugin/static/collections * -recursive-include kolibri_explore_plugin/build *.json -recursive-include kolibri_explore_plugin/locale *.mo -recursive-include kolibri_explore_plugin/locale *.json -recursive-include kolibri_explore_plugin/vendor *.py +# webpack build-info is needed at runtime, but it’s only built at build time +# by yarn, so setuptools doesn’t know about it. +include kolibri_explore_plugin/static/build-info.json + +# This is the dist form of welcomeScreen, which is not committed to git (but its +# source in packages/welcome-screen, is). It needs to be in the dist tarball +# because it’s consumed by kolibri-installer-android to show a welcome screen, +# and kolibri-installer-android consumes the kolibri-explore-plugin wheel +# directly. recursive-include kolibri_explore_plugin/welcomeScreen *.* diff --git a/pyproject.toml b/pyproject.toml index 407c79099..8f116c3cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ +[build-system] +# As per https://peps.python.org/pep-0518, list only the minimal dependencies +# needed here to get the build started. All other dependencies and built +# dependencies should be listed in [packages]/[dev-packages] in Pipfile. +# If changing the requires list here, please also update it in [dev-packages] +# in Pipfile. +requires = ["build", "setuptools>=45", "setuptools_scm[toml]>=6.2"] + [tool.black] line-length = 79 include = '\.pyi?$'