From 3007d558c5af83caf8146af734deaddb39c3a278 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Fri, 24 Feb 2023 16:40:56 +0000 Subject: [PATCH] Remove MANIFEST.in and include_package_data, specify package_data manually This allows finer control over what gets packaged, and fixes a deprecation warning in recent setuptools versions (see https://github.com/pypa/setuptools/issues/3308 for detais). It also prevents Cython-transpiled C source files being included in the wheel distribution, which roughly halves the size of the installed distribution. --- MANIFEST.in | 3 --- pyproject.toml | 2 +- setup.py | 12 ++++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 2d850775..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include CHANGELOG.md CITE.md AUTHORS.md -include cherab/core/VERSION -recursive-include cherab *.pyx *.pxd *.json *.cl *.npy *.obj diff --git a/pyproject.toml b/pyproject.toml index ce56ed60..a4eabed0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=0.28", "raysect==0.8.1"] +requires = ["setuptools>=62.3", "oldest-supported-numpy", "cython>=0.28", "raysect==0.8.1"] build-backend="setuptools.build_meta" diff --git a/setup.py b/setup.py index ba84e56e..58d28075 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ -from setuptools import setup, find_packages, Extension from collections import defaultdict import sys -import numpy import os import os.path as path from pathlib import Path import multiprocessing +import numpy +from setuptools import setup, find_packages, Extension from Cython.Build import cythonize multiprocessing.set_start_method('fork') @@ -117,8 +117,12 @@ "matplotlib", "raysect==0.8.1", ], - packages=find_packages(include=["cherab*"]), - include_package_data=True, + packages=find_packages(include=["cherab"]), + package_data={"": [ + "**/*.pyx", "**/*.pxd", # Needed to build Cython extensions. + "**/*.json", "**/*.cl", "**/*.npy", "**/*.obj", # Supplementary data + "cherab/core/VERSION", # Used by cherab.core to determine version at run time + ]}, data_files=data_files, zip_safe=False, ext_modules=extensions,