Skip to content

Instantly share code, notes, and snippets.

@feynlee
Created September 8, 2019 14:19
Show Gist options
  • Select an option

  • Save feynlee/7e090b03de920fded97b836123c3c1da to your computer and use it in GitHub Desktop.

Select an option

Save feynlee/7e090b03de920fded97b836123c3c1da to your computer and use it in GitHub Desktop.
from glob import glob
from os.path import basename
from os.path import splitext
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
from subprocess import check_call
DISTNAME = 'package_name'
AUTHOR = 'author_name'
DESCRIPTION = 'package_description'
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
check_call("python get_secrets.py".split())
develop.run(self)
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
check_call("python get_secrets.py".split())
install.run(self)
setup(name=DISTNAME,
maintainer=AUTHOR,
version='1.0.0',
install_requires=['pandas', 'numpy'],
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
package_data={'davinci': ['_resources/*']},
include_package_data=True,
cmdclass={'develop': PostDevelopCommand,
'install': PostInstallCommand
},
description=DESCRIPTION,
python_requires='>=3.6')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment