[PEAK] PEAK-Rules and PyPy

Alain Poirier alain.poirier at net-ng.com
Tue Oct 16 11:18:28 EDT 2012


Hi Philip,

Our web framework depends a lot on predicates dispatch (URL routing,
security rules, model/views associations ...). Sadly, trying to run
it on PyPy, it appears Peak Rules is the last dependency not working:

Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:42:54)
[PyPy 1.9.0 with GCC 4.2.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``<arigato> (not thread-safe, but
well, nothing is)''
>>>> from peak.rules import predicates
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/predicates.py", line 694, in <module>
    when(expressionSignature, "isinstance(expr, Const) and isinstance(expr.value,priority)")
  File "/private/tmp/p/site-packages/DecoratorTools-1.8-py2.7.egg/peak/util/decorators.py", line 617, in tracer
    frm.f_locals[k] = callback(frm,k,v,old_locals)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 276, in callback
    register_for_class(None)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 270, in register_for_class
    _register_rule(f, pred, context, cls)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 395, in _register_rule
    rules.add(parse_rule(Dispatching(gf).engine, pred, context, cls))
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 685, in parse_rule
    def parse_rule(engine, predicate, context, cls):
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 685, in parse_rule
    def parse_rule(engine, predicate, context, cls):
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 589, in callback
    return f(*args, **kw)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 953, in parse_upgrade
    predicate, context, cls
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 685, in parse_rule
    def parse_rule(engine, predicate, context, cls):
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/core.py", line 589, in callback
    return f(*args, **kw)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/predicates.py", line 595, in _parse_string
    b = CriteriaBuilder(engine.arguments, ctx.localdict, ctx.globaldict, __builtins__)
  File "/private/tmp/PEAK-Rules-0.5a1.dev-r2707/peak/rules/codegen.py", line 334, in __init__
    dict([(k,self.Const(v)) for k,v in ns.iteritems()]) for ns in namespaces
AttributeError: 'module' object has no attribute 'iteritems'


Do you think it could be possible to have a working PyPy version of Peak Rules?

Best regards,
Alain



More information about the PEAK mailing list