Skip to content

Commit

Permalink
Update Python package setup (#3111)
Browse files Browse the repository at this point in the history
* Cleanup setup.py and make Python 3 compatible

* Remove write_version_py()

* Add setup.cfg

* Add metadata to setup.cfg and code cleanup
  • Loading branch information
hackdna authored Feb 26, 2020
1 parent 94e0b0c commit dd1c87b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 35 deletions.
44 changes: 44 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[metadata]
author = bcbio community
author_email = [email protected]
classifiers =
Environment :: Console
Intended Audience :: Education
Intended Audience :: Healthcare Industry
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Scientific/Engineering :: Bio-Informatics
description = Best-practice pipelines for fully automated high throughput sequencing analysis
keywords = ChIP-seq, DNA, genomics, pipeline, RNA, RNA-seq, sequencing, SNP, variant calling
license = MIT
license_file = LICENSE.txt
long_description = file: README.rst
long_description_content_type = text/x-rst
name = bcbio-nextgen
project_urls =
Documentation = https://bcbio-nextgen.readthedocs.io/
Source = https://github.com/bcbio/bcbio-nextgen
Tracker = https://github.com/bcbio/bcbio-nextgen/issues
url = https://github.com/bcbio/bcbio-nextgen

[options]
include_package_data = True
packages = find:
python_requires = >=3.6
scripts =
scripts/bcbio_nextgen.py
scripts/bcbio_setup_genome.py
scripts/bcbio_prepare_samples.py
scripts/bcbio_fastq_umi_prep.py
scripts/cwltool2wdl.py
zip_safe = False

[options.packages.find]
include = bcbio, bcbio.*
57 changes: 22 additions & 35 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
#!/usr/bin/env python
"""Setup file and install script for NextGen sequencing analysis scripts.
"""

"""Setup file and install script for NextGen sequencing analysis scripts"""

import os
from setuptools import setup, find_packages
import subprocess

import setuptools

version = "1.2.0"
VERSION = '1.2.0'

def write_version_py():
version_py = os.path.join(os.path.dirname(__file__), 'bcbio', 'pipeline',
'version.py')
try:
import subprocess
p = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE)
githash = p.stdout.read().strip()
except:
githash = ""
with open(version_py, "w") as out_handle:
out_handle.write("\n".join(['__version__ = "%s"' % version,
'__git_revision__ = "%s"' % githash]))
# add bcbio version number and git commit hash of the current revision to version.py
try:
git_run = subprocess.run(['git', 'rev-parse', '--short', 'HEAD'], stdout=subprocess.PIPE)
git_run.check_returncode()
except subprocess.SubprocessError:
commit_hash = ''
else:
commit_hash = git_run.stdout.strip().decode()

install_requires = [] # install dependencies via conda
zip_safe = False
scripts = ['scripts/bcbio_nextgen.py', 'scripts/bcbio_setup_genome.py', 'scripts/bcbio_prepare_samples.py',
'scripts/bcbio_fastq_umi_prep.py', 'scripts/cwltool2wdl.py']
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, 'bcbio', 'pipeline', 'version.py'), 'w') as version_file:
version_file.writelines([f'__version__ = "{VERSION}"\n',
f'__git_revision__ = "{commit_hash}"\n'])

write_version_py()
setup(name="bcbio-nextgen",
version=version,
author="bcbio community",
author_email="[email protected]",
description="Best-practice pipelines for fully automated high throughput sequencing analysis",
long_description=(open('README.rst').read()),
license="MIT",
url="https://github.com/bcbio/bcbio-nextgen",
packages=find_packages(exclude=["tests"]),
zip_safe=zip_safe,
scripts=scripts,
install_requires=install_requires,
include_package_data=True)
# dependencies are installed via Conda from
# https://github.com/chapmanb/cloudbiolinux/blob/master/contrib/flavor/ngs_pipeline_minimal/packages-conda.yaml
setuptools.setup(version=VERSION)

0 comments on commit dd1c87b

Please sign in to comment.