Skip to content
Merged
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
6 changes: 5 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Codespeed is written and maintained by Miquel Torres Barceló and various contributors:
Codespeed was written by Miquel Torres Barceló and various contributors:

Frank Becker
Chris Adams
Expand Down Expand Up @@ -32,3 +32,7 @@ Codespeed is written and maintained by Miquel Torres Barceló and various contri
Octavian Moraru
Iskander (Alex) Sharipov
Tim (Timmmm)

This fork, which powers speed.python.org and speed.pypy.org, is developed
independently of tobami/codespeed at https://github.com/python/codespeed.
Its contributors are recorded in the Git history.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Change Log ==

This file records the releases of the original tobami/codespeed project and
ends with its last release, 0.13.0. The python/codespeed fork does not cut
releases, its changes since then are described by Git history.

=== Version 0.13.0, February 23, 2019 ===
* NEW #263: Added support for Django 2.1, drop support for Django 1.8
* NEW #255: Allow partial requests of timeline grid
Expand Down
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Codespeed
[![Tests](https://github.com/python/codespeed/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/python/codespeed/actions/workflows/test.yml)
[![PyPI version](https://img.shields.io/pypi/v/codespeed.svg)](https://pypi.python.org/pypi/codespeed)

Codespeed is a web application to monitor and analyze the performance of your code.

Known to be used by [CPython](https://speed.python.org), [PyPy](http://speed.pypy.org), [Twisted](http://speed.twistedmatrix.com) and others.
This started as a fork of [tobami/codespeed](https://github.com/tobami/codespeed),
however it is now developed independently here, and has different requirements.
The `codespeed` Django app is still generic and could possibly be used for other
projects. `speed_python` and `speed_pypy` hold what is specific to the two sites.

For an overview of some application concepts see the [wiki page](https://github.com/tobami/codespeed/wiki/Overview)
For an overview of some application concepts see the original project's
[wiki page](https://github.com/tobami/codespeed/wiki/Overview).

## Installation

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

To install dependencies and the codespeed Django app:
Clone this repository and install the dependencies:

pip install codespeed
git clone https://github.com/python/codespeed.git
cd codespeed
pip install -r requirements.txt

If you want version control integration, there are additional requirements:

Expand All @@ -27,8 +32,6 @@ If you want version control integration, there are additional requirements:
Codespeed will try to clone the repo, which depending on the size of the project
can take a long time. Please be patient.

* Download the last stable release from
[github.com/tobami/codespeed/tags](https://github.com/tobami/codespeed/tags), unpack it and install it with `python setup.py install`.
* To get started, you can use the `sample_project` directory as a starting point for your Django project, which can be normally configured by editing `sample_project/settings.py`.
* For simplicity, you can use the default sqlite configuration, which will save
the data to a database named `data.db`
Expand All @@ -48,7 +51,6 @@ The codespeed installation can now be accessed by navigating to `http://localhos

**Note**: for production, you should configure a real server like Apache or nginx (refer to the [Django docs](http://docs.djangoproject.com/en/dev/howto/deployment/)). You should also
modify `sample_project/settings.py` and set `DEBUG = False`.
[`sample_project/README.md`](https://github.com/tobami/codespeed/tree/master/sample_project/README.md) also describes some production settings.

### Running the tests

Expand Down Expand Up @@ -245,13 +247,14 @@ COMP_EXECUTABLES = [
which have low rate limits so an exception may be thrown when retrieving info
from the Github API due to the rate limit being reached.

## Getting help
## Getting help and reporting bugs

For help regarding the configuration of Codespeed, or to share any ideas or
suggestions you may have, please post on Codespeed's [discussion
group](http://groups.google.com/group/codespeed)
Questions, suggestions and bug reports for this fork belong on the
[GitHub issue tracker](https://github.com/python/codespeed/issues).
The original project's Google group and issue tracker are no longer active.

## Reporting bugs
## History and license

If you find any bug in Codespeed please report it on the
[Github issue tracker](https://github.com/tobami/codespeed/issues)
Codespeed was written by Miquel Torres and contributors (see `AUTHORS`). It is
licensed under the GNU Lesser General Public License v2.1 (see `LICENSE`), this
fork keeps that license.
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
3 changes: 0 additions & 3 deletions codespeed/commits/exceptions.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


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 Request, urlopen
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
15 changes: 6 additions & 9 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 @@ -77,10 +74,10 @@ def save(self, *args, **kwargs):
m.group('username'), m.group('project')
)
self.commit_browsing_url = url
super(Project, self).save(*args, **kwargs)
super().save(*args, **kwargs)


class HistoricalValue(object):
class HistoricalValue:
def __init__(self, name=None, val=0, color='none'):
self.name = name
self.val = val
Expand Down Expand Up @@ -241,7 +238,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 @@ -259,7 +256,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 All @@ -270,7 +267,7 @@ def save(self, *args, **kwargs):
changes = self.aggregate_significant_changes(tablelist)
self.update_to_highest_priority_change(changes)

super(Report, self).save(*args, **kwargs)
super().save(*args, **kwargs)

def update_to_highest_priority_change(self, changes):
average_change = changes['average_change']
Expand Down Expand Up @@ -367,7 +364,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 datetime import datetime

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_commits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import shutil
import subprocess
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 json
import os

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 @@ -465,7 +464,7 @@ def test_gettimelinedata(self):
"There are 2 datapoints")
self.assertEqual(
responsedata['timelines'][0]['branches']['master']['1:1'][1],
[u'2011/04/13 17:04:22 +0000', 2000.0, 1.11111, u'2', u'', u'master', u''])
['2011/04/13 17:04:22 +0000', 2000.0, 1.11111, '2', '', 'master', ''])

def test_no_source_fold_with_one_source(self):
"""A single source shows a flat benchmark list and no fold header"""
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 codespeed import views
Expand Down
5 changes: 1 addition & 4 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
import os
Expand Down Expand Up @@ -74,7 +71,7 @@ class HomeView(TemplateView):
template_name = "home.html"

def get_context_data(self, **kwargs):
context = super(HomeView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['show_reports'] = settings.SHOW_REPORTS
context['show_historical'] = settings.SHOW_HISTORICAL
historical_settings = ['SHOW_HISTORICAL', 'DEF_BASELINES', 'DEF_EXECUTABLES']
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('utf-8'))

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
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
version='0.13.0',
author='Miquel Torres',
author_email='tobami@gmail.com',
url='https://github.com/tobami/codespeed',
download_url="https://github.com/tobami/codespeed/tags",
url='https://github.com/python/codespeed',
download_url='https://github.com/python/codespeed/tags',
license='GNU Lesser General Public License version 2.1',
keywords=['benchmarking', 'visualization'],
python_requires='>=3.10',
install_requires=['django', 'isodate', 'matplotlib'],
packages=find_packages(exclude=['ez_setup', 'sample_project', 'speed_python', 'speed_pypy']),
long_description='README.md',
Expand All @@ -23,12 +24,13 @@
'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.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
]
)
1 change: 0 additions & 1 deletion speed_pypy/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_pypy/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
8 changes: 3 additions & 5 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('utf-8'))

response = f.read()
status = f.getcode()
Expand Down
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
Loading
Loading