omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    StaSh for Pythonista 2 and 3

    Pythonista
    13
    61
    50845
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ywangd
      ywangd last edited by

      @JonB Dulwich supports at least to Python 3.4 But Gittle has no Python 3 support. Any idea how the git tools could be ported to Pythonista 3?

      The python-future project has an experimental feature to automatically translate Python 2 modules to Python 3 upon loading. But I am not sure how reliable it is.

      The main framework of StaSh is working now. I am in the process to make sure all the commands still work. I have ran git through some 2to3 tools so itself is now mostly Python 3 compatible. But the dependencies could be the tricky part.

      1 Reply Last reply Reply Quote 0
      • Webmaster4o
        Webmaster4o last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          I guess I can start removing gittle dependancies (right after I finish the gh command, which is almost ready)

          Much of gittle is superceeded by dulwich porcelain, or workarounds in my own code. I have been itching to rewrite git from scratch for a while anyway. my newfound discovery of docopts will make much of the CLI interface easier, the trickier bit is whether it makes more sense to update dulwich, or git.

          1 Reply Last reply Reply Quote 1
          • Phuket2
            Phuket2 last edited by

            Guys, time for a new thread for StaSh Pythonista 3.x?

            1 Reply Last reply Reply Quote 1
            • ywangd
              ywangd last edited by

              @Phuket2 @JonB I think we should have a separate thread for the git tools. With the main post being some instruction, tips for best practice/workflow to help out many common issues. We can then discuss about porting and other improvements in the new thread.

              1 Reply Last reply Reply Quote 1
              • cappy
                cappy @ywangd last edited by

                @ywangd I've just installed Stash. How do I cd to the Home directory? I'm not familiar with the iPad file system.

                "Please run launch_stash.py under the Home directory to start StaSh."

                ywangd 1 Reply Last reply Reply Quote 0
                • JonB
                  JonB last edited by

                  The best way to run stash, is to click the wrench icon, then edit, then the plus sign. then find the launch_stash file.

                  Then, you will have a shortcut in the wrench menu that you can run anytime.

                  1 Reply Last reply Reply Quote 0
                  • ywangd
                    ywangd @cappy last edited by

                    @cappy The launch_stash.py file is found in the directory when you start Pythonista, i.e. Documents.

                    From Pythonista's file browser (swipe to right to reveal it if not already visible), select launch_stash.py. This opens the file in the editor, then click the Run button (the right-facing triangle on the top right) to start StaSh.

                    Once you know where the launch file is, you can create an editor action to access it quickly as @JonB suggested.

                    1 Reply Last reply Reply Quote 0
                    • Tizzy
                      Tizzy last edited by

                      I just typed 'git' into stash and got this, looks similar to something posted in here earlier...I'm so confused.

                      '''

                      StaSh v0.4.0
                      [~/Documents]$ git
                      Opening: https://github.com/transistor1/dulwich/archive/master.zip
                      Save as: /private/var/mobile/Containers/Data/Application/B381FF20-8B02-43E0-870D-BCC9678441DA/tmp/dulwich.zip
                      8192
                      16384
                      24576
                      32768
                      40960
                      49152
                      57344
                      65536
                      73728
                      81920
                      90112
                      98304
                      106496
                      114688
                      122880
                      131072
                      139264
                      147456
                      155648
                      163840
                      172032
                      180224
                      188416
                      196608
                      204800
                      212992
                      221184
                      229376
                      237568
                      245760
                      253952
                      262144
                      270336
                      278528
                      286720
                      294912
                      303104
                      311296
                      319488
                      327680
                      335872
                      344064
                      352256
                      355169
                      stash: ImportError('No module named dulwich',): (No module named dulwich)
                      [~/Documents]$

                      '''

                      ywangd 1 Reply Last reply Reply Quote 0
                      • ccc
                        ccc last edited by

                        @Tizzy your stash is v0.4.0 but the current version is v0.6.0.

                        1 Reply Last reply Reply Quote 0
                        • ywangd
                          ywangd @Tizzy last edited by

                          @Tizzy It is recommended to install the latest version of StaSh (0.6.3). Version 0.5 and up is not compatible with 0.4 and lower. So please delete your current 0.4 installation and run the following oneliner to get the latest release:

                          import requests as r; exec r.get('http://bit.ly/get-stash').text
                          

                          Once installed, restart Pythonista and run launch_stash.py under Documents to start.

                          1 Reply Last reply Reply Quote 0
                          • Phuket2
                            Phuket2 last edited by

                            @ywangd , sorry I am at a total loss.its really mixed up here. About Pythonista 2/3

                            I do in Pythonista 3
                            import requests as r; exec r.get('http://bit.ly/get-stash').text
                            In Python 3,
                            I get

                            import requests as r; exec r.get('http://bit.ly/get-stash').text
                            File "<string>", line 1
                            import requests as r; exec r.get('http://bit.ly/get-stash').text
                            ^
                            SyntaxError: invalid syntax

                            1 Reply Last reply Reply Quote 0
                            • dgelessus
                              dgelessus last edited by

                              The line should really be

                              import requests as r; exec(r.get('http://bit.ly/get-stash').text)
                              

                              Note the parentheses around the argument to exec. In Python 2 exec was a special statement and did not require parentheses like a normal function. In Python 3 exec was changed to a normal function (just like print) so now you need parentheses to call it. In Python 2 exec can also be used like in Python 3 (see the language reference for the details) so the Python 3 style is what you should use in almost all cases.

                              Phuket2 Tizzy 2 Replies Last reply Reply Quote 0
                              • Phuket2
                                Phuket2 @dgelessus last edited by Phuket2

                                @dgelessus , I still get an error

                                import requests as r; exec(r.get('http://bit.ly/get-stash').text)
                                Traceback (most recent call last):
                                File "<string>", line 1, in <module>
                                File "<string>", line 18
                                print 'Downloading %s ...' % URL_ZIPFILE
                                ^
                                SyntaxError: Missing parentheses in call to 'print'

                                But I can see there is a problem with the print. But it's part of an install, not sure I can do anything about that

                                1 Reply Last reply Reply Quote 0
                                • dgelessus
                                  dgelessus last edited by

                                  Uh @ywangd is there a different download link for the py3 branch?

                                  1 Reply Last reply Reply Quote 0
                                  • ccc
                                    ccc last edited by

                                    https://forum.omz-software.com/topic/2545/stash-for-pythonista-2-and-3/39

                                    1 Reply Last reply Reply Quote 1
                                    • Tizzy
                                      Tizzy @dgelessus last edited by Tizzy

                                      @dgelessus @ywangd So it's interesting that Stash runs in its own tab, presumably on its own thread, and closing the tab kills the thread?

                                      How do you implement this in pythonsta for other scripts? (this would solve the only being able to run a single script limitation)

                                      ALSO, I appreciate the confirmation before downloading stuff in this version... in that last one simply typing something would try to download it.

                                      ALSO bug report, sometimes the keyboard goes black except the top row with "tab, ~, "etc...

                                      1 Reply Last reply Reply Quote 0
                                      • ywangd
                                        ywangd last edited by

                                        @Phuket2

                                        For Pythonista 3, there is a separate branch and following oneliner installs it (note it uses a different url for the py3 branch):

                                        import requests as r; exec(r.get('http://j.mp/gsp35').text)
                                        
                                        Phuket2 1 Reply Last reply Reply Quote 0
                                        • ywangd
                                          ywangd last edited by

                                          @Tizzy
                                          StaSh uses threads to run commands users type in the terminal. The thread is killable and when StaSh UI is closing, it kills all the threads it spawned. With current version, you can already run multiple scripts with StaSh at the same time. Here is an example that a http server and client runs together. Details of the killable threads can be found in the shthreads.py file.

                                          in that last one simply typing something would try to download it.

                                          I don't quite understand it. Do you mean that pip and git download their dependancies?

                                          ALSO bug report, sometimes the keyboard goes black except the top row with "tab, ~, "etc...

                                          The extra key row is something I wanted to re-write since 2.0 came out. Just didn't have the time. I'll work on it when time permits.

                                          Tizzy 1 Reply Last reply Reply Quote 0
                                          • Phuket2
                                            Phuket2 @ywangd last edited by

                                            @ywangd , thank you. Successfully downloaded it

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB Forums | Contributors