8000 Do not pre-cythonize for sdist and update build scripts by StrikerRUS · Pull Request #182 · scikit-learn-contrib/lightning · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Do not pre-cythonize for sdist and update build scripts #182

Merged
merged 3 commits into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include MANIFEST.in
include README.rst
include Makefile
include requirements*.txt
recursive-include lightning *.c *.h *.cpp *.pyx *.pxd
recursive-include lightning *.c *.h *.pyx *.pxd
59 changes: 0 additions & 59 deletions lightning/_build_utils.py

This file was deleted.

19 changes: 17 additions & 2 deletions lightning/setup.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
import sys

from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration

from lightning._build_utils import maybe_cythonize_extensions

def cythonize_extensions(top_path, config):
try:
from Cython.Build import cythonize
except ModuleNotFoundError as e:
raise ModuleNotFoundError(
'Please install Cython in order to build a lightning from source.') from e

config.ext_modules = cythonize(config.ext_modules,
compiler_directives={'language_level': 3})


def configuration(parent_package='', top_path=None):
config = Configuration('lightning', parent_package, top_path)

config.add_subpackage('impl')

maybe_cythonize_extensions(top_path, config)
# Skip cythonization as we do not want to include the generated
# C/C++ files in the release tarballs as they are not necessarily
# forward compatible with future versions of Python for instance.
if 'sdist' not in sys.argv:
cythonize_extensions(top_path, config)

return config

Expand Down
20 changes: 14 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import re
import sys
import os
from distutils.command.sdist import sdist
import setuptools

from distutils.command.sdist import sdist

from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration


DISTNAME = 'sklearn-contrib-lightning'
Expand All @@ -19,7 +22,6 @@
MAINTAINER_EMAIL = 'mathieu@mblondel.org'
URL = 'https://github.com/scikit-learn-contrib/lightning'
LICENSE = 'new BSD'
DOWNLOAD_URL = URL
with open(os.path.join('lightning', '__init__.py'), encoding='utf-8') as f:
match = re.search(r'__version__[ ]*=[ ]*[\"\'](?P<version>.+)[\"\']',
f.read())
Expand All @@ -37,9 +39,15 @@ def configuration(parent_package='', top_path=None):
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')

from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)

# Avoid non-useful msg:
# "Ignoring attempt to set 'name' (from ... "
config.set_options(ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)

config.add_subpackage('lightning')

return config
Expand All @@ -55,7 +63,7 @@ def configuration(parent_package='', top_path=None):
setup(configuration=configuration,
name=DISTNAME,
maintainer=MAINTAINER,
python_requires='>={}'.format(MIN_PYTHON_VERSION),
python_requires=f'>={MIN_PYTHON_VERSION}',
install_requires=REQUIREMENTS,
include_package_data=True,
scripts=["bin/lightning_train",
Expand All @@ -65,7 +73,7 @@ def configuration(parent_package='', top_path=None):
license=LICENSE,
url=URL,
version=VERSION,
download_url=DOWNLOAD_URL,
download_url=URL,
long_description=LONG_DESCRIPTION,
zip_safe=False, # the package can run out of an .egg file
cmdclass={"sdist": sdist},
Expand All @@ -74,7 +82,7 @@ def configuration(parent_package='', top_path=None):
'Intended Audience :: Developers',
'License :: OSI Approved',
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Software Development',
'Topic :: Scientific/Engineering',
'Operating System :: Microsoft :: Windows',
Expand Down
0