Python on ipad programing

Pythonista 3 4+

I’m a full time developer and I don’t know what I would do without Pythonista. For one, twice a week I go to our local hospital for my allergy shot. I have to sit there for 30 minutes after the shot. With Pythonista, I bring my iPad and I can keep on working on my Python apps that I’m creating.
I get tired sitting at the computer. I can head over to the couch to sit with my pups, but on Big Bang Theory, and keep on working.
Go outside on nice day, sit at the patio table and keep on programming.
One one request. I know a lot of people prefer Git. I hate Git now that Microsoft purchased it. I use OpenSource Fossil. It would be GREAT to have the feature to be able to clone a repository using Fossil. I know there are a lot more people using Git. But, finger crossed if you add the feature, one more people would be aware how fantastic Fossil is and might start using and supporting OpenSource Fossil. Thanks in advance for any consideration on the Fossil feature!

This App Got Me Into Programming

I started using this app when I was 12 on my iPad that I had as a kid. The app is amazing, and has custom modules that let you control your device and create custom apps and such. It’s got UI modules, full access to documentation, and all the normal python modules. Even better, it works entirely offline. This app singlehandly allowed me to program things when and where I wanted, and allowed me to become a skilled programmer getting a degree in computer science. As far as mobile IDEs go, it’s the absolute best. In addition, there’s a community that creates tons of incredible programs that enhance the IDE, such as GitHub support, and even a fully functional bash terminal complete with pip so that you can install your own custom modules. It really is the best app on iOS for programming, and I would recommend it to anybody looking to try out programming. It’s well worth it’s price tag.

Excellent tool for on the go Python

I usually don’t write reviews, but I felt compelled to for this gem of an app. I regularly program on the side for fun and automation. I’ve used Pythonista to automate tasks on my phone, prototype programs for my Windows and Linux computers, and built silly games to play for fun. I’ve used Python at work to drastically speed up our workflows by several hours, which has been a life saver and even garnered me a raise. Not only was Pythonista an indispensable tool for prototyping those programs, but it has allowed me the opportunity to improve my skills on the go. There are some limitations I wish didn’t exist, but this is because of Apple, not the developers. The developers have gone above and beyond to implement extra libraries and integrate Pythonista with iOS. If you’re looking for a good iOS Python app or want to learn Python on the go, I highly recommend this app!

App Privacy

The developer, omz:software , indicated that the app’s privacy practices may include handling of data as described below. For more information, see the developer’s privacy policy.

Читайте также:  Sysplugins smarty internal template php

Data Not Collected

Information

Compatibility iPhone Requires iOS 12.0 or later. iPad Requires iPadOS 12.0 or later. iPod touch Requires iOS 12.0 or later. Mac Requires macOS 11.0 or later and a Mac with Apple M1 chip or later.

Источник

Pythonista. Пишем на Python для iOS

Планшет iPad от компании Apple — всем известное и не нуждающееся в рекламе устройство. Но очень часто хочется использовать всю мощь этого устройства не только для игр и развлечения, а для серьёзной работы. Например для написания программ. Несмотря на 4-x летнею историю развития этого гаджета и наличие разных моделей удобных сред для программирования под iOS существует крайне мало. (Оговорюсь сразу, во избежании дальнейшей путаницы: программирование на iOS — значит написание кода и запуск программы на iPad или iPhone, а программирование для iOS — написание приложения, которое может быть выложено в App Store.)

Недавно я наткнулся на великолепную программку Pythonista, которая позволяет писать на iOS для iOS.

Краткое описание

И это действительно так. Программа является лучшим компилятором для Python.

На мой взгляд, лучшим это приложение делают 3 вещи:

  • Не нужно интернет-подключение для запуска программы. iPad действительно становиться рабочей станцией;
  • Есть всплывающие подсказки и встроенная документация (опять же без доступа к интернету);
  • И, конечно, самое главное, это возможность экспорта в XCode.

Обзор

Среда ориентирована на Python 2.7. Но есть и некоторые фишки из 3-й ветки. Например, сработает и такой код:

Кроме стандартных библиотек, есть несколько библиотек для непосредственной разработки для iOS. Остановлюсь на одной. Она называется ui и отвечает за GUI.

Рассмотрим несколько примеров работы с этой библиотекой. Очень интересно, что в Pythonista графический интерфейс можно задавать программно, а можно нативно:

import ui def button_tapped(sender): sender.title = 'Hello' view = ui.View() # [1] view.name = 'Demo' # [2] view.background_color = 'white' # [3] button = ui.Button(title='Tap me!') # [4] button.center = (view.width * 0.5, view.height * 0.5) # [5] button.action = button_tapped # [6] view.add_subview(button) # [7] view.present('sheet') # [8] 

Это первый пример по работе с библиотекой ui. Разберём программу построчно:

1) Сначала создаём объект View;
2) Потом задаём имя этого объекта, оно будет отображаться в его заголовке;
3) Устанавливаем цвет фона объекта — белый, можно задавать словом, а можно при помощи RGB;
4) Создаём кнопку с надписью «Tap me!»;
5) Размещаем кнопку на объекте;
6) Задаём функцию, которая будет выполняться при нажатии на кнопку. (В данном случае изменится надпись на кнопке);
7) Уточняем, что «button» является наследником «view»;
8) Наконец, вызываем метод view.present() для отображения объекта на экране iOS устройства.

Вот что будет происходить на айпаде:

imageimage

Но тоже самое можно сделать и нативно:

image

2) Открыв UI, нажмем на кнопку «+» и выберем button:

image

3) Растянем кнопку и разместим её по центру экрана:

image

4) Откроем атрибуты кнопки и зададим функцию, срабатывающую при её нажатии:

imageimage

4) Перейдём в редактор скрипта и напишем функцию:

def button_tapped(sender): sender.title = 'Hello' 

Скажем, к какому UI привязать данный скрипт:

ui.load_view('My UI').present('sheet') 

image

5) Запустим программу:

imageimage

В завершение

В завершение хочу сказать, что представленный мною обзор далеко не полон и не раскрывает всех функций этой программы. Множество примеров, отличное описание библиотек — всё это позволит довольно быстро разобраться во всех свойствах этого приложения.

Рекомендую посетить сайт создателей Pythonista. На нём есть документация , к сожалению, только на английском языке.

UPD: Читайте мою статью посвящённую этой программе и автоматизации iOS в февральском номере журнала ][акер

Источник

How to use Python on iPad

For all of you who have been reading my blog on Python for Finance and watching my videos, I wanted to share with you how to code in Python using an iPad.

Why Python for iPad?

Some of you may be wondering why should I change my laptop for my iPad in order to code? From my point of view, I do not see the iPad replacing the laptop for coding purposes. At least not in the short term. However, it can be used as a great complement to the laptop for coding purposes.

For example, imagine that you are going for a weekend to visit your family somewhere in the lake and you do not feel like taking the computer and charger with you. In that case, if you want to keep coding during the weekend getaway, the only option left is to carry on an iPad.

How to code using Python on an iPad?

From my experience, the best way that I have found so far to use Python on an iPad is through Google Colab. It is a free tool available to everyone having a Gmail/Google account.

Google Colab offers the same functionality as Jupyter notebook. Colab allows you to write and execute Python in your browser and the main advantages are:

  • There is not pre set-up required. It comes with plenty of packages pre-installed. I.e. Pandas, Numpy, TensorFlow, Scikit-learn, Matplotlib and many others. We can use them simply by importing the packages.
  • Scripts are available in all devices. I.e. Same scripts can be accessed and edited in laptop and iPad.
  • Free access to GPUs.
  • The code and script can be very easily shared with others. The script created can be uploaded into Github or downloaded to the local disk as a .py extension.
  • The best of all is that it is totally for free and enable us to code with Python on iPad.

To sum up, I see Google Colab as great tool to use it for financial analysis or any other data science projects. All of my articles posted in Medium are done using Google Colab or Jupyter Notebook. Which means that they all can be replicated using an iPad.

How to set up Google Colab?

In order to start using Python on iPad, we need to have a Google drive account. Google Drive offers free cloud storage for personal use. You can create a free account here.

Once an account is created, below are the steps to follow in order to start coding in iPad:

  1. Login using the browser to Google Drive in your iPad. Then, create a new Colab document by clicking on New:

2. Select More and Google Colaboratory. If you do note see Google Colaboratory in the list, click on Connect more apps in order to install it into your Google Drive.

3. A new Google Colab document will open where we will be able to add our code or text:

4. Below are the main parts of a document. Click on 1 to rename the document. 2 and 3 let you add new cells for coding or simple text edition. 4 is the cell where we can enter the Python code. Once the script is ready, click on 5 to run the code in that cell. Finally, save or download your code by using the tool bar (6).

5. Start typing your code. Below in as simple example to create a Pandas DataFrame:

6. Run the cell to execute the code by clicking in the play button. The outcome is shown below the cell:

Wrapping Up

As we have seen, it is super easy to start to use Python on an iPad. However, I do not see my iPad replacing my laptop for my Python projects for two reasons.:

  • First and more important, it is super inefficient for me to write code using the iPad onscreen keyboard. I am slower and more prone to errors than using a normal keyboard. I will share my experience in a later post if by using the iPad Magic Keyboard the experience improves.
  • And the second reason is the smaller screen in my iPad compared to my laptop or desktop computer.

Nevertheless, from time to time, specially when I have to travel, I use my iPad for Python coding and it works as if I were coding in a computer. Feel free to leave a comment with your experience on coding with iPad and which app are you using for it.

I also have a short Youtube video on how to code in Python using an iPad:

Источник

Оцените статью