Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For an overview of some application concepts see the [wiki page](https://github.

## Installation

You will need Python 2.7 or 3.5+.
You will need Python 3.12 or newer.

To install dependencies and the codespeed Django app:

Expand Down
2 changes: 0 additions & 2 deletions codespeed/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from django import forms
from django.contrib import admin

Expand Down
4 changes: 0 additions & 4 deletions codespeed/commits/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals


class CommitLogError(Exception):
"""An error when trying to display commit log messages"""
11 changes: 1 addition & 10 deletions codespeed/commits/github.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
# encoding: utf-8
"""
Specialized Git backend which uses Github.com for all of the heavy work

Among other things, this means that the codespeed server doesn't need to have
git installed, the ability to write files, etc.
"""
from __future__ import absolute_import

import logging
try:
# Python 3
from urllib.request import urlopen
from urllib.request import Request
except ImportError:
# Python 2
from urllib2 import urlopen
from urllib2 import Request
from urllib.request import urlopen, Request
import re
import json

Expand Down
3 changes: 0 additions & 3 deletions codespeed/commits/logs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

import datetime
import logging

Expand Down
3 changes: 0 additions & 3 deletions codespeed/commits/mercurial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import os
import datetime
from subprocess import Popen, PIPE
Expand Down
2 changes: 0 additions & 2 deletions codespeed/commits/subversion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
"""Subversion commit logs support"""
from __future__ import absolute_import

from datetime import datetime

Expand Down
3 changes: 0 additions & 3 deletions codespeed/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions codespeed/migrations/0002_median.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
2 changes: 0 additions & 2 deletions codespeed/migrations/0003_project_default_branch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-08-04 03:45
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
9 changes: 3 additions & 6 deletions codespeed/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

import logging
import os
import json
Expand Down Expand Up @@ -238,7 +235,7 @@ class Result(models.Model):
Environment, on_delete=models.CASCADE, related_name="results")

def __str__(self):
return u"%s: %s" % (self.benchmark.name, self.value)
return "%s: %s" % (self.benchmark.name, self.value)

class Meta:
unique_together = ("revision", "executable", "benchmark", "environment")
Expand All @@ -256,7 +253,7 @@ class Report(models.Model):
_tablecache = models.TextField(blank=True)

def __str__(self):
return u"Report for %s" % self.revision
return "Report for %s" % self.revision

class Meta:
unique_together = ("revision", "executable", "environment")
Expand Down Expand Up @@ -364,7 +361,7 @@ def updown(self, val):
direction = val >= 0 and "up" or "down"
aval = abs(val)
if aval == float("inf"):
return u"%s ∞%%" % direction
return "%s ∞%%" % direction
else:
return "%s %.1f%%" % (direction, aval)

Expand Down
3 changes: 0 additions & 3 deletions codespeed/results.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import logging

from django.core.exceptions import ValidationError
Expand Down
1 change: 0 additions & 1 deletion codespeed/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Default settings for Codespeed"""

## General default options ##
Expand Down
2 changes: 0 additions & 2 deletions codespeed/templatetags/percentages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from django import template

register = template.Library()
Expand Down
2 changes: 0 additions & 2 deletions codespeed/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from unittest import mock

from django.test import TestCase, override_settings
Expand Down
1 change: 0 additions & 1 deletion codespeed/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import os

from django.conf import settings
Expand Down
3 changes: 1 addition & 2 deletions codespeed/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import copy
import json
Expand Down Expand Up @@ -374,7 +373,7 @@ def test_gettimelinedata(self):
"There are 2 datapoints")
self.assertEqual(
responsedata['timelines'][0]['branches']['master']['1'][1],
[u'2011/04/13 17:04:22 +0000', 2000.0, 1.11111, u'2', u'', u'master'])
['2011/04/13 17:04:22 +0000', 2000.0, 1.11111, '2', '', 'master'])


@override_settings(ALLOW_ANONYMOUS_POST=True)
Expand Down
1 change: 0 additions & 1 deletion codespeed/tests/test_views_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test import override_settings

Expand Down
1 change: 0 additions & 1 deletion codespeed/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.urls import re_path
from django.views.generic import TemplateView

Expand Down
3 changes: 0 additions & 3 deletions codespeed/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

import json
import logging

Expand Down
3 changes: 0 additions & 3 deletions codespeed/views_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import get_object_or_404
Expand Down
10 changes: 4 additions & 6 deletions sample_project/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# encoding: utf-8

from urlparse import urljoin
import logging
import platform
import urllib
import sys
from urllib.parse import urlencode, urljoin
from urllib.request import urlopen


def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
Expand Down Expand Up @@ -57,7 +55,7 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
if not data.get('environment', None):
data['environment'] = platform.platform(aliased=True)

f = urllib.urlopen(url, urllib.urlencode(data))
f = urlopen(url, urlencode(data).encode())

response = f.read()
status = f.getcode()
Expand Down Expand Up @@ -117,6 +115,6 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
try:
save_to_speedcenter(**kwargs)
sys.exit(0)
except StandardError as e:
except Exception as e:
logging.error("Error saving results: %s", e)
sys.exit(1)
1 change: 0 additions & 1 deletion sample_project/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Django settings for a Codespeed project.
import os

Expand Down
2 changes: 0 additions & 2 deletions sample_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from django.conf import settings
from django.urls import include, re_path
from django.contrib import admin
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
download_url="https://github.com/tobami/codespeed/tags",
license='GNU Lesser General Public License version 2.1',
keywords=['benchmarking', 'visualization'],
install_requires=[ 'django', 'isodate', 'matplotlib'],
python_requires='>=3.12',
install_requires=['django>=5.2,<7', 'isodate', 'matplotlib'],
packages=find_packages(exclude=['ez_setup', 'sample_project', 'speed_python']),
setup_requires=['setuptools-markdown'],
long_description_markdown_filename='README.md',
Expand All @@ -23,12 +24,11 @@
'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
]
)
10 changes: 4 additions & 6 deletions speed_python/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# encoding: utf-8

from urlparse import urljoin
import logging
import platform
import urllib
import sys
from urllib.parse import urlencode, urljoin
from urllib.request import urlopen


def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
Expand Down Expand Up @@ -57,7 +55,7 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
if not data.get('environment', None):
data['environment'] = platform.platform(aliased=True)

f = urllib.urlopen(url, urllib.urlencode(data))
f = urlopen(url, urlencode(data).encode())

response = f.read()
status = f.getcode()
Expand Down Expand Up @@ -117,6 +115,6 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None,
try:
save_to_speedcenter(**kwargs)
sys.exit(0)
except StandardError, e:
except Exception as e:
logging.error("Error saving results: %s", e)
sys.exit(1)
2 changes: 0 additions & 2 deletions speed_python/generate_secret.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import print_function

import os

from django.utils.crypto import get_random_string
Expand Down
1 change: 0 additions & 1 deletion speed_python/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Django settings for a Codespeed project.
import os

Expand Down
2 changes: 0 additions & 2 deletions speed_python/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os.path

from django.conf import settings
Expand Down
3 changes: 1 addition & 2 deletions tools/create_trunks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Create the default branch for all existing projects
Starting v 0.8.0 that is mandatory.
Expand Down Expand Up @@ -49,7 +48,7 @@ def main():
if not proj.branches.filter(name='default'):
trunk = Branch(name='default', project=proj)
trunk.save()
print "Created branch 'default' for project {0}".format(proj)
print("Created branch 'default' for project {0}".format(proj))


if __name__ == '__main__':
Expand Down
1 change: 0 additions & 1 deletion tools/migrate_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Adds the default branch to all existing revisions

Note: This file is assumed to be in the same directory
Expand Down
20 changes: 11 additions & 9 deletions tools/pypy/import_from_json.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
################################################################################
# This script imports PyPy's result data from json files located on the server #
################################################################################
import simplejson, urllib2
import json
import urllib.error
import urllib.parse
import urllib.request
import sys
from xml.dom.minidom import parse
from datetime import datetime
Expand All @@ -21,7 +23,7 @@
# get json filenames
filelist = []
try:
datasource = urllib2.urlopen(RESULTS_URL)
datasource = urllib.request.urlopen(RESULTS_URL)
dom = parse(datasource)
for elem in dom.getElementsByTagName('td'):
for e in elem.childNodes:
Expand All @@ -31,24 +33,24 @@
if int(filename.replace(".json", "")) >= START_REV and\
int(filename.replace(".json", "")) <= END_REV:
filelist.append(filename)
except urllib2.URLError, e:
except urllib.error.URLError as e:
response = "None"
if hasattr(e, 'reason'):
response = '\n We failed to reach ' + RESULTS_URL + '\n'
response += ' Reason: ' + str(e.reason)
elif hasattr(e, 'code'):
response = '\n The server couldn\'t fulfill the request\n'
response += ' Error code: ' + str(e)
print "Results Server (%s) response: %s\n" % (RESULTS_URL, response)
print("Results Server (%s) response: %s\n" % (RESULTS_URL, response))
sys.exit(1)
finally:
datasource.close()

# read json result and save to speed.pypy.org
for filename in filelist:
print "Reading %s..." % filename
f = urllib2.urlopen(RESULTS_URL + filename)
result = simplejson.load(f)
print("Reading %s..." % filename)
f = urllib.request.urlopen(RESULTS_URL + filename)
result = json.load(f)
f.close()
proj = PROJECT
revision = result['revision']
Expand All @@ -62,4 +64,4 @@
#saveresults.save(proj, revision, result['results'], options, interpreter, host)
if filename == filelist[len(filelist)-1]:
savecpython.save('cpython', '100', result['results'], options, 'cpython', host)
print "\nOK"
print("\nOK")
Loading
Loading