WIP nx-python: Create Python Homebrew for the Switch!

Discussion in 'Switch - Emulation, Homebrew & Software Projects' started by AileenLumina, Mar 18, 2018.


    18,875

    72
    Front-page WIP
    HlzR.

    nx-python
    is an ecosystem for developing and running Python homebrew applications on the Nintendo Switch. PyNX serves as the entry point to this ecosystem and allows you to run Python apps on your Switch. It is a homebrew app that contains a port of the CPython interpreter and allows you to run Python applications from the Homebrew Menu. Just name your application main.py and place it next to the PyNX.nro, and it will be executed as soon as you launch PyNX from the Homebrew Menu. Simply grab a release build and copy the content of the ZIP archive into the /switch folder on your SD card. PyNX will appear on the Homebrew Menu. Currently, Python 3.5 is supported. Basic things should work fine, but for many advanced things, like PyGame, you will have to wait a bit until they are supported. This also includes threading, as well as the signal module. Those are high priority, though, so you won't have to wait for them for too long, hopefully. For Switch-specific things, such as controller input or filesystem read/write, you can use the nx package that's included in PyNX (see documentation).

    I hope nx-python will allow many more people to develop awesome homebrew applications for the Switch. :)

    If you encounter a problem, make sure to join our Discord and tell us about it, or, alternatively, reply to this thread.

    Quick links: Download | Documentation | Discord | Source

    Special thanks to DavidBuchanan314, @MarcusD, @Stary2001, rami, and several other people from ReSwitched as well as the SwitchBrew team, the devkitPro team, and the Python Software Foundation.
     
    Discussion (72 replies)
  1. Shrike

    Shrike Advanced Member

    Newcomer
    3
    Mar 10, 2018
    Germany
    You mean LUA, right ? :P

    Just joking .. great work man <3
     
  2. AileenLumina
    OP

    AileenLumina Python main, software engineer and API designer

    Member
    4
    Sep 27, 2015
    Germany
    Oh, I mean, I heard Lua support is brewing as well :eyes:

    Thanks!
     
    SketchyPixel and lordelan like this.
  3. LukeHasAWii

    LukeHasAWii GBAtemp Advanced Fan

    Member
    6
    Apr 24, 2016
    United States
    Iowa
    Useful... good job.
     
    AileenLumina likes this.
  4. Brawl345

    Brawl345 GBAtemp Advanced Fan

    Member
    7
    Jan 14, 2012
    Germany
    Thank you for this, Python is a really easy language and this will be very useful :D
     
    AileenLumina likes this.
  5. AileenLumina
    OP

    AileenLumina Python main, software engineer and API designer

    Member
    4
    Sep 27, 2015
    Germany
    await nx.P1.controller.A_BUTTON.wait_for_press()
    if isinstance(nx.P1.controller, nx.SwitchProController):
    print("Nice controller you have there.")​

    Yeah, it's indeed very easy. :)
     
    Dakota_Pixel, Brawl345 and Rauliki like this.
  6. AileenLumina
    OP

    AileenLumina Python main, software engineer and API designer

    Member
    4
    Sep 27, 2015
    Germany
  7. pwsincd

    pwsincd Garage Flower

    Member
    11
    GBAtemp Patron
    pwsincd is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Dec 4, 2011
    Manchester UK
    appstore updated to include the newer release... nice work as always..
     
  8. Shrike

    Shrike Advanced Member

    Newcomer
    3
    Mar 10, 2018
    Germany
    Now that Python works.. can we have Ren'Py next ? :D
     
  9. lordelan

    lordelan GBAtemp Psycho!

    Member
    9
    Jan 4, 2015
    Germany
    This is an amazing release and hopefully will lead to many more homebrew apps! :)
    By using different copies of this and the asset editor by @vgmoose we can easily have multiple Python apps in our HBmenu, each with their own icon and name. :)
     
    Slimmmmmm and AileenLumina like this.
  10. reds

    reds Member

    Newcomer
    1
    Jan 4, 2018
    Poland
    AWESOME! I've already started writing some homebrew in C, but I can imagine nx-python giving us a lot of new homebrew from less-experienced coders. Great work :3
     
    AileenLumina likes this.
  11. AileenLumina
    OP

    AileenLumina Python main, software engineer and API designer

    Member
    4
    Sep 27, 2015
    Germany
    @lordelan My idea was to have fake homebrew apps similar to the ones we had on the 3DS. Those would just launch Pynx and instruct it to run the Python program they contain, basically. :)
     
    lordelan and TotalInsanity4 like this.
  12. maorninja

    maorninja GBAtemp Advanced Fan

    Member
    4
    Feb 7, 2016
    United States
    I hope you remember that #python-haters channel that I made on my discord server.
     
  13. TotalInsanity4

    TotalInsanity4 GBAtemp Supreme Overlord

    Member
    20
    Dec 1, 2014
    United States
    Under a rock
    OwO what's this?

    In all seriousness this is awesome and I will definitely be using this
     
    Rauliki, AileenLumina and lordelan like this.
  14. normal19

    normal19 GBAtemp Regular

    Member
    3
    Aug 23, 2014
    Afghanistan
    Was just going to say this. But that needs Python 2.7 and a dozen dependecneis.
     
    Last edited by normal19, Mar 21, 2018
  15. TotalInsanity4

    TotalInsanity4 GBAtemp Supreme Overlord

    Member
    20
    Dec 1, 2014
    United States
    Under a rock
    Can't you just import the old libraries (whatever the opposite of importing from _future_ is) and put all the dependencies in the same folder as the main .py?
     
  16. DarkOrb

    DarkOrb GBAtemp Regular

    Member
    5
    Oct 11, 2013
    Germany
    Before we fantasize about Ren'Py, they should implement more basic things like "numpy". I need my multi-dimensional arrays. :D

    Btw, great work. One suggestion: Please add a text editor which utilizes the onscreen keyboard (or a bluetooth keyboard), so we can write applications on the go.
     
    Last edited by DarkOrb, Mar 21, 2018
  17. lordelan

    lordelan GBAtemp Psycho!

    Member
    9
    Jan 4, 2015
    Germany
    Yay sounds good. :)
     
  18. Sonixier

    Sonixier Member

    Newcomer
    2
    May 1, 2016
    Gambia, The
    Is there a plan to add support for yuzu? I don't have a 3.0.0 switch and it would be nice to create homebrew before cfw comes to older fws.
     
  19. wl.

    wl. Advanced Member

    Newcomer
    4
    Apr 29, 2008
    Serbia, Republic of
    it's yuzu should support this homebrew (for now yuzu lacks some services, for sockets and random numbers)
     
Loading...