Skip to main content

Pyeet is a general-purpose language that embeds asynchronous Python in all your files.

Project description

Pyeet! Yeet All the Python!

Pyeet is a general-purpose language to embed asynchronous Python in ALL your files.

Pyeet takes the source from FILE and compiles it to a Python module, then runs it.

Source content...                       ...compiled into Python
------------------                      -----------------------
{~# Welcome to Pyeet! #>                # Welcome to Pyeet!
😊                                      print("😊")

{~~
text = "Hello, World!"                  text = "Hello, World!"
~~}
{~= text =~}                            print(text)

{~~
for x in [99, 98, 97]:                  for x in [99, 98, 97]:
    print f"{x} bottles of beer…"           print f"{x} bottles of beer…"

from datetime import datetime           from datetime import datetime
now = datetime.now()                    now = datetime.now()
~~}
The time is {~= now() =~}               print("The time is ", now, sep='')

Installation

Installation with pip:

$ pip install pyeet

Usage

usage: python -m pyeet [-h] [--dump] FILE

positional arguments:
  FILE        Source file with Pyeet tags

optional arguments:
  -h, --help  show this help message and exit
  --dump      Dump generated python module

Examples

Insert the current date and time into PostScript

PostScript sadly doesn't have any function that can get the current time. We can fix that!

In the repo there is a tests folder that contains the following file:

current_date_and_time_in_postscript.ps

%!PS
% 595 842 scale
/Times-Roman findfont
20 scalefont
setfont
newpath
70 750 moveto
{~~
from datetime import datetime
~~}
/({~= datetime.now() =~}) show

We can use pyeet and gs (ghostscript) to render our source with the current time:

$ python -m pyeet tests/current_date_and_time_in_postscript.ps \
  | gs -sDEVICE=png16m -sOutputFile=tests/current_date_and_time_in_postscript.png -

The result:

tests/current_date_and_time_in_postscript.png

If you're curious, you can dump the compiled Python source using the --dump argument:

$ python -m pyeet --dump tests/current_date_and_time_in_postscript.ps
print('%!PS')
print('% 595 842 scale')
print('/Times-Roman findfont')
print('20 scalefont')
print('setfont')
print('newpath')
print('70 750 moveto')
from datetime import datetime

print('/(', datetime.now(), ') show', sep='')

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

pyeet-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pyeet-0.0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file pyeet-0.0.1.tar.gz.

File metadata

  • Download URL: pyeet-0.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for pyeet-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dd035ef9612a70e6b34faec0ec0db791f58d65af6a9bb29eb5a6f0904011aac8
MD5 50ba8d4e5f3ec143adfb5c4ea59d103d
BLAKE2b-256 2a2fd86eacc2147d7815a35d964da38a33ace5f2dfcafabcbd10b49a516df76f

See more details on using hashes here.

File details

Details for the file pyeet-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyeet-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for pyeet-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c533ad8b4f0fe7d6cb9b8d6e3b662cf36ae80ed7c3f9d9cf658d63928c9c052b
MD5 894e3a7bae277f7940eb318de10830c3
BLAKE2b-256 25c127dc44a7244e0f8c626b2e871d4775ec0269f5a512e69932b6606af031f2

See more details on using hashes here.

Supported by

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