facebookarchive/react-python

transform() doesn't pass *args (only **kwargs)

Closed this issue · 4 comments

The documented example of:

jsx.transform('path/to/input/file.jsx', 'path/to/output/file.js')

Does not work. I think the transform functions should be changed as below.

I think transform functions should be:

def transform(jsx_path, *args, **opts):
    return JSXTransformer().transform(jsx_path, *args, **opts)

def transform_string(jsx, *args, **opts):
    return JSXTransformer().transform_string(jsx, *args, **opts)

You're right, I missed that the signature changed after PR #16 (cc @andreypopp). I believe a workaround is to pass js_path as a keyword argument in the meantime.

Thanks for raising the issue!

I think it's better to fix the example. Calling function and passing keyword arg as positional arg is an antipattern actually.

Changing the example works for me too.

README was updated in #28.