mathialo / bython

Python with braces. Because python is awesome, but whitespace is awful.
MIT License
2.13k stars 54 forks source link

How to use on Windows? #22

Open FireController1847 opened 6 years ago

FireController1847 commented 6 years ago

Is it even possible to use this on Windows? If so, how?

xagyg commented 6 years ago

I just tried it on windows (using it in a Git Bash Shell) and it works well. I ran

python ./setup.py install

Then I had to copy the python.exe to python3.exe

Then it worked a treat! I was delighted when I ran the following code (yes - even without semi-colons - brilliant!)

for i in range(10) {
    print("Bython is awesome!")
    print("Hello")
    if (i == 5) {
        print("yo")
    }
}
mathialo commented 6 years ago

Currently, I'm only developing for Unix-like systems, simply because I don't own a Windows machine to develop on.

I believe the only changes necessary to port Bython to (native) Windows is to adapt where the install script puts the executable, and find a Windows alternative to the shebangs, but I'm not sure.

If you're familiar with using Python on Windows, you are of course very welcome to look into the issue yourself and submit the changes.

ardee00 commented 3 years ago

The instructions say to run Bython in a shell. However, in Windows, there is no bython.exe. How do you run Bython in Windows?

xXCrash2BomberXx commented 2 years ago

Maybe my custom build would work better. I wrote it and use it on windows My Build of Bython

42degrees commented 8 months ago

No offense to xXCrash2BomberXx, but I don't know if I can trust an executable downloaded from GitHub. This is easy enough to make work on Windows. Note that I install Python into C:\Python312, which means that Bython installs into C:\Python312\Scripts. I have both of these directories in my Windows path.

Here are the steps I took to make Bython work: 1) Since on Windows the python installs as just python.exe in a directory for python3, I created a batch file in the python install directory called python3.bat that contains these lines: @echo off python %*

2) I then created a batch file in the python install directory called bython.bat with these two lines: @echo off python "C:\Python312\Scripts\bython" %*

3) I put a test program in c:\temp\test.by: print("Bython is awesome!"); for i in range(10) { print(i); }

That's it, now I can run: C:\temp>bython test.by Bython is awesome! 0 1 2 3 4 5 6 7 8 9

42degrees commented 8 months ago

And then I looked at the project more closely and realized that the parser isn't really parsing and the whole project has been abandoned long ago. Oh well.

pavelzw commented 8 months ago

You can convert the scripts into python entrypoints which you can then define in your package configuration. This makes them available cross-platform.

See https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts for documentation how to do this.