When Apple released the M1 iPad Pros in March of 2021, I traded in my MacBook Pro to get the latest tablet. I’d already been using a mac Mini as my daily workhorse, so I wasn’t concerned about my day-to-day coding workflow. But I was very curious to know what coding on the iPad looks like, and if a full-featured professional coding set-up was even possible.
While a native Python IDE experience is still unavailable for iPadOS — and might never be — it turns out that it’s actually pretty easy to code in Python on the iPad, especialy if you’re willing to work in Jupyter Notebooks. You don’t even need an iPad Pro!
Here are five ways you can code in Python on any iPad right now.
My goto app for using Python on the iPad is Nicolas Holzschuch’s fantastic a-Shell app. a-Shell gives you a Unix-style terminal on your iPad or iPhone and it’s completely free. It’s also quite powerful.
Click here to open a-Shell in the Apple Store
Once you install and open a-Shell, type
help to get a quick overview of the app:
a-Shell comes with
ed for editing files, and it includes Python 3.9 out-of-the box. Here’s what editing a Python file in
vim looks like:
Esckey. This makes working in vim painful until you figure out that
Cmd + .works like
Esc. If you'd like, you can change
Caps Lockto work as
Escin a-Shell’s settings.
You can also map the globe key on the Magic Keyboard to function as
Escin the Settings app.
a-Shell plays nicely with iPadOS 15’s multi-tasking features. You can open new windows, put a-Shell side-by-side with another app, and — my favorite — use a-Shell in slideover mode.
I do a lot of reading on my iPad. When I come across something that I want to check in the Python REPL, it’s incredibly helpful to be able to swipe in from the right-hand-side of my iPad, quickly check something in the REPL, and then dismiss the app by swiping right:
You can install Python packages using
pip in a-Shell as long as those package are pure Python. This is admittedly a serious limitation for a lot of folks, but it does allow you to install some pretty awesome packages — including Will McGugan’s awesome rich library:
Besides being a great way to use Python on your iPad, a-Shell has a lot of other useful features. You can navigate your iPad’s file system, transfer files using
curl, generate SSH keys, SSH into remote servers, and more. You can even write programs in C and C++ and run them on your iPad 🤯
One of a-Shell’s major downsides is the lack of support for Python virtual environments. This means a-Shell is great for testing things out, or for doing some basic, pure-Python programming, but it’s not very well suited to professional development.
Carnets is a free, standalone Jupyter notebook app available on iPad and iPhone. You get a full Python and Jupyter implementation — no need to connect to an external Jupyter server — as well as a handful of useful Python packages, including NumPy, pandas, and Matplotlib.
Click here to view Carnets on the App Store
You can create, view, and edit notebook files, including ones that you created elsewhere or were sent to you by a colleague. The thing that I like most about it is that it “just works.” Download the app and in a few minutes you’re running Jupyter notebooks right on your iPad.
Carnet’s interface looks just like Jupyter in a browser. But what you see is what you get. There aren’t any bells and whistles here.
If you need to install a package that doesn’t come with Carnets, you can use
%pip install inside of a notebook cell to install the package:
To see all of the Python packages you get with Carnets, run
%pip list. There are quite a few — although many you see in the following list were installed by me or as dependencies of packages I installed:
There are two versions of Carnets available in the App Store:
1. Carnets – Jupyter
2. Carnets – Jupyter (with scipy)
Carnets – Jupyter (with scipy) includes a few additional packages for doing machine learning right on your iPad:
coremltools. If you can afford the extra space, I highly recommend downloading Carnets – Jupyter (with scipy) instead of the base Carnets app.
Like a-Shell, the Carnets app doesn’t let you create isolated Python environments. You’re stuck using the global environment and whatever package versions come pre-built with the app.
Juno is another Jupyter notebook app for the iPad that bills itself as a Jupyter IDE. Like Carnets, you get Python bundled with some extra packages. Unlike Carnets, Juno costs $15 and comes with some nice bonus features.
Click here view Juno on the App Store
Juno really stands out from Carnets with its sleek and modern iPad interface:
You can run cells by pressing
Shift + Enter inside of the cell or by tapping the blue Run Cell button at the bottom right-hand corner of the screen.
The lightning bolt button gives you quick access to some common tasks. You can change the cell type from code to Markdown, move cells up and down, and cut, copy, paste, and delete cells:
While Carnets can open Jupyter notebooks from anywhere on your iPad, the interface isn’t very iPad-friendly. Contrast this to Juno’s file picker, which really feels at home on iPad and iOS devices:
Another area where Juno shines is the IDE-like tab completion and tooltips that come built-in:
Like Carnets, Juno comes with a suite of built-in packages. But you can’t run
%pip list in a cell to see them all like you can in Carnets:
Package management in Juno is actually a bit of a disappointment, especially for an app that costs $15.
I couldn’t find a complete list of packages that come pre-installed with Juno, but here are a few imports that worked out of the box:
To install a package, click the name of the notebook at the top-center of the screen and select Install Python Package. You’ll see the following dialog box:
Like Carnets and a-Shell, you can only install pure Python packages. But unlike Carnets and a-Shell, any dependencies of a package you install won’t be installed automatically. You’ll need to install them manually one-by-one.
One nice thing about Juno’s package manger is that you get a chance to see some metadata for a package before you install it, including dependencies — which you can install at the touch of a button:
As I mentioned before, you can’t use
%pip list in Juno to view the packages you have installed into Juno’s environment. In fact, there is no way to view your installed packages from within Juno.
Instead, you must open the Files app and navigate to the
site_packages/ folder in Juno’s on-device storage:
If you want to remove one of your installed packages, you need to do that manually from within
site_packages/. I find this to be a major shortcoming. I really appreciate the quick access to
pip using the
%pip magic command supported by Carnets.
Despite the clunky package manager, Juno does look much nicer than Carnets and the tab-completion and tooltips do boost productivity. If those features matter to you and you’re willing to fork over the $15, then Juno is a nice option.
4. Juno Connect
Juno Connect is a Jupyter notebook client app that can be used to access Jupyter on a remote server. So, technicaly, Python isn’t running on your iPad, but Juno Connect provides a beautiful interface for working with remote notebook servers. You can purchase it from the App Store for $10.
Click here to view Juno Connect on the App Store
When you first launch Juno Connect, you’ll a see a screen with some notebooks ready to try out, as well as several options to connect to remote notebook servers:
Juno Connect support services like Cocalc and Binder right out of the box. You can also connect to Jupyter servers hosted elsewhere, such as on a Digital Ocean droplet.
When you connect to a notebook server, you’ll see a screen like the one below, where you can create a new notebook or select one to open:
Once you open or create a new notebook, you’ll see an interface that looks exactly like the typical Juno interface. And since the notebook is running on an external server, you get access to all of the typical Jupyter features, including the
%pip magic that doesn’t work with the local-only version of Juno:
One nice feature of Juno Connect is the ability to export a remote notebook to a local file on your iPad:
You can even export the notebook as a new notebook, allowing you to save a local copy to work with offline in either Juno or the Carnets app.
5. Codeanywhere Cloud IDE
The last option on my list isn’t an iPad app and it doesn’t run Python locally on your iPad, but it’s absolutely essential if you need access to a full-blown development environment. That solution is the Codeanywhere Cloud IDE.
Plans start at $6 per month and you can get a 40% discount if you prepay for two years. This unlocks a VS Code style IDE that runs entirely in your browser.
Click here to get a 10% discount off any Codeanywhere subscription
Once you choose a plan and create an account, you’ll be taken to your dashboard where you can create new containers for working on projects:
When you click on New Container, you’ll have the opportunity use a blank Ubuntu Linux container or to select from some pre-defined containers with various languages pre-installed:
Once you create a container, it takes a few minutes for it to spin-up and become available to you in your dashboard:
The resources you get per container depend on the plan you selected. My plan gives me 15GB of storage and 4GB of memory.
Click the green Open IDE button to launch the IDE in a new browser tab:
If you’re familiar with VS Code, you’ll feel right at home in Codeanywhere’s IDE. It’s incredibly full-featured, including things like linter and debugging support:
You can even install extensions!
Codeanywhere is pricy compared to the other options mentioned in this list. It also requires an internet connection. But, I can’t live without it. It’s the best way I’ve found to do some hardcore coding on my iPad.
Additional Ways To Code In Python On Your iPad
The five tools I've mentioned are what I currently use day-in and day-out to run Python on my iPad, but there are a number of other options that deserve a mention.
Whenever I bring up coding in Python on the iPad, I get a flurry of comments praising the Pythonista3 app. There was a time when Pythonista3 was a great option, but that’s no longer the case in my opinion.
First of all, Pythonista3 appears to be completely abandoned. The last version was released over a year ago before iPadOS 14 was available (the current version of iPadOS at the time of writing is 15). And, second, Pythonista3 only supports Python 3.6, which reached it’s end of life in December 2021.
The PyTo app is a serious contender in the Python-for-iPad space. You get Python 3.10 running locally with a nice IDE-style experience, support for editing multiple files, several bonus packages including NumPy, SciPy, Scikit-learn, and statsmodels. The full app experience costs $10.
I'm currently giving PyTo a run for it's money to see how it fits into my daily use. If it lives up to it's promise, you might find it higher up on the list in a future update to this article!
Google’s Colab is a browser-based notebook based on Jupyter notebooks. Your code runs on a private virtual machine that comes with most of the Python scientific stack pre-installed. You even get free access to GPUs, which makes Colab a great option for machine learning projects. If you need guaranteed uptime and more power, check out Colab Pro.
I've never used GitHub's Codespaces project, but if you have a GitHub organization on the Team or Enterprise plan, this might be a good option. It looks very similar to Codeanywhere.
The pyodide project brings Python and over seventy-five package in Python's scientific stack to any browser by compiling them all to WebAssembly. You can try pyodide in a REPL and bookmark it for quick access in the future.
iPad + RaspberryPi
Another option is to connect your iPad to a Raspberry Pi via USB, which allows you to access the Raspberry Pi as an ethernet device. This is really cool, but personaly I don’t want to have to carry any more devices around with me than I need to. It does make for a fun little project, though, and gets you access to a full local development server.
I’d love to see a native version of an IDE like VS Code on the iPad, but I don’t think it’s ever going to happen. However, between a-Shell, Carnets, and Codeanywhere, I’ve been able to do everything that I’ve needed to from my iPad. Of course, your mileage may vary.
So, in 2022, coding in Python on the iPad is not only feasible, it’s actually quite fun!
Get a curated list of five curiosity-inducing articles and resources each week from around the Python and Julia communities by subscribing to my Curious About Code newsletter.
And if you're interested in taking your coding skills to the next level, I offer private one-on-one coaching for Python programming and technical writing.::...
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
订阅 substack 体验古早写作:
点击注册~> 获得 100$ 体验券:
关于 ~ DebugUself with DAMA ;-)
公安备案号: 44049002000656 ...::