From 2789038b8b8288482f8dc30312875fa2ff1e41ee Mon Sep 17 00:00:00 2001 From: Mark Gibbs Date: Fri, 7 Dec 2018 18:36:39 -0800 Subject: [PATCH 1/2] Add better sourcing of version info --- django_plotly_dash/__init__.py | 2 +- django_plotly_dash/version.py | 7 +++++++ docs/development.rst | 4 ++-- setup.py | 7 ++++--- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 django_plotly_dash/version.py diff --git a/django_plotly_dash/__init__.py b/django_plotly_dash/__init__.py index e9e95703..3f097d81 100644 --- a/django_plotly_dash/__init__.py +++ b/django_plotly_dash/__init__.py @@ -26,6 +26,6 @@ SOFTWARE. ''' -__version__ = "0.9.4" +from .version import __version__ from .dash_wrapper import DjangoDash diff --git a/django_plotly_dash/version.py b/django_plotly_dash/version.py new file mode 100644 index 00000000..04c308e6 --- /dev/null +++ b/django_plotly_dash/version.py @@ -0,0 +1,7 @@ +''' +Define version number for django-plotly-dash, in a form that can be used by setup.py without importing the package. + +This addresses issue #81 +''' + +__version__ = "0.9.4" diff --git a/docs/development.rst b/docs/development.rst index 4f575784..43288f82 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -120,7 +120,7 @@ Release builds This section contains the recipe for building a release of the project. First, update the version number appropriately -in ``django_plotly_dash/__init__.py``, and then +in ``django_plotly_dash/version.py``, and then ensure that the checks and tests have been run:: ./check_code @@ -140,7 +140,7 @@ first a snapshot of the development environment used for the build should be gen pip freeze > frozen_dev.txt git add frozen_dev.txt - git add django_plotly_dash/__init__.py + git add django_plotly_dash/version.py git commit -m" ... suitable commit message for this release ..." diff --git a/setup.py b/setup.py index 54b389fa..d28f0c02 100644 --- a/setup.py +++ b/setup.py @@ -2,16 +2,17 @@ from setuptools import setup -import django_plotly_dash as dpd +#import django_plotly_dash as dpd +#VERSION = dpd.__version__ -VERSION = dpd.__version__ +exec(open('django_plotly_dash/version.py').read()) with open('README.md') as f: long_description = f.read() setup( name="django-plotly-dash", - version=VERSION, + version=__version__, url="https://github.com/GibbsConsulting/django-plotly-dash", description="Django use of plotly dash apps through template tags", long_description=long_description, From 7d8b26cd52a731a9fb8d864514f9433c118af103 Mon Sep 17 00:00:00 2001 From: Mark Gibbs Date: Fri, 7 Dec 2018 18:48:50 -0800 Subject: [PATCH 2/2] Improved import of version number into setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d28f0c02..4f3e457f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,8 @@ #import django_plotly_dash as dpd #VERSION = dpd.__version__ -exec(open('django_plotly_dash/version.py').read()) +with open('django_plotly_dash/version.py') as f: + exec(f.read()) with open('README.md') as f: long_description = f.read()