Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecmapy-0.0.1.dev0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecmapy-0.0.1.dev0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

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

Hashes for ecmapy-0.0.1.dev0.tar.gz
Algorithm Hash digest
SHA256 7e3985b655db19948dc48430e4efdab8cd32f22a869e34684f3bbadba34d48cf
MD5 2ea5903058ed4bf82276b375663a23ae
BLAKE2b-256 b4b2ac0b4da2e759e76d2db02d6d1e05d6f46de8e50f5dcbdfaa91a854ff8bbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ecmapy-0.0.1.dev0.tar.gz:

Publisher: publish.yml on hesreallyhim/ecmapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for ecmapy-0.0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2921298dd9d48cdef3d052656d8120fa9d79ff6b6e97b5d368f7d5a31f0a6b9
MD5 91c4dcec4512b4c3d266022638087bff
BLAKE2b-256 6b197a4c90f5ebe6de10ce8b0887e8330389d65089808e233e238804ea3d7f28

See more details on using hashes here.

Provenance

The following attestation bundles were made for ecmapy-0.0.1.dev0-py3-none-any.whl:

Publisher: publish.yml on hesreallyhim/ecmapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page