Skip to content

Instantly share code, notes, and snippets.

@jackersson
Created July 25, 2018 07:59
Show Gist options
  • Save jackersson/553e87abc933974ba5be4c887a017193 to your computer and use it in GitHub Desktop.
Save jackersson/553e87abc933974ba5be4c887a017193 to your computer and use it in GitHub Desktop.
run_custom_script_with_pip_package
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup for AI Models package
"""
from setuptools import setup # , Command
from setuptools.command.install import install
with open('README.md') as readme_file:
readme = readme_file.read()
class BuildCommand(install):
"""Custom install setup to help run shell commands (outside shell) before installation"""
def run(self):
install.run(self)
import subprocess
import os
cwd = os.path.dirname(os.path.abspath(__file__))
build_file = os.path.join(cwd, 'build.sh')
assert os.path.isfile(build_file), build_file
_ = subprocess.run(build_file,
shell=True,
cwd=cwd,
executable='/bin/bash')
# install.run(self)
requirements = [
'scikit_image',
'six',
'botocore',
'numpy',
'boto3',
'scipy',
'pytest',
'setuptools',
'Pillow',
'slidingwindow'
]
setup(
name='ai_models',
use_scm_version=True,
setup_requires=['setuptools_scm'],
description="Ai Models package",
long_description=readme,
author="Dat-ai",
author_email='taras.lishchenko@dat-ai.com',
url='https://github.com/dataiCV/ai-models',
packages=[
'ai_models',
],
include_package_data=True,
install_requires=requirements,
license="Apache Software License 2.0",
zip_safe=True,
keywords='ai_models',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3.6',
],
cmdclass={
'install': BuildCommand,
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment