ios上运行python

This holiday I discovered Pythonista, and my mind was blown.

这个假期,我发现了Pythonista ,这让我很震惊 。

In the iOS world, Pythonista is a well known quantity. I can find articles about it from sources like MacStories from back in 2012. Back then it was fairly rudimentary: no support for folders, no ability to import code from outside the app (at least not easily), and limited ability to interact with lots of parts of the OS. But it was clearly useful to a lot of people as a powerful tool for automating their iOS devices.

在iOS世界中,Pythonista是众所周知的数量。 我可以从2012年的 MacStories等来源找到有关此文章的文章。 那时还很初级:不支持文件夹,没有能力从应用程序外部导入代码(至少不容易),并且与操作系统的许多部分进行交互的能力有限。 但这对于许多人来说显然是有用的,它是使他们的iOS设备自动化的强大工具。

However, it seems like many of the people who were using this to automate their iOS devices weren’t Python developers, and most Python developers didn’t seem to be fully aware that it existed. If they were, they would have found that 2012’s little Python interpreter in an iOS app has turned into a nearly fully-fledged Python programming environment. How did this happen? In no small part, it’s down to Stash.

但是,似乎许多使用此工具来自动化其iOS设备的人都不是Python开发人员,而且大多数Python开发人员似乎都没有完全意识到它的存在。 如果是这样的话,他们会发现2012年iOS应用程序中的小型Python解释器已经变成了几乎成熟的Python编程环境。 这怎么发生的? 在很大程度上,这取决于Stash 。

Stash is a pure-Python implementation of a Bash-like shell for Pythonista. Essentially, you download and install it and then execute a helper script inside Pythonista. That helper script opens up a new console window and gives you, amazingly, a shell prompt with a filesystem:

Stash是Pythonista的Bash式外壳的纯Python实现。 本质上,您可以下载并安装它,然后在Pythonista中执行一个帮助程序脚本。 该帮助程序脚本将打开一个新的控制台窗口,并为您提供了一个带有文件系统的shell提示:

This is a little bit mind blowing. But it gets better because, you see, this shell has got some game. It comes with a few killer applications essentially reimplemented using Python, the most notable of which are git and pip. Now, to be clear, these applications are very much reimplementations of the standard tools: they often don’t have the same syntax as the originals and they have weird limitations that the others don’t have. But together they let you do this:

这有点令人不寒而栗。 但是它会变得更好,因为您知道该外壳具有一些功能。 它带有一些使用Python重新实现的杀手级应用程序,其中最著名的是gitpip 。 现在,很明显,这些应用程序是标准工具的重新实现:它们通常与原始应用程序没有相同的语法,并且它们具有其他应用程序没有的奇怪限制。 但是,他们让您一起做到这一点:

That’s me installing a Python package from PyPI and cloning and git repository. And the clone works: all the code is now available, version controlled, in my Pythonista filesystem, as you can see in the sidebar below:

那就是我从PyPI安装Python包,然后克隆和git仓库。 克隆也可以正常工作:在我的Pythonista文件系统中,所有代码现在都可用,受版本控制,如下面的侧栏中所示:

This is pretty big! Essentially I now have access to every pure-Python module that has ever been published, fully executable, on my iOS device. And they work too. Some quick investigation revealed that even somewhat unexpected things work: for example, the curio asynchronous I/O framework for Python 3.5+ runs unmodified, implying that sockets, selectors, and even TLS behave as expected. All of my HTTP/2 toolchain runs as well, meaning that I was able to whip up a quick HTTP/2 client in pure-Python using curio and hyper-h2 and that was capable of doing a complete HTTP/2 request from my iPad, as you can see below:

这个很大! 从本质上来说,我现在可以访问我的iOS设备上所有已发布的,完全可执行的纯Python模块。 他们也工作。 一些快速调查显示,即使有些出乎意料的事情也能起作用:例如,用于Python 3.5+的curio异步I / O框架未修改就运行,这意味着套接字,选择器甚至TLS的行为均符合预期。 我所有的HTTP / 2工具链也都正常运行,这意味着我能够使用curio和hyper-h2在纯Python中生成一个快速的HTTP / 2客户端,并且能够从我的iPad发出完整的HTTP / 2请求,如下所示:

这是什么意思? (What Does This Mean?)

This means that we’re very close to having a fully-fledged Python programming environment on our iOS devices. The advantages of this are pretty substantial. Firstly, for those who want it, it opens up a world of scripting and automation opportunities that iOS has previously hidden away. Pythonista has a lot of hooks into the operating system that allow you to write applets or helper functions that can automate boring tasks. The folks over at MacStories have written an enormous number of posts demonstrating some of the cool things that Pythonista can do to automate their workflows. When you add in to this the fact that there is now a fairly functional PyPI client available to obtain any helper libraries you might need, you have the ability to write almost arbitrary code that can operate on data made available elsewhere in the OS. This is an enormously powerful tool, and for anyone who is really serious about being a hardcore iOS power user it is absolutely worth investigating.

这意味着我们非常接近在iOS设备上拥有完整的Python编程环境。 这样的优点是相当可观的。 首先,对于那些想要它的人,它打开了iOS以前隐藏的脚本和自动化机会的世界。 Pythonista在操作系统中有很多钩子,可让您编写可自动执行无聊任务的applet或辅助函数。 MacStories的人们写了许多文章,展示了Pythonista可以做的一些很酷的事情来自动化他们的工作流程。 当您添加一个事实,即现在可以使用功能相当强大的PyPI客户端来获取您可能需要的任何帮助程序库时,您就可以编写几乎任意的代码,以对OS上其他地方可用的数据进行操作。 这是一个非常强大的工具,对于真的很想成为iOS核心用户的任何人,绝对值得研究。

But more importantly, it’s one step closer to not needing a full PC to work on Python code. For my part, I’ve been interested in trying to move away from needing a laptop for travel purposes. There are a number of boring reasons for this, but ultimately my requirement has been that I needed something like a proper Python shell on an iOS device to consider swapping over to an iPad as travel computer.

但更重要的是,与不需要完整的PC来处理Python代码相比,这又迈出了一步。 就我而言,我一直想摆脱旅行所需的笔记本电脑。 有很多无聊的原因 ,但最终我的要求是,我需要在iOS设备上使用适当的Python shell之类的东西,才能考虑作为旅行计算机交换到iPad上。

Amazingly, this puts us pretty close by. An upcoming release of Stash is going to support the pip console_scripts extensions, which should make it possible to install and run py.test (my preferred testing framework). If that happens, I’ll be in possession of an environment with git support and the ability to code and run my tests on the go, with no network connection required. At that point I may finally be in a position where I can do a reasonable amount of work from my iOS device.

令人惊讶的是,这使我们非常接近。 Stash即将发布的版本将支持pip console_scripts扩展,这将使安装和运行py.test (我的首选测试框架)成为可能。 如果发生这种情况,我将拥有一个具有git支持并且能够随时随地编写和运行测试的功能的环境,而无需网络连接。 到那时,我可能终于可以在我的iOS设备上做一些合理的工作了。

This environment is still not perfect. There are some alarming bug reports about the git logic inside Pythonista, which means I’d rather use Working Copy, but it seems that right now Pythonista isn’t able to treat Working Copy as a full-fledged document source. In my ideal world Working Copy would be able to expose the whole git tree to Pythonista so that Pythonista could “mount” it on the filesystem, but it doesn’t immediately seem to be possible. If it became possible, I’d consider the combination of those two applications as being pretty close to the “killer app” for Python development on iOS.

这种环境仍然不是完美的。 关于Pythonista内部git逻辑的一些令人震惊的错误报告,这意味着我宁愿使用Working Copy ,但现在看来Pythonista无法将Working Copy视为完整的文档源。 在我的理想世界中,Working Copy可以将整个git树公开给Pythonista,以便Pythonista可以将其“挂载”到文件系统上,但是似乎不可能立即进行。 如果有可能,我认为这两个应用程序的组合非常接近iOS上用于Python开发的“杀手级应用程序”。

Regardless, this is one of the most exciting discoveries I’ve made in a long time. I’m able to write genuine Python code to interact with my iOS device without needing to build an entire app to do it. This drastically reduces the overhead in scripting my operating systems, which is a huge leap forward in terms of flexibility.

无论如何,这是我很长一段时间以来最激动人心的发现之一。 我能够编写真正的Python代码来与我的iOS设备进行交互,而无需构建整个应用程序来完成。 这大大减少了编写操作系统脚本的开销,这在灵活性方面是一个巨大的飞跃。

It also opens a neat world of physical computing. As anyone who knows about computing education can tell you, physical computing is enormously important for educating children in computation because it provides them with direct feedback, demonstrating the utility of computing in an immediate manner. This is commonly done for smaller children with devices like the BBC Micro:bit, but for older children the most obvious device to use is their phone. For a long time, Android devices have been the easiest devices to use for this, but it’s good to see that iOS devices are now open to being used in this way.

它还为物理计算打开了一个整洁的世界。 正如任何了解计算教育的人都可以告诉您的那样,物理计算对于教育儿童进行计算非常重要,因为它可以为孩子提供直接的反馈,从而立即证明了计算的效用。 这通常是针对年龄较小的孩子使用的设备,例如BBC Micro:bit ,但是对于年龄较大的孩子,最明显的设备是手机。 长期以来,Android设备一直是最容易用于此目的的设备,但是很高兴看到iOS设备现在可以以这种方式使用。

This is very cool, and I’m really looking forward to seeing what the community does next.

这非常酷,我非常期待看到社区接下来要做的事情。

翻译自: https://www.pybloggers.com/2016/12/python-on-ios/

ios上运行python

ios上运行python_iOS上的Python相关推荐

  1. 在windows 2008 server 的IIS 7上运行 django 1.11 + python 3.6

    缘起 使用django开发了一个项目,客户的技术体系是全栈window的,所以要求我们提供把项目部署到windows服务器的服务. 写这个原因是旧的在 windows 上运行python网站程序的文档 ...

  2. 在secureCRT软件上运行一些简单的python脚本

    secureCRT支持运行.js和.vbs以及.py格式的脚本,无奈mac上识别前两个格式的脚本只能写一写python脚本,  举个简单的例子,利用脚本直接ssh连接一台机器,  在View菜单中勾选 ...

  3. 在hadoop上运行python_hadoop上运行python程序

    数据来源: http://www.nber.org/patents/acite75_99.zip 首先上传测试数据到hdfs: [root@localhost:/usr/local/hadoop/ha ...

  4. opencv可以在linux上运行,linux上 安装并 运行opencv

    我是在树莓派上安装的. 1.先安装依赖项 OpenCV 2.2以后版本需要使用Cmake生成makefile文件,因此需要先安装cmake. sudo apt-get install build-es ...

  5. ios 上运行linux,你可曾想过在iOS上跑Linux?

    你可曾想过在IOS设备上运行Linux系统?或者用shell来传输文件.编写脚本,又或者使用Vi来开发代码? Here is a good news,现在有了一个叫iSH的东西,你可以使用它在IOS设 ...

  6. 有没有办法在Android上运行Python?

    我们正在开发S60版本,该平台具有不错的Python API. 但是,关于Android上的Python尚无任何官方资料,但是由于Jython存在,有没有办法让蛇和机器人一起工作? #1楼 目前还没有 ...

  7. 苹果手机上运行python_【后端开发】python能在苹果手机上运行吗

    Pythonista是在iPad和iPhone上编写Python脚本的一个完整的开发环境.它包含了许多示例:绘画游戏动画.图像处理.自定义用户界面和自动化脚本. 除了强大的标准库之外,Pythonis ...

  8. python能在苹果手机上运行吗

    Pythonista是在iPad和iPhone上编写Python脚本的一个完整的开发环境.它包含了许多示例:绘画游戏动画.图像处理.自定义用户界面和自动化脚本. 除了强大的标准库之外,Pythonis ...

  9. iOS架构-自动打包并上传到App Store(python)(21)

    这里是摘自一篇用python 语法写的脚本,这里只是为了更好的理解自动化打包上传App Store的原理的. 一. iOS 自动打包并上传到App Store(python) 我们平时大都是用Appl ...

最新文章

  1. Python的零基础超详细讲解(第四天)-Python的数据类型
  2. win8 C盘空间不足的几种解决方法
  3. 戴尔推免费浏览器安全工具 可隔离恶意软件
  4. inrange函数_Python 初学者必备的常用内置函数
  5. MFC+opencv 显示mat图像
  6. 在Qt Designer更改部件类名
  7. html制作任务计划列表网页,添加计划任务的脚本
  8. 打印英文年历C语言函数,C语言打印年历
  9. 【转】前端的BFC、IFC、GFC和FFC
  10. Power BI 报表服务器企业一站式全链路解决方案
  11. php文件上传实验总结,php文件上传总结 - osc_jjc36t9p的个人空间 - OSCHINA - 中文开源技术交流社区...
  12. Python shapefile转GeoJson的两种方式
  13. 联想g510升级换什么cpu好_联想G510笔记本完全拆机指南(图解)
  14. 腾“云”架“雾”,3DCAT实时渲染带你进入元宇宙
  15. excel公式编辑器_EXCEL从文件夹中提取符合条件的记录,其实很简单
  16. 云端服务器与传统的独立主机服务器有什么区别
  17. Kanzi Shader入门
  18. unity编辑器一些设置
  19. vue导入处理Excel表格详解
  20. UWB 技术 DW1000 芯片配套MCU STM32L100C6U6

热门文章

  1. Mysql 架构原理,自学编程找工作
  2. Zabbix监控服务器系统时间
  3. linux 字符串拼接命令,Shell 字符串拼接的实现示例
  4. 【日语】标日初级上册单词(17-20)1
  5. android拦截电话并且不留下通话记录,具透丨iOS 10 支持拦截骚扰电话了,这些事情你应该知道...
  6. factorio 体验 以及自定义mod开发调试记录
  7. 卷积层里的填充和步幅
  8. Blob Url下载文件
  9. 世界首富的22种习惯,值得你…
  10. Linux正则表达式(基于awk)