From 20a84c417871b701bb2a0ed185eb315f71758c7d Mon Sep 17 00:00:00 2001 From: Jonathan Karr Date: Sat, 2 Dec 2017 12:53:34 -0500 Subject: [PATCH] cleaning up packaging --- MANIFEST.in | 6 ++++++ README.md | 2 +- examples/__init__.py | 1 - setup.cfg | 3 --- setup.py | 21 +++++++++++++++++---- tests/__init__.py | 2 +- wc_sim/VERSION | 1 + wc_sim/__init__.py | 6 +++++- 8 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 wc_sim/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 8f0744e3..f752c4f1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,9 @@ +# description +include README.rst + +# version +include wc_sim/VERSION + # license include LICENSE diff --git a/README.md b/README.md index afdc44c9..b8b20ef6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +[//]: # ( [![PyPI package](https://img.shields.io/pypi/v/wc_sim.svg)](https://pypi.python.org/pypi/wc_sim) ) [![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](http://code.karrlab.org) [![Test results](https://circleci.com/gh/KarrLab/wc_sim.svg?style=shield&circle-token=5f0ee7e437b91cbcac19a9b8526a7ea320ee61c7)](https://circleci.com/gh/KarrLab/wc_sim) [![Test coverage](https://coveralls.io/repos/github/KarrLab/wc_sim/badge.svg?t=EUFJ40)](https://coveralls.io/github/KarrLab/wc_sim) diff --git a/examples/__init__.py b/examples/__init__.py index b8023d8b..e69de29b 100644 --- a/examples/__init__.py +++ b/examples/__init__.py @@ -1 +0,0 @@ -__version__ = '0.0.1' diff --git a/setup.cfg b/setup.cfg index f4797d12..603e50a4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[metadata] -description-file = README.rst - [bdist_wheel] universal = 1 diff --git a/setup.py b/setup.py index 22a8e5de..5199f8bc 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,18 @@ from setuptools import setup, find_packages from wc_utils.util.install import parse_requirements, install_dependencies -import wc_sim +import os + +# get long description +if os.path.isfile('README.rst'): + with open('README.rst', 'r') as file: + long_description = file.read() +else: + long_description = '' + +# get version +with open('wc_sim/VERSION', 'r') as file: + version = file.read().strip() # parse dependencies and links from requirements.txt files with open('requirements.txt', 'r') as file: @@ -18,10 +29,11 @@ # install package setup( name="wc_sim", - version=wc_sim.__version__, + version=version, description="Sequential whole-cell model simulator", + long_description=long_description, url="https://github.com/KarrLab/wc_sim", - download_url='https://github.com/KarrLab/wc_sim/tarball/{}'.format(wc_sim.__version__), + download_url='https://github.com/KarrLab/wc_sim', author="Arthur Goldberg", author_email="arthur.p.goldberg@mssm.edu", license="MIT", @@ -29,13 +41,14 @@ packages=find_packages(exclude=['tests', 'tests.*']), package_data={ 'wc_sim': [ + 'VERSION', 'core/config/core.default.cfg', 'core/config/core.schema.cfg', 'core/config/debug.default.cfg', 'multialgorithm/config/core.default.cfg', 'multialgorithm/config/core.schema.cfg', 'multialgorithm/config/debug.default.cfg', - 'examples/config/debug.default.cfg', + 'examples/config/debug.default.cfg', ], }, install_requires=install_requires, diff --git a/tests/__init__.py b/tests/__init__.py index b8023d8b..8b137891 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -__version__ = '0.0.1' + diff --git a/wc_sim/VERSION b/wc_sim/VERSION new file mode 100644 index 00000000..8a9ecc2e --- /dev/null +++ b/wc_sim/VERSION @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/wc_sim/__init__.py b/wc_sim/__init__.py index b8023d8b..a78f9bb0 100644 --- a/wc_sim/__init__.py +++ b/wc_sim/__init__.py @@ -1 +1,5 @@ -__version__ = '0.0.1' +import pkg_resources + +with open(pkg_resources.resource_filename('wc_sim', 'VERSION'), 'r') as file: + __version__ = file.read().strip() +# :obj:`str`: version