Unverified Commit ce1bc12f authored by Jeroen F.J. Laros's avatar Jeroen F.J. Laros
Browse files

Simplified package metadata handling.

parent c8554e01
from os.path import dirname, abspath
from configparser import ConfigParser
from pkg_resources import get_distribution
from .backtranslate import BackTranslate
config = ConfigParser()
with open('{}/setup.cfg'.format(dirname(abspath(__file__)))) as handle:
config.read_file(handle)
def _get_metadata(name):
pkg = get_distribution(__package__)
for line in pkg.get_metadata_lines(pkg.PKG_INFO):
if line.startswith('{}: '.format(name)):
return line.split(': ')[1]
return ''
_copyright_notice = 'Copyright (c) {} {} <{}>'.format(
config.get('metadata', 'copyright'),
config.get('metadata', 'author'),
config.get('metadata', 'author_email'))
_copyright_notice = 'Copyright (c) {} <{}>'.format(
_get_metadata('Author'), _get_metadata('Author-email'))
usage = [config.get('metadata', 'description'), _copyright_notice]
usage = [_get_metadata('Summary'), _copyright_notice]
def doc_split(func):
......@@ -23,7 +25,5 @@ def doc_split(func):
def version(name):
return '{} version {}\n\n{}\nHomepage: {}'.format(
config.get('metadata', 'name'),
config.get('metadata', 'version'),
_copyright_notice,
config.get('metadata', 'url'))
_get_metadata('Name'), _get_metadata('Version'), _copyright_notice,
_get_metadata('Home-page'))
../setup.cfg
\ No newline at end of file
......@@ -11,7 +11,7 @@ def _three_to_one():
def subst_to_cds(substitutions, offset):
""" Convert a set of substitutions to CDS coordinates.
"""Convert a set of substitutions to CDS coordinates.
:arg dict substitutions: Set of single nucleotide substitutions indexed by
position.
......
[metadata]
name = backtranslate
version = 0.1.1
version = 0.1.2
description = Functions for reverse translation.
long_description = file: README.rst
author = LUMC, Jeroen F.J. Laros
......@@ -9,20 +9,22 @@ url = https://github.com/mutalyzer/backtranslate
keywords = bioinformatics
license = MIT
classifiers =
Intended Audience :: Developers
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
copyright = 2015-2019
Topic :: Scientific/Engineering
[options]
packages = find:
install_requires =
biopython
configparser
python-Levenshtein
[options.package_data]
backtranslate = setup.cfg
biopython==1.76
python-Levenshtein==0.12.0
tests_require =
fake-open==0.0.1
pytest==4.0.1
[options.entry_points]
console_scripts =
......
"""
Tests for the backtranslate.backtranslate module.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
from future.builtins import str, zip
"""Tests for the backtranslate.backtranslate module."""
from backtranslate.backtranslate import BackTranslate, cmp_subst
class TestParser(object):
"""
Test the backtranslate.backtranslate module.
"""
"""Test the backtranslate.backtranslate module."""
def setup(self):
self.bt = BackTranslate()
......
"""
Tests for the backtranslate CLI.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
from future.builtins import str, zip
"""Tests for the backtranslate CLI."""
import sys
from hashlib import md5
......@@ -16,9 +10,7 @@ from backtranslate import cli
class TestParser(object):
"""
Test the backtranslate.backtranslate module.
"""
"""Test the backtranslate.backtranslate module."""
def setup(self):
self._input = open('data/mhv.fa')
self._output = StringIO()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment