A brief history of speed

During the development process of PyAMF, three things were (and still are!) highly valued - compatibility (primarily) with the Flash Player, stability and features. We now have a pretty substantial test suite that ensures that we don't break anything (and if we do, the buildbots will let us know) from commit to commit.

One thing that was not given a whole lot of thought during all this was performance. Everyone knows the danger of premature optimisation so with the release of PyAMF 0.6 (still currently in beta) I wanted to show the performance improvements that have been made since the release of 0.4.

PyAMF provides pure python AMF codecs as well as an optional C extension. The pure python version allows PyAMF to run on App Engine, Jython and PyPy but runs 100% within the interpreter. This means all byte packing (AMF is a binary format), reference checking (AMF supports object references), type checking is done relatively inefficiently (when compared to C). If you are using CPython then you be able to take advantage of CPyAMF which is a Cython package developed specifically to relieve the interpreter of these responsibilities.

CPyAMF was initially introduced in 0.4 and ...

PyAMF 0.6b2 released

I am pleased to announce the release of PyAMF 0.6b2.

PyAMF implements Adobe's ActionScript Message Format such that Python applications can natively talk to Flash and Air applications.

Highlights of this release:

  • A huge performance boost, especially for the c-extensions. Current benchmarks put this around an order of magnitude faster than 0.5.1 (pure python version is around 30% faster)
  • Dropped support for Python 2.3, a start to a march to Python 3 compatibility
  • Provide support for Django >= 1.2 and SQLAlchemy >= 0.6
  • Switched the client from httplib to urllib2 and provided support for session cookies, gzip encoded responses and more!
  • Provided support for AppEngine's BlobReferenceProperty
  • Property synonyms are now supported
  • Default AMF version has been switched from AMF0 to AMF3

For a detailed list of changes, see the change log.

To download this release either grab a compressed file, use pip install pyamf or easy_install -U pyamf or grab the source.

Check out the download page and installation instructions.

Got questions? First stop is the mailing list or IRC.

Adobe AIR 2 example: UDP sockets with PyAMF and Twisted

The upcoming release of Adobe AIR will provide support for UDP sockets, allowing you to send and receive messages using the Universal Datagram Protocol (UDP).

We created an example, using Adobe AIR 2.0 and the PyAMF and Twisted libraries for Python, that echoes ByteArray messages every x seconds to a Twisted UDP server. The example application also enumerates available hardware and software network interfaces on the client computer using the new NetworkInfo API.

Read more in the tutorial.

screenshot of the example

PyAMF 0.5 released

PyAMF is a lightweight library that allows Flash Player and Python applications to communicate via Adobe's ActionScript Message Format.

PyAMF 0.5 is a cleanup of the internals of 0.4 and it provides some performance optimisations. In accomplishing this, a number of features were added.

  • A new way to handle attribute en/decoding. New features include excluding attributes, read-only attributes, and proxied attributes. If you use external classes, this one is also for you. Check the wiki for more details.
  • The lazy loading module (pyamf.util.imports) that powers the adapter modules has been completely revamped. There were too many edge cases that would cause problems in the import mechanism. We now supply a module finder/loader in sys.meta_path so we can intercept the import calls. This has completely cleared up the problems we were seeing and it has the added benefit of halving the time it took to run the 650+ unit tests in the suite!
  • The cPyAMF extension has been completely revamped and no longer uses cStringIO to handle the byte packing. The extension has also been extended to cover more of the library. This has given a nice speed-up but we are by no ...

Running a PyAMF WSGI server in Apache Ant using Jython

Apache Ant is a Java-based build tool. Ant build files are created using XML but it also support Python scripts using Jython.

There are 2 ways to execute Python scripts in Ant:

JSR-223 enables dynamic languages to be callable via Java in a seamless manner. Unfortunately this is currently only supported with Jython 2.2.1 and not the latest 2.5.0. Since PyAMF only supports Jython 2.5 or newer, you have to use the PythonInterpreter class directly. This style of embedding code is very similar to making use of a scripting engine, but it has the advantage of working with Jython 2.5.

Here you see the gateway running in Ant:

Buildfile: build.xml clean: compile: [mkdir] Created dir: build/classes [javac] Compiling 1 source file to build/classes jar: [mkdir] Created dir: build/jar [jar] Building jar: build/jar/HelloWorld.jar run: [java] *sys-package-mgr*: processing new jar, 'build/jar/HelloWorld.jar' [java] Running AMF gateway on http://localhost:8000

Read the complete howto, including a sample server/client, on http://pyamf.org/tutorials/jython/ant.html.

Using PyAMF with Apache Tomcat

Today a new tutorial was added that shows you how to deploy your PyAMF applications with Apache Tomcat and modjy. modjy is an implementation of a WSGI compliant gateway/server for Jython, built on Java/J2EE servlets. This allows you to run Jython WSGI applications inside a Java/J2EE servlet container, e.g. Apache Tomcat. modjy is part of the Jython project.

Tomcat PyAMF

PyAMF server/client using Jython with Swing

Now that the upcoming Jython 2.5 is getting closer to it's final release, I thought it would be nice to create an example that shows PyAMF running on top of Jython. Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrates with the Java platform. It thus allows you to run Python scripts on any Java platform.

Below you see a screenshot of the example, which was created using Java's native Swing UI toolkit. It allows you to start a simple AMF server on localhost:8000 and embeds an AMF client that makes calls to that server. This particular example doesn't interact with an Adobe Flash Player application, it simply shows it's possible to run PyAMF servers and clients on top of the upcoming Jython release.

Screenshot of Jython/PyAMF example

You can browse or download the source from the Subversion repository. You can find instructions on how to run the example yourself in the documentation.

PyAMF 0.4.2 released

The team is proud to announce the release of PyAMF 0.4.2!

PyAMF is a lightweight library that allows Flash and Python applications to communicate via Adobe's ActionScript Message Format.

This is a bugfix release, see the changelog for the complete list of changes. A brief overview of the changes:

  • Support for decoding the 'source' property on ArrayCollection (Ticket:488)
  • Fixed an issue in the GAE adapter where dynamic properties would be missing on referenced objects (Ticket:511)
  • Fixed a critical issue with AMF0 reference counting when encoding remoting responses (Ticket:510)
  • Strengthened HTTP header handling in the client (Ticket:492)
  • Support for Django i18n ugettext_lazy (Ticket:496)
  • Support for microseconds for datetime objects (Ticket:490)
  • Support for property types on SQLAlchemy mapped classes (Ticket:491)
  • Support for property types for Google AppEngine db.Model and db.Expando. (Ticket:487)

Check out the download page, installation instructions.

Got questions? First stop is the mailing list or IRC.

SQLAlchemy and Flash: Addressbook example

SQLAlchemy logo

Dave Thompson created a new address book example that uses the new SQLAlchemy adapter that was added in the latest release of PyAMF. PyAMF provides Action Message Format (AMF) support for Python, mainly used in the Adobe Flash Player for RPC communication.

PyAMF 0.4.1 released

The team is proud to announce the release of PyAMF 0.4.1!

PyAMF is a lightweight library that allows Flash and Python applications to communicate via Adobe's ActionScript Message Format.

This is a bugfix release, see the changelog for the complete list of changes. A brief overview of the changes:

  • amf0.Encoder.use_amf3 has been extended to cover all object types (Ticket:453, Ticket:467)
  • Encoding {0:0, '0':1} will now raise an AttributeError (Ticket:458)
  • Improvements to the Google App Engine adapter - see ticket for details (Ticket:479)
  • Unicode handling in __repr__ functions has been improved (Ticket:455)
  • Django models.TimeField, models.DateField will now be converted to the correct type (datetime.time and datetime.date respectively). fields.NOT_PROVIDED is also checked for by converting to pyamf.Undefined and back again. (Ticket:457)

Check out the download page, installation instructions.

Got questions? First stop is the mailing list or IRC.