You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/05/08 00:29:11 UTC
[37/50] [abbrv] git commit: [#6133] remove histogram,
and matplotlib & numpy dependences
[#6133] remove histogram, and matplotlib & numpy dependences
Only remaining use of matplotlib was a histogram (bar chart)
of a user's projects per trove category. This is a simple chart
and the data is available in a table, so not worth the very big
and complex dependencies of matplotlib and numpy and associated
workarounds due to them. So removing the histogram, dependencies,
and workarounds.
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3e12f6d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3e12f6d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3e12f6d5
Branch: refs/heads/tv/4321
Commit: 3e12f6d574d4685c0bed84e3ae95772b24cd6425
Parents: b21778f
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Sat May 4 23:03:06 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon May 6 21:34:31 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/graphics/__init__.py | 16 ---
Allura/allura/lib/graphics/graphic_methods.py | 86 ---------------
Allura/docs/conf.py | 25 ----
.../forgeuserstats/controllers/userstats.py | 30 -----
ForgeUserStats/forgeuserstats/templates/index.html | 9 --
requirements-common.txt | 2 -
vagrant/manifests/ubuntu-1204-server-amd64.pp | 14 ---
7 files changed, 0 insertions(+), 182 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/Allura/allura/lib/graphics/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/graphics/__init__.py b/Allura/allura/lib/graphics/__init__.py
deleted file mode 100644
index 144e298..0000000
--- a/Allura/allura/lib/graphics/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/Allura/allura/lib/graphics/graphic_methods.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/graphics/graphic_methods.py b/Allura/allura/lib/graphics/graphic_methods.py
deleted file mode 100644
index 777cfc0..0000000
--- a/Allura/allura/lib/graphics/graphic_methods.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import StringIO
-
-from matplotlib.backends.backend_agg import FigureCanvasAgg
-from matplotlib.figure import Figure
-import Image
-
-
-def create_histogram(data, tick_labels, y_label, title):
- fig = Figure(figsize=(10,5), dpi=80, facecolor='white')
- ax = fig.add_subplot(111, axisbg='#EEEEFF')
-
- canvas = FigureCanvasAgg(fig)
- n, bins, patches = ax.hist(data, facecolor='#330099', edgecolor='white')
- ax.set_ylabel(y_label)
- ax.set_title(title)
-
- ax.set_xticks(range(len(tick_labels)+1))
- ax.get_xaxis().set_ticklabels(tick_labels, rotation=45, va='top', ha='right')
- ax.get_xaxis().set_ticks_position('none')
- ax.set_autoscalex_on(False)
-
- ax.set_xlim((-1, len(tick_labels)))
- ax.set_ylim((0, 1+max([data.count(el) for el in data])))
- fig.subplots_adjust(bottom=0.3)
-
- canvas.draw()
-
- s = canvas.tostring_rgb()
- l,b,w,h = fig.bbox.bounds
- w, h = int(w), int(h)
-
- output = StringIO.StringIO()
- im = Image.fromstring( "RGB", (w,h), s)
- im.save(output, 'PNG')
-
- return output.getvalue()
-
-def create_progress_bar(value):
- value = value / 100.0
- if value < 1 / 5.0:
- color = 'red'
- elif value < 2 / 5.0:
- color = 'orange'
- elif value < 3 / 5.0:
- color = 'yellow'
- elif value < 4 / 5.0:
- color = 'lightgreen'
- else:
- color = 'green'
-
- fig = Figure(figsize=(3,0.5), dpi=40, facecolor='gray')
- canvas = FigureCanvasAgg(fig)
- canvas.draw()
-
- from matplotlib.patches import Rectangle
- from matplotlib.axes import Axes
-
- fig.draw_artist(Rectangle((0,0), int(value * 120), 20, color=color))
- fig.draw_artist(Rectangle((1,0), 119, 19, fill=False, ec='black'))
-
- l,b,w,h = fig.bbox.bounds
- s = canvas.tostring_rgb()
- w, h = int(w), int(h)
-
- output = StringIO.StringIO()
- im = Image.fromstring( "RGB", (w,h), s)
- im.save(output, 'PNG')
-
- return output.getvalue()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/Allura/docs/conf.py
----------------------------------------------------------------------
diff --git a/Allura/docs/conf.py b/Allura/docs/conf.py
index 81c0e1f..f7d8757 100644
--- a/Allura/docs/conf.py
+++ b/Allura/docs/conf.py
@@ -30,31 +30,6 @@
import sys, os
-class Mock(object):
- def __init__(self, *args, **kwargs):
- pass
-
- def __call__(self, *args, **kwargs):
- return Mock()
-
- @classmethod
- def __getattr__(cls, name):
- if name in ('__file__', '__path__'):
- return '/dev/null'
- elif name[0] == name[0].upper():
- mockType = type(name, (), {})
- mockType.__module__ = __name__
- return mockType
- else:
- return Mock()
-
-MOCK_MODULES = ['matplotlib', 'matplotlib.axes',
- 'matplotlib.backends', 'matplotlib.backends.backend_agg',
- 'matplotlib.figure', 'matplotlib.patches']
-
-for mod_name in MOCK_MODULES:
- sys.modules[mod_name] = Mock()
-
# If extensions (or modules to document with autodoc) are in another directory,
# 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.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/ForgeUserStats/forgeuserstats/controllers/userstats.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/controllers/userstats.py b/ForgeUserStats/forgeuserstats/controllers/userstats.py
index 1cb5505..85b26df 100644
--- a/ForgeUserStats/forgeuserstats/controllers/userstats.py
+++ b/ForgeUserStats/forgeuserstats/controllers/userstats.py
@@ -20,7 +20,6 @@ from tg.decorators import with_trailing_slash
from datetime import datetime
from allura.controllers import BaseController
import allura.model as M
-from allura.lib.graphics.graphic_methods import create_histogram, create_progress_bar
from forgeuserstats.model.stats import UserStats
from pylons import tmpl_context as c
from allura.lib.security import require_access
@@ -195,35 +194,6 @@ class ForgeUserStatsController(BaseController):
user=self.user,
data=artifacts)
- @expose()
- def categories_graph(self):
- self.user = c.project.user_project_of
- if not self.user:
- return None
-
- categories = {}
- for p in self.user.my_projects():
- for cat in p.trove_topic:
- cat = M.TroveCategory.query.get(_id = cat)
- if categories.get(cat):
- categories[cat] += 1
- else:
- categories[cat] = 1
- data = []
- labels = []
- i = 0
- for cat in sorted(categories.keys(), key=lambda x:x.fullname):
- n = categories[cat]
- data = data + [i] * n
- label = cat.fullname
- if len(label) > 15:
- label = label[:15] + "..."
- labels.append(label)
- i += 1
-
- return create_histogram(data, labels,
- 'Number of projects', 'Projects by category')
-
def _getDataForCategory(category, stats):
totcommits = stats.getCommits(category)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/ForgeUserStats/forgeuserstats/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/templates/index.html b/ForgeUserStats/forgeuserstats/templates/index.html
index 2bb6314..406fb20 100644
--- a/ForgeUserStats/forgeuserstats/templates/index.html
+++ b/ForgeUserStats/forgeuserstats/templates/index.html
@@ -381,15 +381,6 @@
{% endfor %}
</tbody>
</table>
-
- {% if categories|length > 1 %}
- <p>
- The same data listed in the previous table is graphically presented by the following histogram.
- </p>
- <p>
- <img src="{{c.project.url()}}userstats/categories_graph"/>
- </p>
- {% endif %}
{% endif %}
{% else %}
{% if user %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/requirements-common.txt
----------------------------------------------------------------------
diff --git a/requirements-common.txt b/requirements-common.txt
index 75f4541..21ea929 100644
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -47,8 +47,6 @@ TurboGears2==2.1.5
WebOb==1.0.8
# part of the stdlib, but with a version number. see http://guide.python-distribute.org/pip.html#listing-installed-packages
wsgiref==0.1.2
-numpy==1.6.1
-matplotlib==1.1.1
# tg2 deps (not used directly)
Babel==0.9.6
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e12f6d5/vagrant/manifests/ubuntu-1204-server-amd64.pp
----------------------------------------------------------------------
diff --git a/vagrant/manifests/ubuntu-1204-server-amd64.pp b/vagrant/manifests/ubuntu-1204-server-amd64.pp
index 1feb18e..4031084 100644
--- a/vagrant/manifests/ubuntu-1204-server-amd64.pp
+++ b/vagrant/manifests/ubuntu-1204-server-amd64.pp
@@ -107,19 +107,6 @@ file { '/home/vagrant/src/allura':
require => [ File['/home/vagrant/src'], Exec['clone repo'] ],
}
-# HACK to get numpy installed in the venv before installing
-# remaining dependencies via requirements file
-exec { "pip install numpy":
- command => "/home/vagrant/env-allura/bin/pip install numpy==1.6.1",
- cwd => "/vagrant/allura",
- timeout => 0,
- logoutput => true,
- returns => 0,
- tries => 3,
- require => [ Exec[ "clone repo"], Exec[ "create allura venv" ],
- ],
-}
-
# install Allura dependencies
exec { "pip install":
command => "/home/vagrant/env-allura/bin/pip install -r requirements.txt",
@@ -132,7 +119,6 @@ exec { "pip install":
tries => 3,
require => [ Exec[ "clone repo"], Exec[ "create allura venv" ],
File["/usr/lib/libjpeg.so"], File["/usr/lib/libz.so"],
- Exec["pip install numpy"],
],
}