• ForceBru

    Okay, so I've been using Pythonista quite literally every single day since I first purchased Pythonista 2 a long long time ago. It's fantastic to have Python at your fingertips anywhere you go, anytime, without Internet access, with autocompletion and all the good stuff. I'm always using it to hack some stuff together, test new ideas, start new projects (and then move to PyCharm if they get big), quickly modify code in my GitHub projects with Working Copy etc.

    After all that time, I started noticing some things that Pythonista 3 could've done better, and now I decided to list them here, in no particular order.

    • Python 3.6 is kinda old - it would be nice to get an update and a wider choice of Python interpreters. For example, 2.7 (which is about to die - please update your projects to use Python 3!), 3.7 and 3.8 beta
    • It would be nice to have an update of all the 3rd-party libraries available in Pythonista
    • Code completion by Jedi is very useful, but it really sucks sometimes. For example, after you define a new class with class Thing: ... and then start typing T...h...i...n... to refer to this class, the class' name doesn't show up in he autocompletion view, which is super annoying. There's also a much newer version of Jedi: 0.15.1, while Pythonista's using version 0.9.0
    • The completion system of the editor relies on caches too much. For example, paste parser = object() in the editor and then start typing parser. on the next line to refer to some attribute. Pythonista will start suggesting attributes of the built-in parser module, like compilest, expr, isexpr, which are clearly not applicable here. The completion in the console will suggest the relevant attributes though. I suppose that's because the console has more information about the objects because it has access to the runtime?
    • Completion of import statements in the console is much better than that in the editor. For example, after you install a new module, it will show up in the console's completion, but won't show up when writing the same import statement in the editor. It would be nice if completion of import statements in the editor was as good
    • sys.stdin and sys.stdout are actually custom objects that don't properly implement the file protocol. For example, they don't have the fileno method, and in general, sys.__stdout__ and sys.stdout are completely different beasts, while they should provide the same basic functionality
    • In the console view, input, for example, 5 and press Return. Then attempt to select the 5 in the output. It gets selected, but then the keyboard goes down, and the options to Copy/Select all/Define disappear, making it necessary to touch the selection again. That's also very annoying, especially when you need to Copy&paste random chinks of output into the script
    • Input this as a script: ugh = '#' * 2000; print(ugh.join(' hello ; happy ; world ; !'.split(';'))). Close the keyboard, run the script, scroll up, copy the first word, go back to the script and paste the copied word there. Attempt to copy the second word in the same way. Notice that the console has scrolled all the way down, and now you have to scroll back up. This process quickly becomes very frustrating when copying random chunks of output into the script. It also happens when you don't copy anything: run the code, scroll really high up to find some output, go back to your code to check if this output is correct, then go back - only to find that the view has scrolled back down and you have no idea where exactly that one bit of output you were looking at is.

    It would be nice to have the following features too:

    • Ability to "run" arbitrary file types (not only Python). For example, running an HTML file would open it in the browser. It may be useful to be able to associate Python scripts with file types, so that when you tap "Run" for some "non-runnable" file, Pythonista would check for the associated script and run it almost like with the appex module workflow. It could pass the file's path to the script, which would then process the file's content however it wants to. (Personally, I'd love to run Rust code like that by passing it to some online API)

    I may add more points to the list later. I was thinking about posting this for a long time yet never wrote down any of these observations, so this list is most likely incomplete.


    Device information: iPhone 6+ iOS 12.4

    posted in Pythonista read more
  • ForceBru

    @aerokuzbass, this is how I managed to output Cyrillic characters in Matplotlib:

    import sys
    import matplotlib.font_manager as fm
    
    if sys.platform.lower() == 'ios':
        fp = fm.FontProperties(fname = "/System/Library/Fonts/CoreAddition/Arial.ttf")
    elif sys.platform.lower() == 'darwin':  # for macOS
        fp = fm.FontProperties(fname = '/Library/Fonts/Verdana.ttf')
    else:
        raise ValueError('Platform not supported:', sys.platform)
    

    Then you do something like matplotlib.pyplot.title("Привет, мир!", fontproperties=fp). So, basically, you only need to choose a font to use to display the characters.

    posted in Pythonista read more
  • ForceBru

    Congratulations, @omz! Pythonista is the best app for Python programming on iOS! I use it every day (yep, I'm a Python fan; also, a Pythonista fan, definitely) and I like everything about it. I mean, with Pythonista I can do everything I can do on my computer. Pythonista runs very smoothly and allows the use of all Python features (...except multiprocessing and subprocesses, but this is understandable), which is perfect!

    BTW, it would also be super awesome if you could create a C or C++ IDE just like Pythonista :D At the moment, there are no apps in the AppStore that provide stable offline compilation of C or C++ code.

    posted in Pythonista read more
  • ForceBru

    @omz, anyway, I've filled in the form, so now you have one more Pythonista fan ready for beta testing! Keep up the good work!

    posted in Pythonista read more
  • ForceBru

    @dgelessus, where did you get the link to this Google Form? Has it been posted on the Pythonista's site or in Twitter or via Slack? Is there any official source? Please provide the link from where you copied this.

    posted in Pythonista read more
  • ForceBru

    @JonB, didn't know about the c variable, this is exactly what I was looking for, thank you!

    posted in Pythonista read more
  • ForceBru

    @dgelessus, woah, I bet Python 3.6 support is gonna be super cool! Is there any way to get the beta? Maybe through TestFlight? If so, do you know how to sign in for testing? The Apple Help discusses this from the developer's point of view and says that a tester must somehow provide their e-mail address to the developer, but how to actually do this isn't clear.

    Yeah, I didn't think about trying to hard-code the path. This is actually what I use on a jailbroken device :P

    posted in Pythonista read more
  • ForceBru

    I've been an (almost) everyday user of Pythonista, as it's really cool to have a Python IDE right at my fingertips, no need for a computer, yay! And I have to say it's absolutely amazing! (BTW, I'm waiting impatiently for updates, are there any planned?) I mean, a full Python interpreter on iOS is a marvel already, but this is a fully featured IDE, just blew my mind when I first installed it a few years ago.

    Now, I've got a question about the ctypes module. How is it useful in Pythonista? As far as I understand, one of its primary goals is to allow people to run C functions from Python, but it's absolutely impossible on iOS (or is it?) because there's no way to sign that C code... I even can't load libc, simply because it's not here, and ctypes.util.find_library doesn't find anything. However, I have to say that it works perfectly on jailbroken devices where libc is installed, but for non-jailbroken ones, ctypes is almost useless.

    Or am I missing the point? Is it possible to call standard C functions through ctypes in Pythonista? What do I use ctypes for, if not for calling C functions? According to the docs, I can use C types and work with memory, but it's not that useful... or is it?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!