A bi-directional (partial) transpiler for enabling some JS syntax in python (and vice versa)
Project description
ecmapy
This project is intended to explore a proof-of-concept for how one might develop a (partial) bi-directional transpiler for python <-> JavaScript that would allow developers to use some of the most convenient syntactic features of modern JS in python (such as optional chaining, nullish coalescing, etc.), and also enable Javascript developers to use various python patterns (e.g. list comprehension). This project is in the exploratory phase. Functionality will be added incrementally, with the initial goal of enabling the optional chaining syntax (foo?.bar?.baz()) in python, and designing a transpilation workflow. Guiding constraints include:
- Avoid the need for wrapper functions like:
class MyClass:
def __init__(self):
self.foo = "bar"
c = MyClass()
x = c.foo # x = "bar"
x = c.baz # raises `AttributeError`
# JAVASCRIPT WRAPPER APPROACH ❌
to_js("x = c?.baz") # x = None
Instead, prefer:
c = MyClass()
x = c.foo # x = "bar"
# TRANSPILE THE BELOW TO SOMETHING LIKE:
x = c.foo # x = "bar"
x = c?.baz # x = c.get("baz", None); x = None
x = c.baz # raises `AtrributeError
-
Enable the ecmapy code to work with linters, type-checkers, and IDE extensions.
-
Enable seamless integration with existing CI/CD workflows.
License
This project is licensed under the GNU Affero General Public License (AGPLv3).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecmapy-0.0.1.dev0.tar.gz.
File metadata
- Download URL: ecmapy-0.0.1.dev0.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e3985b655db19948dc48430e4efdab8cd32f22a869e34684f3bbadba34d48cf
|
|
| MD5 |
2ea5903058ed4bf82276b375663a23ae
|
|
| BLAKE2b-256 |
b4b2ac0b4da2e759e76d2db02d6d1e05d6f46de8e50f5dcbdfaa91a854ff8bbc
|
Provenance
The following attestation bundles were made for ecmapy-0.0.1.dev0.tar.gz:
Publisher:
publish.yml on hesreallyhim/ecmapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecmapy-0.0.1.dev0.tar.gz -
Subject digest:
7e3985b655db19948dc48430e4efdab8cd32f22a869e34684f3bbadba34d48cf - Sigstore transparency entry: 171093639
- Sigstore integration time:
-
Permalink:
hesreallyhim/ecmapy@f172a853c7a6183c088a761a621b319d271e3d8a -
Branch / Tag:
refs/tags/v0.0.1-dev0 - Owner: https://github.com/hesreallyhim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f172a853c7a6183c088a761a621b319d271e3d8a -
Trigger Event:
release
-
Statement type:
File details
Details for the file ecmapy-0.0.1.dev0-py3-none-any.whl.
File metadata
- Download URL: ecmapy-0.0.1.dev0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2921298dd9d48cdef3d052656d8120fa9d79ff6b6e97b5d368f7d5a31f0a6b9
|
|
| MD5 |
91c4dcec4512b4c3d266022638087bff
|
|
| BLAKE2b-256 |
6b197a4c90f5ebe6de10ce8b0887e8330389d65089808e233e238804ea3d7f28
|
Provenance
The following attestation bundles were made for ecmapy-0.0.1.dev0-py3-none-any.whl:
Publisher:
publish.yml on hesreallyhim/ecmapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecmapy-0.0.1.dev0-py3-none-any.whl -
Subject digest:
b2921298dd9d48cdef3d052656d8120fa9d79ff6b6e97b5d368f7d5a31f0a6b9 - Sigstore transparency entry: 171093641
- Sigstore integration time:
-
Permalink:
hesreallyhim/ecmapy@f172a853c7a6183c088a761a621b319d271e3d8a -
Branch / Tag:
refs/tags/v0.0.1-dev0 - Owner: https://github.com/hesreallyhim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f172a853c7a6183c088a761a621b319d271e3d8a -
Trigger Event:
release
-
Statement type: