GithubHelp home page GithubHelp logo

web5design / react-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/react-python

0.0 2.0 0.0 276 KB

Python bridge to JSX & the React JavaScript library.

License: Apache License 2.0

react-python's Introduction

PyReact

PyReact is a Python wrapper around the React JavaScript library and JSX.

Specifically, it provides an API to transform JSX files into JavaScript from within your Python application, as well as providing access to the latest React build.

Installation

PyPI: PyReact is hosted on PyPI, and can be installed with pip:

$ pip install PyReact

Alternatively, add it into your requirements file:

PyReact==0.1.1

Dependencies: PyReact uses PyExecJS to execute the bundled React code, which requires that a JS runtime environment is installed on your machine. We don't explicitly set a dependency on a runtime environment; Mac OS X comes bundled with one. If you're on a different platform, we recommend PyV8.

Usage

Transform your JSX files via the provided jsx module::

from react import jsx

# For multiple paths, use the JSXTransformer class.
transformer = jsx.JSXTransformer()
for jsx_path, js_path in my_paths:
    transformer.transform(jsx_path, js_path)

# For a single file, you can use a shortcut method.
jsx.transform('path/to/input/file.jsx', 'path/to/output/file.js')

Django: PyReact includes a JSX compiler for django-pipeline. Add it to your project's pipeline settings like this:

PIPELINE_COMPILERS = (
  'react.utils.pipeline.JSXCompiler',
)

License

Copyright (c) 2013 Facebook, Inc. Released under the Apache License, Version 2.0.

react-python's People

Contributors

kmeht avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.