From 5cfa62253f853d7627bdc95a36ccdef99e3b0302 Mon Sep 17 00:00:00 2001 From: Niru Maheswaranathan Date: Thu, 25 May 2017 11:40:22 -0700 Subject: [PATCH] Using metadata.py to manage version number and other metadata --- metadata.py | 18 ++++++++++++++++++ setup.py | 30 ++++++++---------------------- tableprint.py | 2 +- 3 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 metadata.py diff --git a/metadata.py b/metadata.py new file mode 100644 index 0000000..6e05b69 --- /dev/null +++ b/metadata.py @@ -0,0 +1,18 @@ +# Version info +__name__ = 'tableprint' +__version__ = '0.6.1' +__license__ = 'MIT' + +# Project description(s) +__description__ = 'Pretty console printing of tabular data' +__long_description__ = '''Formatted console printing of tabular data. + tableprint lets you easily print formatted tables of data. + Unlike other modules, you can print single rows of data at a time + (useful for printing ongoing computation results).''' + +# The project's main homepage. +__url__ = 'https://github.com/nirum/tableprint' + +# Author details +__author__ = 'Niru Maheswaranathan' +__author_email__ = 'niru@fastmail.com' diff --git a/setup.py b/setup.py index bab43c2..5363840 100644 --- a/setup.py +++ b/setup.py @@ -1,28 +1,13 @@ +import re from setuptools import setup + +with open('metadata.py', 'r') as f: + metadata = dict(re.findall("", f.read())) + + setup( - name='tableprint', - - # Versions should comply with PEP440. For a discussion on single-sourcing - # the version across setup.py and the project code, see - # https://packaging.python.org/en/latest/single_source_version.html - version='0.6.1', - - description='Pretty console printing of tabular data', - long_description='''Formatted console printing of tabular data. - tableprint lets you easily print formatted tables of data. - Unlike other modules, you can print single rows of data at a time - (useful for printing ongoing computation results).''', - - # The project's main homepage. - url='https://github.com/nirum/tableprint', - - # Author details - author='Niru Maheswaranathan', - author_email='niru@fastmail.com', - - # Choose your license - license='MIT', + **metadata, # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ @@ -44,6 +29,7 @@ setup( 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], # What does your project relate to? diff --git a/tableprint.py b/tableprint.py index 5870e53..545d895 100644 --- a/tableprint.py +++ b/tableprint.py @@ -11,6 +11,7 @@ Usage >>> tableprint.table(data, headers) """ from __future__ import print_function, unicode_literals +from metadata import __version__ from six import string_types from collections import namedtuple from numbers import Number @@ -20,7 +21,6 @@ import numpy as np __all__ = ('table', 'header', 'row', 'hr', 'top', 'bottom', 'banner', 'dataframe', 'humantime', 'styles') -__version__ = '0.5.4' # set up table styles LineStyle = namedtuple('LineStyle', ('begin', 'hline', 'sep', 'end'))