Name | py2mojo JSON |
Version |
0.0.2
JSON |
| download |
home_page | |
Summary | Automated Python to Mojo code translation |
upload_time | 2023-09-23 22:32:07 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.11 |
license | MIT License Copyright (c) 2023 Manuel Saelices Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
mojo
code
development
converter
translator
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# py2mojo
Automated Python to Mojo code translation
A tool to automatically convert Python code to the new [Mojo programming language](https://www.modular.com/mojo).
## Installation
```bash
pip install py2mojo
```
## Usage
You can read the usage by running `py2mojo --help`:
```bash
❯ py2mojo --help
usage: py2mojo [-h] [--inplace] [--extension {mojo,🔥}] [--convert-def-to-fn | --no-convert-def-to-fn] [--convert-class-to-struct | --no-convert-class-to-struct] [--float-precision {32,64}]
filenames [filenames ...]
positional arguments:
filenames
options:
-h, --help show this help message and exit
--inplace Rewrite the file inplace
--extension {mojo,🔥} File extension of the generated files
--convert-def-to-fn, --no-convert-def-to-fn
--convert-class-to-struct, --no-convert-class-to-struct
--float-precision {32,64}
```
Examples:
```bash
❯ py2mojo myfile.py
```
```bash
❯ py2mojo mypackage/*.py
```
## ⚠ Disclaimer
Please be aware that the Mojo programming language is still in its nascent stages of development. As with any young language, there might be frequent updates, changes, and unforeseen quirks in its syntax and behavior. There will probably be instances where the conversion might not work and may require manual adjustments.
So, consider this tool as experimental. Please do not trust the generated code and double-check it.
## Implementation details
This uses a similar approach to the [pyupgrade](https://github.com/asottile/pyupgrade) tool, using the AST parser to analyze the Python code and replace some parts of it with the equivalent Mojo code.
As Mojo is a superset of Python, non-replaced logic should be also a valid Mojo code.
## Contributing
### How to install it locally
1. Fork the repository
2. Clone your fork:
```bash
git clone git@github.com:youraccount/py2mojo.git
```
3. Install it locally:
```
cd py2mojo
pip install -e .
```
Raw data
{
"_id": null,
"home_page": "",
"name": "py2mojo",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "mojo,code,development,converter,translator",
"author": "",
"author_email": "Manuel Saelices <msaelices@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/96/f7/a879817023aeb9e96d096826eca727bbd9adb45cca43c9713c5c918a0266/py2mojo-0.0.2.tar.gz",
"platform": null,
"description": "# py2mojo\n\nAutomated Python to Mojo code translation\n\nA tool to automatically convert Python code to the new [Mojo programming language](https://www.modular.com/mojo).\n\n## Installation\n\n```bash\npip install py2mojo\n```\n\n## Usage\n\nYou can read the usage by running `py2mojo --help`:\n\n```bash\n\u276f py2mojo --help\nusage: py2mojo [-h] [--inplace] [--extension {mojo,\ud83d\udd25}] [--convert-def-to-fn | --no-convert-def-to-fn] [--convert-class-to-struct | --no-convert-class-to-struct] [--float-precision {32,64}]\n filenames [filenames ...]\n\npositional arguments:\n filenames\n\noptions:\n -h, --help show this help message and exit\n --inplace Rewrite the file inplace\n --extension {mojo,\ud83d\udd25} File extension of the generated files\n --convert-def-to-fn, --no-convert-def-to-fn\n --convert-class-to-struct, --no-convert-class-to-struct\n --float-precision {32,64}\n```\n\nExamples:\n\n```bash\n\u276f py2mojo myfile.py\n```\n\n```bash\n\u276f py2mojo mypackage/*.py\n```\n\n## \u26a0 Disclaimer\n\nPlease be aware that the Mojo programming language is still in its nascent stages of development. As with any young language, there might be frequent updates, changes, and unforeseen quirks in its syntax and behavior. There will probably be instances where the conversion might not work and may require manual adjustments.\n\nSo, consider this tool as experimental. Please do not trust the generated code and double-check it.\n\n## Implementation details\n\nThis uses a similar approach to the [pyupgrade](https://github.com/asottile/pyupgrade) tool, using the AST parser to analyze the Python code and replace some parts of it with the equivalent Mojo code.\n\nAs Mojo is a superset of Python, non-replaced logic should be also a valid Mojo code.\n\n## Contributing\n\n### How to install it locally\n\n1. Fork the repository\n\n2. Clone your fork:\n\n```bash\ngit clone git@github.com:youraccount/py2mojo.git\n```\n\n3. Install it locally:\n```\ncd py2mojo\npip install -e .\n```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Manuel Saelices Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Automated Python to Mojo code translation",
"version": "0.0.2",
"project_urls": {
"Bug Reports": "https://github.com/msaelices/py2mojo/issues",
"Homepage": "https://github.com/msaelices/py2mojo",
"Source": "https://github.com/msaelices/py2mojo"
},
"split_keywords": [
"mojo",
"code",
"development",
"converter",
"translator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9dd06e36af374f638e4c5b987991a031b6f57f6aa7e9af441dd690bb97c688e7",
"md5": "4df34e2ebcb5f438eddea37e9b02a066",
"sha256": "162ceaee5fd4b5128612e19965c800d985ae67f720ec1ad5fd6eda413459d376"
},
"downloads": -1,
"filename": "py2mojo-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4df34e2ebcb5f438eddea37e9b02a066",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 10348,
"upload_time": "2023-09-23T22:32:05",
"upload_time_iso_8601": "2023-09-23T22:32:05.053347Z",
"url": "https://files.pythonhosted.org/packages/9d/d0/6e36af374f638e4c5b987991a031b6f57f6aa7e9af441dd690bb97c688e7/py2mojo-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "96f7a879817023aeb9e96d096826eca727bbd9adb45cca43c9713c5c918a0266",
"md5": "38ee627c23ac4fc75ee6a3708dd61719",
"sha256": "f1e621706db9a4ecfb05b17b9cb849f8bd0518f77b6492a375ce26c76db2414a"
},
"downloads": -1,
"filename": "py2mojo-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "38ee627c23ac4fc75ee6a3708dd61719",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 10760,
"upload_time": "2023-09-23T22:32:07",
"upload_time_iso_8601": "2023-09-23T22:32:07.014012Z",
"url": "https://files.pythonhosted.org/packages/96/f7/a879817023aeb9e96d096826eca727bbd9adb45cca43c9713c5c918a0266/py2mojo-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-23 22:32:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "msaelices",
"github_project": "py2mojo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "py2mojo"
}