aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in5
-rw-r--r--README4
-rw-r--r--djangorestframework/__init__.py4
-rw-r--r--docs/index.rst38
-rw-r--r--examples/pygments_api/tests.py4
-rw-r--r--examples/pygments_api/views.py2
-rw-r--r--examples/runtests.py21
-rw-r--r--setup.py17
-rw-r--r--tox.ini24
9 files changed, 79 insertions, 40 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 00000000..fc9ce976
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,5 @@
+recursive-include djangorestframework/static *.ico *.txt
+recursive-include djangorestframework/templates *.txt *.html
+recursive-include examples .keep *.py *.txt
+recursive-include docs *.py *.rst *.html *.txt
+include AUTHORS LICENSE requirements.txt tox.ini
diff --git a/README b/README
index 70df13b8..6f28dc3a 100644
--- a/README
+++ b/README
@@ -34,3 +34,7 @@ sphinx-build -c docs -b html -d docs/build docs html
deactivate # Ensure we are not currently running in a virtualenv
tox
+
+# To create sdist packages
+
+python setup.py sdist --formats=gztar,zip
diff --git a/djangorestframework/__init__.py b/djangorestframework/__init__.py
index 522771b5..f85a516e 100644
--- a/djangorestframework/__init__.py
+++ b/djangorestframework/__init__.py
@@ -1 +1,3 @@
-VERSION="0.1.1"
+__version__ = '0.1.1'
+
+VERSION = __version__ # synonym
diff --git a/docs/index.rst b/docs/index.rst
index 452caa7c..4da2da1c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -11,11 +11,11 @@ Introduction
Django REST framework is a lightweight REST framework for Django, that aims to make it easy to build well-connected, self-describing RESTful Web APIs.
-**Browse example APIs created with Django REST framework:** `the sandbox <http://api.django-rest-framework.org/>`_
+**Browse example APIs created with Django REST framework:** `The Sandbox <http://api.django-rest-framework.org/>`_
Features:
-* Automatically provides a Django admin style `browse-able self-documenting API <http://api.django-rest-framework.org>`_.
+* Automatically provides an awesome Django admin style `browse-able self-documenting API <http://api.django-rest-framework.org>`_.
* Clean, simple, views for Resources, using Django's new `class based views <http://docs.djangoproject.com/en/dev/topics/class-based-views/>`_.
* Support for ModelResources with out-of-the-box default implementations and input validation.
* Pluggable :mod:`.emitters`, :mod:`parsers`, :mod:`validators` and :mod:`authenticators` - Easy to customise.
@@ -23,13 +23,20 @@ Features:
* Optional support for forms as input validation.
* Modular architecture - MixIn classes can be used without requiring the :class:`.Resource` or :class:`.ModelResource` classes.
-The django-rest-framework project is hosted as a `mercurial repository on bitbucket <https://bitbucket.org/tomchristie/django-rest-framework>`_ and is `available on PyPI <http://pypi.python.org/pypi/djangorestframework>`_.
+Resources
+---------
-For questions, thoughts and feedback please head on over to the `discussion group <http://groups.google.com/group/django-rest-framework>`_.
+**Project hosting:** `Bitbucket <https://bitbucket.org/tomchristie/django-rest-framework>`_ and `GitHub <https://github.com/tomchristie/django-rest-framework>`_.
-Bug reports are greatful received on the `issue tracker <https://bitbucket.org/tomchristie/django-rest-framework/issues?sort=version>`_.
+* The ``djangorestframework`` package is `available on PyPI <http://pypi.python.org/pypi/djangorestframework>`_.
+* We have an active `discussion group <http://groups.google.com/group/django-rest-framework>`_ and a `project blog <http://blog.django-rest-framework.org>`_.
+* Bug reports are handled on the `issue tracker <https://bitbucket.org/tomchristie/django-rest-framework/issues?sort=version>`_.
+* There is a `Jenkins CI server <http://datacenter.tibold.nl/job/djangorestframework/>`_ which tracks test status and coverage reporting. (Thanks Marko!)
+* Get with in touch with `@thisneonsoul <https://twitter.com/thisneonsoul>`_ on twitter.
-If you're feeling particularly enthusiastic there's even a `blog <http://blog.django-rest-framework.org>`_.
+Any and all questions, thoughts, bug reports and contributions are *hugely appreciated*.
+
+We'd like for this to be a real community driven effort, so come say hi, get involved, and get forking! (See: `Bitbucket <http://confluence.atlassian.com/display/BITBUCKET/Forking+a+Bitbucket+Repository>`_, `GitHub <http://help.github.com/fork-a-repo/>`_)
Requirements
------------
@@ -46,23 +53,24 @@ You can install Django REST framework using ``pip`` or ``easy_install``::
pip install djangorestframework
-Or download the current release from BitBucket:
+Or get the latest development version using mercurial or git::
-* `django-rest-framework-0.1.tar.gz <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.tar.gz>`_
-* `django-rest-framework-0.1.zip <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.zip>`_
+ hg clone https://bitbucket.org/tomchristie/django-rest-framework
+ git clone git@github.com:tomchristie/django-rest-framework.git
-Or get the latest development version using mercurial::
+Or you can download the current release:
- hg clone https://bitbucket.org/tomchristie/django-rest-framework
+* `django-rest-framework-0.1.tar.gz <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.tar.gz>`_
+* `django-rest-framework-0.1.zip <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.zip>`_
-To install Django REST framework to your ``site-packages`` directory, run the ``setup.py`` script::
+and then install Django REST framework to your ``site-packages`` directory, by running the ``setup.py`` script::
python setup.py install
-To add django-rest-framework to a Django project:
+**To add django-rest-framework to a Django project:**
- * Ensure that the ``djangorestframework`` directory is on your ``PYTHONPATH``.
- * Add ``djangorestframework`` to your ``INSTALLED_APPS``.
+* Ensure that the ``djangorestframework`` directory is on your ``PYTHONPATH``.
+* Add ``djangorestframework`` to your ``INSTALLED_APPS``.
For more information take a look at the :ref:`setup` section.
diff --git a/examples/pygments_api/tests.py b/examples/pygments_api/tests.py
index b4b01e8d..3bdc2ec5 100644
--- a/examples/pygments_api/tests.py
+++ b/examples/pygments_api/tests.py
@@ -28,12 +28,14 @@ class TestPygmentsExample(TestCase):
def test_snippets_datetime_sorted(self):
'''Pygments examples should be datetime sorted'''
locations = []
- for snippet in 'abcdefghijk':
+ for snippet in 'abcdefghij': # String length must not exceed views.MAX_FILES, otherwise test fails
form_data = {'code': '%s' % snippet, 'style':'friendly', 'lexer':'python'}
request = self.factory.post('/pygments', data=form_data)
view = views.PygmentsRoot.as_view()
response = view(request)
locations.append(response.items()[2][1])
+ import time
+ time.sleep(.1)
request = self.factory.get('/pygments')
view = views.PygmentsRoot.as_view()
response = view(request)
diff --git a/examples/pygments_api/views.py b/examples/pygments_api/views.py
index 6fb9217a..377761b1 100644
--- a/examples/pygments_api/views.py
+++ b/examples/pygments_api/views.py
@@ -25,7 +25,7 @@ def list_dir_sorted_by_ctime(dir):
"""Return a list of files sorted by creation time"""
filepaths = [os.path.join(dir, file) for file in os.listdir(dir) if not file.startswith('.')]
return [item[0] for item in sorted([(path, os.path.getctime(path)) for path in filepaths],
- key=operator.itemgetter(1), reverse=True)]
+ key=operator.itemgetter(1), reverse=False)]
def remove_oldest_files(dir, max_files):
"""Remove the oldest files in a directory 'dir', leaving at most 'max_files' remaining.
We use this to limit the number of resources in the sandbox."""
diff --git a/examples/runtests.py b/examples/runtests.py
index fd79bc64..fdd35839 100644
--- a/examples/runtests.py
+++ b/examples/runtests.py
@@ -4,10 +4,24 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.conf import settings
from django.test.utils import get_runner
+from coverage import coverage
def main():
+ """Run the tests for the examples and generate a coverage report."""
+
+ # Discover the list of all modules that we should test coverage for
+ project_dir = os.path.dirname(__file__)
+ cov_files = []
+ for (path, dirs, files) in os.walk(project_dir):
+ # Drop tests and runtests directories from the test coverage report
+ if os.path.basename(path) == 'tests' or os.path.basename(path) == 'runtests':
+ continue
+ cov_files.extend([os.path.join(path, file) for file in files if file.endswith('.py')])
TestRunner = get_runner(settings)
-
+
+ cov = coverage()
+ cov.erase()
+ cov.start()
if hasattr(TestRunner, 'func_name'):
# Pre 1.2 test runners were just functions,
# and did not support the 'failfast' option.
@@ -19,8 +33,11 @@ def main():
failures = TestRunner(None)
else:
test_runner = TestRunner()
- failures = test_runner.run_tests(None)
+ failures = test_runner.run_tests(['blogpost', 'pygments_api'])
+ cov.stop()
+ cov.report(cov_files)
+ cov.xml_report(cov_files)
sys.exit(failures)
if __name__ == '__main__':
diff --git a/setup.py b/setup.py
index b57a935d..2ee0628c 100644
--- a/setup.py
+++ b/setup.py
@@ -3,13 +3,19 @@
from setuptools import setup
+import os, re
+
+path = os.path.join(os.path.dirname(__file__), 'djangorestframework', '__init__.py')
+init_py = open(path).read()
+VERSION = re.match("__version__ = '([^']+)'", init_py).group(1)
+
setup(
- name = "djangorestframework",
- version = "0.1",
+ name = 'djangorestframework',
+ version = VERSION,
url = 'https://bitbucket.org/tomchristie/django-rest-framework/wiki/Home',
download_url = 'https://bitbucket.org/tomchristie/django-rest-framework/downloads',
license = 'BSD',
- description = "A lightweight REST framework for Django.",
+ description = 'A lightweight REST framework for Django.',
author = 'Tom Christie',
author_email = 'tom@tomchristie.com',
packages = ['djangorestframework',
@@ -30,8 +36,3 @@ setup(
'Topic :: Internet :: WWW/HTTP',
]
)
-
-#import os, shutil
-#shutil.rmtree(os.path.join(os.path.dirname(__file__), 'djangorestframework.egg-info'), True)
-
-
diff --git a/tox.ini b/tox.ini
index 27c8e806..47bb3880 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,42 +28,42 @@ basepython=python2.5
deps=
django==1.2.4
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py26-django12]
basepython=python2.6
deps=
django==1.2.4
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py27-django12]
basepython=python2.7
deps=
django==1.2.4
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py25-django13]
basepython=python2.5
deps=
django==1.3
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py26-django13]
basepython=python2.6
deps=
django==1.3
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py27-django13]
basepython=python2.7
deps=
django==1.3
coverage==3.4
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
####################################### EXAMPLES ################################################
@@ -78,7 +78,7 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py26-django12e]
basepython=python2.6
@@ -91,7 +91,7 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py27-django12e]
basepython=python2.7
@@ -104,7 +104,7 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py25-django13e]
basepython=python2.5
@@ -117,7 +117,7 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py26-django13e]
basepython=python2.6
@@ -130,7 +130,7 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip
+ unittest-xml-reporting==1.2
[testenv:py27-django13e]
basepython=python2.7
@@ -143,4 +143,4 @@ deps=
Pygments==1.4
httplib2==0.6.0
Markdown==2.0.3
- https://github.com/downloads/markotibold/unittest-xml-reporting/unittest-xml-reporting-1.1.zip \ No newline at end of file
+ unittest-xml-reporting==1.2 \ No newline at end of file