Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jennasys/pyreact-tools
Miscellaneous tools for creating React applications with Python using the Transcrypt transpiler
https://github.com/jennasys/pyreact-tools
Last synced: about 2 months ago
JSON representation
Miscellaneous tools for creating React applications with Python using the Transcrypt transpiler
- Host: GitHub
- URL: https://github.com/jennasys/pyreact-tools
- Owner: JennaSys
- Created: 2023-07-27T07:27:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-01T05:45:06.000Z (over 1 year ago)
- Last Synced: 2024-04-03T04:02:52.181Z (9 months ago)
- Language: Python
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyReact Tools
## [jsxtopy](https://github.com/JennaSys/pyreact-tools/blob/main/jsxtopy.py)
### Converts a JSX fragment to a Python function equivalent
When copying JSX example code from somewhere to use in my React Python projects, I got tired of having to manually convert JSX code to Python functions with dictionary attributes and having to manually quote everything. So I created this function that will (mostly) do it for me.For example, this JSX code:
```jsxSettings
```
will get converted to this Python code:
```python
Div({'id': 'root'},
Button({'radius': 'md', 'size': 'lg', 'compact': True, 'uppercase': True}, "Settings")
)
```## Installation:
```bash
pip install git+https://github.com/JennaSys/pyreact-tools
```## Usage:
```text
usage: jsxtopy [-h] [-v] [-d] [--test] [--dev] [jsx]Converts a JSX fragment to a Python function equivalent
positional arguments:
jsx JSX string to convert (If not supplied, will try to use what is in clipboard)optional arguments:
-h, --help show this help message and exit
-v, --verbose Print original JSX and Python result to console
-d, --dict Create props as dict function instead of dict literal
--test Run JSX unit tests
--dev Run JSX development test
```## Resources
- https://pyreact.com
- https://www.transcrypt.org