[pypy-dev] How to make a builtin pypy module visible?

Armin Rigo arigo at tunes.org
Thu May 28 15:57:53 CEST 2015


Hi Yicong,

If you really want to add an RPython module in PyPy, you should follow
closely the example of another module.  The first step is to add tests
that run untranslated.  Your module must be correct and tested
*before* you attempt to translate it.  Being correct RPython is not
the first concern, as long as you follow the general guidelines shown
by the other existing module.

The last test to add (after all other tests) is a
"test_ztranslation.py", which tests that your module is correct
RPython code.  We can discuss specific RPython issues you'd have at
this point.

If you only want to learn RPython, you could also try to write a small
interpreter for a custom language.  This is the path that other people
take, and it allows them to choose which approach they prefer, e.g. if
they don't care about untranslated tests.  However, if you're working
with PyPy, then you have to follow the rules and write tests,
otherwise you're unlikely to get much help from any of us.

(Also, it would help us get some motivation if you could successfully
explain why you need an RPython module instead of, say, using CFFI.)


A bientôt,

Armin.


More information about the pypy-dev mailing list