Syck - "C" YAML implementation /w Python binding
Clark C. Evans
cce at clarkevans.com
Sun Jun 8 15:18:45 EDT 2003
I just wanted to pass along a note that there is now a (quite
stable) "C" YAML implementation with a Python binding. It is not
perfect, however, it is useable and quite fast.
Best,
Clark
------------------------------------------------------------
From: why the lucky stiff <yaml-core at whytheluckystiff.net>
To: yaml-core at lists.sourceforge.net
Subject: [Yaml-core] Syck 0.35 + YAML.rb 0.60 -- the 1st stable release
Date: Thu, 5 Jun 2003 15:16:40 -0600
proudly announcing...
| syck 0.35 |
\o/
))
/ \
(some intentional sticking-out of the belly is warranted, don't you
think?)
The ruby-core team has been immensely helpful, contributing bug reports
that have helped polish out Syck very quickly. I'm pleased to say that
Syck has now surpassed previous versions of YAML.rb. It is very stable
and very fast.
This version handles large files, especially streaming of large files,
much better. YTS is 85% pass. Some of the fails are (I believe)
incorrect tests. We'll get into that soon.
If you have Ruby 1.8.0, simply update from Ruby CVS. If you have Ruby
1.6.x, then install Syck from the tarball link below.
The Python and PHP extensions haven't changed at all (though they
benefit from the wealth of changes to the Syck core.) When Ruby 1.8.0
is released, I'll be hitting those extensions harder.
_why
---
released: { name: Syck, version: 0.35 }
for: [ Ruby, PHP, Python ]
by: why the lucky stiff
about: >
Syck is a YAML parser, an extension for scripting
languages, written in C.
So what is YAML? YAML is a new language for data.
Describe objects in plain text. Load the data into
your scripting language as arrays, dictionaries,
classes, or primitives.
links:
YAML: http://www.yaml.org/
YAML Cookbook: http://yaml4r.sf.net/cookbook/
YAML Type Repository: http://yaml.org/type/
YAML Specification: http://yaml.org/spec/
Syck: http://www.whytheluckystiff.net/syck/
Syck Benchmarks: http://www.whytheluckystiff.net/arch/2003/03/19
Tarball @ SourceForge: >
http://aleron.dl.sourceforge.net/sourceforge/yaml4r/syck-0.35.tar.gz
status: >
Syck is about 85% compliant with the YAML spec. Largely, small
issues remain.
The extensions are quite usable. Ruby, PHP and Python
can load from a string containing YAML.
Ruby has support for stream loading, type handling, YPath, Okay.
This release marks the 0.60 release of YAML.rb.
benchmarks: >
Syck is quite speedy, although not as swift as most language's
native serialization.
Syck runs at about:
30-35% of the speed of Ruby's Marshal.
35-90% of the speed of PHP's deserialize().
600% of the speed of Python's Pickle.
33-40% of the speed of Python's cPickle.
(Based on various types of structured data.)
installation: >
Syck contains working extensions for the Ruby, PHP, and Python
languages. Each requires compilation of the libsyck library,
followed by compilation of the extension.
To compile libsyck, first download libsyck.
tar xzvf syck-0.35.tar.gz
cd syck-0.35
./configure
make
sudo make install
To install the Ruby extension:
cd ext/ruby
ruby install.rb config
ruby install.rb setup
sudo ruby install.rb install
To install the Python extension:
cd ext/python
python setup.py build
sudo python setup.py install
To install the PHP extension:
sh make_module.sh
sudo make install (if you weren't root during make_module.sh)
php -q syck.php
examples:
To load this document in Ruby: |
($:~)$ irb
>> require 'syck'
=> true
>> yp = YAML::Syck::Parser.new( {} )
=> #<YAML::Syck::Parser:0x8058530>
>> yp.load( File.open( 'syck-0.35.yml' ) )
=> {"status"=>"Syck is about 60% compliant ..."}
To load this document in PHP: |
($:~)$ php -a
Interactive mode enabled
<? dl( 'syck.so' ); print_r( syck_load( implode( '', file( 'syck-0.35.yml' ) ) ) ); ?>
.. php then outputs ..
X-Powered-By: PHP/4.2.3
Content-type: text/html
Array
(
[released] => Array
(
[name] => Syck
[version] => 0.35
)
.. and so on ..
To load this document in Python: |
($:~)$ python
Python 2.1.3 (#1, Jul 11 2002, 17:52:24)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "copyright", "credits" or "license" for more information.
>>> import syck
>>> f = open( 'syck-0.35.yml' )
>>> syck.load( f.read() )
{'by': 'why the lucky stiff', ... }
More information about the Python-list
mailing list