GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - facebookarchive/react-python: Python bridge to JSX & the React JavaScript library.

This repository was archived by the owner on Jan 13, 2022. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
react
react
 
 
.bowerrc
.bowerrc
 
 
.gitignore
.gitignore
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
DESCRIPTION
DESCRIPTION
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
VERSIONS.md
VERSIONS.md
 
 
setup.py
setup.py
 
 

Repository files navigation

NOTE: This project is no longer actively maintained.

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.6.0

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=js_path)

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

You can also use transform_string(jsx) method to transform strings:

from react import jsx
transformer = jsx.JSXTransformer()
js = transformer.transform_string(jsx)

Django: PyReact includes a JSX compiler for django-pipeline. It has been tested with django-pipeline 1.3.20, but may work with other versions too. 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.

About

Python bridge to JSX & the React JavaScript library.

Resources

Readme
License

Contributing

Contributing
Activity
Custom properties

Stars

573 stars

Watchers

1 watching

Forks

60 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.