From e8414f6d38f4620e3d8f3e489c0431c63bd4db0d Mon Sep 17 00:00:00 2001 From: drz Date: Thu, 23 Apr 2020 17:18:14 -0700 Subject: [PATCH] improved setup script --- hgtector/__init__.py | 20 +++++++++++- hgtector/tests/__init__.py | 0 scripts/hgtector | 10 ++---- setup.py | 63 ++++++++++++++++---------------------- 4 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 hgtector/tests/__init__.py diff --git a/hgtector/__init__.py b/hgtector/__init__.py index ba4ceaf..1e00912 100644 --- a/hgtector/__init__.py +++ b/hgtector/__init__.py @@ -1 +1,19 @@ -__version__ = "2.0b1" +#!/usr/bin/env python3 + +# ---------------------------------------------------------------------------- +# Copyright (c) 2013--, Qiyun Zhu and Katharina Dittmar. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file LICENSE, distributed with this software. +# ---------------------------------------------------------------------------- + +__name__ = 'hgtector' +__version__ = '2.0b2' +__description__ = ( + 'Genome-wide detection of putative horizontal gene transfer (HGT) events ' + 'based on sequence homology search hit distribution statistics') +__license__ = 'BSD-3-Clause' +__author__ = 'Qiyun Zhu', +__email__ = 'qiyunzhu@gmail.com', +__url__ = 'https://github.com/DittmarLab/HGTector' diff --git a/hgtector/tests/__init__.py b/hgtector/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/hgtector b/scripts/hgtector index 6a5879f..55228ea 100644 --- a/scripts/hgtector +++ b/scripts/hgtector @@ -12,12 +12,8 @@ import sys import argparse from importlib import import_module +import hgtector.__init__ as init -__version__ = '2.0b1' - -description = """HGTector: Genome-wide detection of putative horizontal gene \ -transfer (HGT) events based on sequence homology search hit distribution \ -statistics.""" module_names = ('search', 'analyze', 'database') @@ -55,8 +51,8 @@ def parse_args(modules): arguments """ parser = argparse.ArgumentParser( - description=description, add_help=False, - epilog='version: {}'.format(__version__), + description=init.__description__, add_help=False, + epilog=f'version: {init.__version__}', formatter_class=argparse.RawDescriptionHelpFormatter) subparsers = parser.add_subparsers( title='commands', dest='command', required=True) diff --git a/setup.py b/setup.py index a7b93d9..3c7e5fc 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,8 @@ from setuptools import setup, find_packages from glob import glob +import hgtector.__init__ as init + classes = """ Development Status :: 4 - Beta @@ -25,39 +27,28 @@ Operating System :: Windows """ -classifiers = [s.strip() for s in classes.split('\n') if s] - - -description = ( - 'Genome-wide detection of putative horizontal gene transfer (HGT) events ' - 'based on sequence homology search hit distribution statistics') - -long_description = open('README.md').read() - - -setup( - name='hgtector', - version='2.0b1', - license='BSD-3-Clause', - description=description, - long_description=long_description, - long_description_content_type='text/markdown', - author='Qiyun Zhu', - author_email='qiyunzhu@gmail.com', - url='https://github.com/DittmarLab/HGTector', - packages=find_packages(), - scripts=glob('scripts/hgtector'), - package_data={'hgtector': ['config.yml']}, - include_package_data=True, - install_requires=[ - 'pyyaml', - 'numpy', - 'scipy', - 'pandas', - 'scikit-learn', - 'matplotlib' - ], - classifiers=classifiers, - python_requires='>=3.6', - entry_points='[console_scripts]' -) +params = { + 'name': init.__name__, + 'version': init.__version__, + 'license': init.__license__, + 'description': init.__description__, + 'long_description': open('README.md').read(), + 'long_description_content_type': 'text/markdown', + 'author': init.__author__, + 'author_email': init.__email__, + 'url': init.__url__, + 'install_requires': ['pyyaml', + 'numpy', + 'scipy', + 'pandas', + 'scikit-learn', + 'matplotlib'], + 'classifiers': classes.strip().split('\n '), + 'python_requires': '>=3.6', + 'entry_points': '[console_scripts]', + 'scripts': glob(f'scripts/{init.__name__}'), + 'package_data': {init.__name__: ['config.yml']}, + 'include_package_data': True +} + +setup(**params, packages=find_packages())