Apologies for bringing this up past the 1.1 feature deadline, but
since this isn't a feature perhaps it'll be OK :)

Currently, Django bundles a copy of simplejson[1], at
django.utils.simplejson. We use this solely in the serialization
system to support dumping to and loading from JSON fixtures.

This presents several problems:

1. Because we exclusively look for Django's copy of simplejson, we
   naturally cannot take advantage of bugfixes or performance
   improvements in simplejson unless/until we integrate them into the
   bundled copy.

2. This in turn creates a maintenance headache and a source of
   potential bugs (e.g., one found recently by someone using NetBeans
   to report unresolved symbols[2]).

3. We constantly get into debates about when and how often to update
   our bundled copy of simplejson.

4. We occasionally get into debates over whether Django ought to first
   search for a system-installed copy of simplejson or for the "json"
   module (simplejson under a new name) which exists in the Python
   standard library as of Python 2.6[3].

It is occasionally stated that Django tries, as much as possible, to
avoid having many dependencies out of the box and, if this is true,
then bundling simplejson may make sense despite the above problems, as
it means there's one less piece of software people need to install to
use Django.

But this argument doens't really hold water, because we already
require people to install:

* A database adapter (unless on Python 2.5+ and using SQLite).

* PIL, to use ImageField.

* The Python memcached bindings to use memcached.

* Perversely, Jing to use XMLField.

* flup to use FastCGI/SCGI/AJP.

* A whole pile of stuff to use django.contrib.gis.

* And, most damning for th case of something that's only bundled to
  support serialization, PyYAML for YAML serialization.

I'm sure there are more dependencies lurking out there, actually,
depending on which bits of Django people want to use, but hopefully
the point is made: any argument based on "Django doesn't have
dependencies" falls flat, because Django's always had various
dependencies for the core framework and various others for additional
functionality.

Given this, the fact that it's trivially easy to install simplejson
(and it's bundled with Python these days) and the fact that it creates
a number of problems, I'd like to propose that we begin the process of
deprecating and removing django.utils.simplejson in favor of
system-installed simplejson or Python 2.6 json. Since eventually we'll
have to get to Python 2.6/3.0 anyway (see my earlier Stephensonian
post regarding *that* migration process) and when we do there'll be
literally no point to bundling our own copy, we can even view this
simply as getting a head start on the process.

The only remaining argument I can see against unbundling simplejson is
that it would break backwards compatibility in the 1.x release
series. While this is undoubtedly a pedantic answer, the API stability
document[4] is quite clear about which parts of Django constitute
stable, supported APIs, and django.utils.simplejson is not one of
those parts (in fact, most of django.utils is not).

This leaves only the question of how, precisely, we'll get simplejson
out of Django. One possibility would be to deprecate and remove over a
period of releases, and this would be consistent with, e.g., how
Python typically handles this problem. Such a process might look like
this:

* Django 1.1: JSON serialization looks for system json/simplejson
  first, fall back to django.utils.simplejson if not found and warn
  with PendingDeprecationWarning whenever django.utils.simplejson is
  used.

* Django 1.2: Continue looking for system json/simplejson and falling
  back, but the PendingDeprecationWarning becomes a
  DeprecationWarning.

* Django 1.3: django.utils.simplejson is removed, and attempting to
  use it simply gets you an ImportError. Use of JSON serialization
  will require separate installation of simplejson, or Python 2.6 with
  the json module.

In the meantime, django.utils.simplejson should basically cease being
maintained apart from bugs which interfere with the use of JSON
serialization; in other words, new versions of simplejson should not
be integrated into Django, and users should be advised that if they
want to use a newer version they should simply install it (since
Django will start using system json/simplejson when available).

So... thoughts?


[1] http://pypi.python.org/pypi/simplejson
[2] http://blogs.sun.com/tor/entry/netbeans_screenshot_of_the_week1
[3] http://docs.python.org/dev/library/json.html
[4] http://docs.djangoproject.com/en/dev/misc/api-stability/#misc-api-stability


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to