support lite build
from distutils.core import setup
from setuptools import find_packages # type: ignore
+from setuptools.command.build_py import build_py
from kgtk import __version__
+import sys
+
+
+lite_build = False
+if '--lite' in sys.argv:
+ lite_build = True
+ sys.argv.remove('--lite')
+
with open('requirements.txt', 'r') as f:
install_requires = list()
@@ -13,10 +22,25 @@ with open('requirements.txt', 'r') as f:
else:
install_requires.append(re)
+
+lite_excluded_modules = {
+ 'kgtk.cli': {'filter', 'export_gt', 'export_neo4j'}
+}
+
+
+class kgtk_build_py(build_py):
+
+ def find_package_modules(self, package, package_dir):
+ modules = super().find_package_modules(package, package_dir)
+ if lite_build and package in lite_excluded_modules:
+ modules = list(filter(lambda m: m[1] not in lite_excluded_modules[package], modules))
+ return modules
+
+
packages = find_packages()
setup(
- name='kgtk',
+ name='kgtk' if not lite_build else 'kgtk-lite',
version=__version__,
packages=packages,
url='https://github.com/usc-isi-i2/kgtk',
@@ -30,4 +54,7 @@ setup(
'kgtk = kgtk.cli_entry:cli_entry',
],
},
+ cmdclass={
+ 'build_py': kgtk_build_py
+ }
)
