From 4a39c1e3a442ff2d5d4510d724577a06eb5827ed Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 26 Dec 2012 20:12:49 -0500 Subject: [PATCH 1/8] Fixed bug 1089042 (AttributeError in PlotItem) --- pyqtgraph/graphicsItems/PlotItem/PlotItem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py index 6c2e1a6f..c362ffb5 100644 --- a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py +++ b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py @@ -158,6 +158,8 @@ class PlotItem(GraphicsWidget): self.autoAlpha = True self.spectrumMode = False + self.legend = None + ## Create and place axis items if axisItems is None: axisItems = {} @@ -538,7 +540,7 @@ class PlotItem(GraphicsWidget): #item.sigPlotChanged.connect(self.plotChanged) #self.plotChanged() name = kargs.get('name', getattr(item, 'opts', {}).get('name', None)) - if name is not None and self.legend is not None: + if name is not None and hasattr(self, 'legend') and self.legend is not None: self.legend.addItem(item, name=name) From 6931eacffd2809abc74d30e4fae59151ce5088f6 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 26 Dec 2012 21:02:36 -0500 Subject: [PATCH 2/8] Fixed doc build to work with new package structure. --- doc/source/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 2fd718e4..97d4b35c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -17,8 +17,7 @@ import sys, os # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. path = os.path.dirname(os.path.abspath(__file__)) -sys.path.insert(0, os.path.join(path, '..', '..', '..')) -print sys.path +sys.path.insert(0, os.path.join(path, '..', '..')) # -- General configuration ----------------------------------------------------- From 19d7bc56054a3c29c1a18f281e41e83896721ab8 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Thu, 27 Dec 2012 04:35:23 +0000 Subject: [PATCH 3/8] bugfixes for new package structure --- examples/initExample.py | 6 +++--- setup.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/initExample.py b/examples/initExample.py index f95a0cb0..38dd3edc 100644 --- a/examples/initExample.py +++ b/examples/initExample.py @@ -2,10 +2,10 @@ import sys, os path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) path.rstrip(os.path.sep) -if path.endswith('pyqtgraph'): - sys.path.insert(0, os.path.join(path, '..')) ## examples installed inside pyqtgraph package -elif 'pyqtgraph' in os.listdir(path): +if 'pyqtgraph' in os.listdir(path): sys.path.insert(0, path) ## examples adjacent to pyqtgraph (as in source) +elif path.endswith('pyqtgraph'): + sys.path.insert(0, os.path.abspath(os.path.join(path, '..'))) ## examples installed inside pyqtgraph package ## should force example to use PySide instead of PyQt if 'pyside' in sys.argv: diff --git a/setup.py b/setup.py index e4dc07cf..64d22ba2 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,19 @@ from distutils.core import setup +import distutils.dir_util import os ## generate list of all sub-packages -subdirs = [i[0].split(os.path.sep)[1:] for i in os.walk('./pyqtgraph') if '__init__.py' in i[2]] -subdirs = filter(lambda p: len(p) == 1 or p[1] != 'build', subdirs) +path = os.path.abspath(os.path.dirname(__file__)) +n = len(path.split(os.path.sep)) +subdirs = [i[0].split(os.path.sep)[n:] for i in os.walk(os.path.join(path, 'pyqtgraph')) if '__init__.py' in i[2]] all_packages = ['.'.join(p) for p in subdirs] + ['pyqtgraph.examples'] + +## Make sure build directory is clean before installing +buildPath = os.path.join(path, 'build') +if os.path.isdir(buildPath): + distutils.dir_util.remove_tree(buildPath) + setup(name='pyqtgraph', version='', description='Scientific Graphics and GUI Library for Python', @@ -23,6 +31,9 @@ It is intended for use in mathematics / scientific / engineering applications. D #package_data={'pyqtgraph': ['graphicsItems/PlotItem/*.png']}, classifiers = [ "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Development Status :: 4 - Beta", "Environment :: Other Environment", From 7f51813c2c0a101f1783a4af4acadb587b95e556 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 27 Dec 2012 01:52:32 -0500 Subject: [PATCH 4/8] Added MANIFEST.in for generating cleaner source distributions updated versioning system --- MANIFEST.in | 7 +++++++ pyqtgraph/__init__.py | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..fb08e7e5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +recursive-include pyqtgraph *.py *.ui *.m README *.txt +recursive-include tests *.py *.ui +recursive-include examples *.py *.ui +recursive-include doc *.rst *.py *.svg *.png *.jpg +recursive-include doc/build/html * +include doc/Makefile doc/make.bat + diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 6e950770..93d9f7b8 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -1,5 +1,10 @@ # -*- coding: utf-8 -*- -REVISION = None +""" +PyQtGraph - Scientific Graphics and GUI Library for Python +www.pyqtgraph.org +""" + +__version__ = None ### import all the goodies and add some helper functions for easy CLI use @@ -63,19 +68,21 @@ def systemInfo(): from .Qt import VERSION_INFO print("qt bindings: %s" % VERSION_INFO) - global REVISION - if REVISION is None: ## this code was probably checked out from bzr; look up the last-revision file - lastRevFile = os.path.join(os.path.dirname(__file__), '.bzr', 'branch', 'last-revision') + global __version__ + rev = None + if __version__ is None: ## this code was probably checked out from bzr; look up the last-revision file + lastRevFile = os.path.join(os.path.dirname(__file__), '..', '.bzr', 'branch', 'last-revision') if os.path.exists(lastRevFile): - REVISION = open(lastRevFile, 'r').read().strip() + rev = open(lastRevFile, 'r').read().strip() - print("pyqtgraph: %s" % REVISION) + print("pyqtgraph: %s; %s" % (__version__, rev)) print("config:") import pprint pprint.pprint(CONFIG_OPTIONS) ## Rename orphaned .pyc files. This is *probably* safe :) - +## We only do this if __version__ is None, indicating the code was probably pulled +## from the repository. def renamePyc(startDir): ### Used to rename orphaned .pyc files ### When a python file changes its location in the repository, usually the .pyc file @@ -108,9 +115,8 @@ def renamePyc(startDir): print(" " + name2) os.rename(fileName, name2) -import os path = os.path.split(__file__)[0] -if not hasattr(sys, 'frozen'): ## If we are frozen, there's a good chance we don't have the original .py files anymore. +if __version__ is None and not hasattr(sys, 'frozen') and sys.version_info[0] == 2: ## If we are frozen, there's a good chance we don't have the original .py files anymore. renamePyc(path) From 000354ac2189078bf3dff3f3dfc01e8fd6fda975 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 27 Dec 2012 02:21:34 -0500 Subject: [PATCH 5/8] Fixed documentation version numbers --- doc/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 97d4b35c..236cb807 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -49,9 +49,9 @@ copyright = '2011, Luke Campagnola' # built documents. # # The short X.Y version. -version = '1.8' +version = '' # The full version, including alpha/beta/rc tags. -release = '1.8' +release = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From b9822b1d10e2820cb4a62cf47869130b1eeb4def Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 27 Dec 2012 03:13:35 -0500 Subject: [PATCH 6/8] Fixed doc version (again) Added debian control files --- doc/source/conf.py | 4 ++-- doc/source/index.rst | 4 ++-- pyqtgraph/__init__.py | 2 +- setup.py | 2 +- tools/DEBIAN/control | 13 +++++++++++++ tools/DEBIAN/postrm | 2 ++ 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 tools/DEBIAN/control create mode 100755 tools/DEBIAN/postrm diff --git a/doc/source/conf.py b/doc/source/conf.py index 236cb807..4a275cd1 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -49,9 +49,9 @@ copyright = '2011, Luke Campagnola' # built documents. # # The short X.Y version. -version = '' +version = '0.9.0' # The full version, including alpha/beta/rc tags. -release = '' +release = '0.9.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/index.rst b/doc/source/index.rst index 5d606061..cc89f3d8 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3,8 +3,8 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to the documentation for pyqtgraph 1.8 -============================================== +Welcome to the documentation for pyqtgraph +========================================== Contents: diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 93d9f7b8..2998be79 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -4,7 +4,7 @@ PyQtGraph - Scientific Graphics and GUI Library for Python www.pyqtgraph.org """ -__version__ = None +__version__ = '0.9.0' ### import all the goodies and add some helper functions for easy CLI use diff --git a/setup.py b/setup.py index 64d22ba2..5b608eda 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ if os.path.isdir(buildPath): distutils.dir_util.remove_tree(buildPath) setup(name='pyqtgraph', - version='', + version='0.9.0', description='Scientific Graphics and GUI Library for Python', long_description="""\ PyQtGraph is a pure-python graphics and GUI library built on PyQt4/PySide and numpy. diff --git a/tools/DEBIAN/control b/tools/DEBIAN/control new file mode 100644 index 00000000..d7c74bc7 --- /dev/null +++ b/tools/DEBIAN/control @@ -0,0 +1,13 @@ +Package: python-pyqtgraph +Version: 0.9.0 +Section: python +Priority: optional +Architecture: all +Essential: no +Installed-Size: 5048 +Maintainer: Luke Campagnola +Homepage: http://luke.campagnola.me/code/pyqtgraph +Depends: python (>= 2.6), python-qt4 | python-pyside, python-scipy, python-numpy +Suggests: python-opengl, python-qt4-gl +Description: Scientific Graphics and GUI Library for Python + PyQtGraph is a pure-python graphics and GUI library built on PyQt4 and numpy. It is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is very fast due to its heavy leverage of numpy for number crunching and Qt's GraphicsView framework for fast display. diff --git a/tools/DEBIAN/postrm b/tools/DEBIAN/postrm new file mode 100755 index 00000000..35a4685c --- /dev/null +++ b/tools/DEBIAN/postrm @@ -0,0 +1,2 @@ +#!/bin/sh +rm -rf /usr/lib/python2.7/dist-packages/pyqtgraph From 87ea160a2360aac41a48f1218554a163cff25171 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Thu, 27 Dec 2012 10:31:08 -0500 Subject: [PATCH 7/8] Correction to setup.py - use install_requires to inform pip of dependencies. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5b608eda..8833b1d8 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ It is intended for use in mathematics / scientific / engineering applications. D "Topic :: Scientific/Engineering :: Visualization", "Topic :: Software Development :: User Interfaces", ], - requires = [ + install_requires = [ 'numpy', 'scipy', ], From 8d5e24c8fdb46e14f496d6d136a8d044eea7ef53 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 27 Dec 2012 11:53:22 -0500 Subject: [PATCH 8/8] Removed incorrect version numbers --- doc/source/conf.py | 4 ++-- pyqtgraph/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 4a275cd1..236cb807 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -49,9 +49,9 @@ copyright = '2011, Luke Campagnola' # built documents. # # The short X.Y version. -version = '0.9.0' +version = '' # The full version, including alpha/beta/rc tags. -release = '0.9.0' +release = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 2998be79..93d9f7b8 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -4,7 +4,7 @@ PyQtGraph - Scientific Graphics and GUI Library for Python www.pyqtgraph.org """ -__version__ = '0.9.0' +__version__ = None ### import all the goodies and add some helper functions for easy CLI use diff --git a/setup.py b/setup.py index 8833b1d8..8128a851 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ if os.path.isdir(buildPath): distutils.dir_util.remove_tree(buildPath) setup(name='pyqtgraph', - version='0.9.0', + version='', description='Scientific Graphics and GUI Library for Python', long_description="""\ PyQtGraph is a pure-python graphics and GUI library built on PyQt4/PySide and numpy.