SlideShare a Scribd company logo
1 of 30
Download to read offline
Pythonista
iOS
@jbking
PyCon JP 2017
Who?
@jbking
Yarch( )
ex-OpenStacker
IoT Platform
Pythonista
?
Pythonista
• Pythonista: A full-featured Python environment for iOS devices
• europython 2014 https://ep2014.europython.eu/en/
schedule/sessions/109/
• Pythonista Pythonista 

iOS Pythonista
• https://pycon.jp/2016/ja/schedule/presentation/47/ PyCon
JP 2016
• Pythonista
• PyCon mini Kumamoto
(1)
•
•
• Pythonista iOS
• iOS Pythonista
•
• NumPy SymPy, SimPy, Matplotlib
• StaSh
• , Git
(2)
•
• iOS Python
•
• Python
• Objective-C
• iOS
Pythonista
iOS
•
• Xcode
•
• AppStore ?
•
• Xcode https://github.com/omz/
PythonistaAppTemplate
• Python
Pythonista iOS
• Pythonista Python
• iOS Framework Python
•
•
Python
Yes
No
Pythonista
No
Yes
C
iOS objc_util
No
Yes
Yes
No
• Pythonista
•
• (BLE)
• iOS
• ( , C/S)
• GPIO
•
• Python
• NG
• iOS Pythonista
• objc_util
• ( Framework … )
•
•
objc_util ???
objc_util
• Pythonista
• Objective-C
•
• iOS
• objc_msgSend
Framework
from objc_util import *
NSBundle.bundleWithPath_('/System/Library/
Frameworks/Photos.framework').load()
AVFoundation.framework AVKit.framework Accelerate.framework Accounts.framework AdSupport.framework
AddressBook.framework AddressBookUI.framework AssetsLibrary.framework AudioToolbox.framework
AudioUnit.framework CFNetwork.framework CallKit.framework CloudKit.framework Contacts.framework
ContactsUI.framework CoreAudio.framework CoreAudioKit.framework CoreBluetooth.framework CoreData.framework
CoreFoundation.framework CoreGraphics.framework CoreImage.framework CoreLocation.framework
CoreMIDI.framework CoreMedia.framework CoreMotion.framework CoreSpotlight.framework CoreTelephony.framework
CoreText.framework CoreVideo.framework EventKit.framework EventKitUI.framework ExternalAccessory.framework
Foundation.framework GLKit.framework GSS.framework GameController.framework GameKit.framework
GameplayKit.framework HealthKit.framework HealthKitUI.framework HomeKit.framework IOKit.framework
ImageIO.framework Intents.framework IntentsUI.framework JavaScriptCore.framework LocalAuthentication.framework
MapKit.framework MediaAccessibility.framework MediaPlayer.framework MediaToolbox.framework
MessageUI.framework Messages.framework Metal.framework MetalKit.framework
MetalPerformanceShaders.framework MobileCoreServices.framework ModelIO.framework
MultipeerConnectivity.framework NetworkExtension.framework NewsstandKit.framework NotificationCenter.framework
OpenAL.framework OpenGLES.framework PassKit.framework Photos.framework PhotosUI.framework
PushKit.framework QuartzCore.framework QuickLook.framework ReplayKit.framework SafariServices.framework
SceneKit.framework Security.framework Social.framework Speech.framework SpriteKit.framework StoreKit.framework
System.framework SystemConfiguration.framework Twitter.framework UIKit.framework UserNotifications.framework
UserNotificationsUI.framework VideoSubscriberAccount.framework VideoToolbox.framework
WatchConnectivity.framework WebKit.framework iAd.framework
from objc_util import *
UIScreen = ObjCClass('UIScreen')
screen = UIScreen.mainScreen()
if screen.brightness() < 0.3:
screen.setBrightness_(0.6)
else:
screen.setBrightness_(0.1)
from objc_util import *
def DemoClass_foo_(_self, _cmd, _s):
print('result: %s' % ObjCInstance(_s))
# NSObject
DemoClass = create_objc_class(
'DemoClass',
ObjCClass('NSObject'),
methods=[DemoClass_foo_],
protocols=[])
demo_obj = DemoClass.alloc().init()
demo_obj.foo_("hello")
result: hello
def DemoClass_foo_(_self, _cmd, _s): ...
def bar_baz_(_self, _cmd, _x1, _x2): ...
DemoClass = create_objc_class(
...
methods=[DemoClass_foo_, bar_baz_],
...
demo_obj = DemoClass.alloc().init()
demo_obj.foo_("hello")
demo_obj.bar_baz_(2, 3)
demo_obj.bar_(2, baz=5)
# UIColor.colorWithRed:green:blue:alpha
UIColor.colorWithRed(1.0, green=0.0,
blue=0.0, alpha=1.0)
UIColor.color(red=1.0, green=0.0, blue=0.0,
alpha=1.0)
from objc_util import ObjCClass
def is_word_valid(word):
reflib =
ObjCClass('UIReferenceLibraryViewController')
return reflib.dictionaryHasDefinitionForTerm_(word)
test_words = ['foo', 'bar', 'quuz', 'cat', 'dog']
for word in test_words:
print('%s: %s' % (word, is_word_valid(word)))
foo: False
bar: True
quuz: False
cat: True
dog: True
https://gist.github.com/omz/599ef8aeae22620261c6
from objc_util import *
UIApplication = ObjCClass('UIApplication')
vc =
UIApplication.sharedApplication().keyWindow
().rootViewController()
print(vc.childViewControllers())
<b'__NSArrayI': (
"<UINavigationController: 0x1038db200>",
"<PA2TabViewController: 0x104003000>",
"<PA2AccessoryTabViewController: 0x1038dac00>"
)>
Pythonista
• objc_util
• iOS Framework
• ObjCClass ObjCInstance
Python
•
•
•
IoT
• cb
• BLE
• CoreBluetooth
• Sony MESH
https://youtu.be/uJ6VVklLUQc
https://github.com/jbking/pythonista-misc/blob/master/mesh/button_demo.py
• objc_util
• SpriteKit
(SKPhysicsBody)
https://youtu.be/rS6FHvKrU6Y
https://github.com/jbking/pythonista-misc/blob/master/spritekit/skview-demo.py
•
• ui, Requests
•
• appex, webbrowser,
(pythonista://ScriptName)
tips
•
• view.present(hide_title_bar=True)
•
• CPU
• GPU
•
• Omz gist
• https://gist.github.com/omz/
• Pythonista Tools
• https://github.com/Pythonista-Tools/Pythonista-
Tools
Questions?

More Related Content

What's hot

最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情Yuta Kikuchi
 
「全ての確率はコイン投げに通ず」 Japan.R 発表資料
「全ての確率はコイン投げに通ず」 Japan.R 発表資料「全ての確率はコイン投げに通ず」 Japan.R 発表資料
「全ての確率はコイン投げに通ず」 Japan.R 発表資料Ken'ichi Matsui
 
差分プライバシーとは何か? (定義 & 解釈編)
差分プライバシーとは何か? (定義 & 解釈編)差分プライバシーとは何か? (定義 & 解釈編)
差分プライバシーとは何か? (定義 & 解釈編)Kentaro Minami
 
モンテカルロ法と情報量
モンテカルロ法と情報量モンテカルロ法と情報量
モンテカルロ法と情報量Shohei Miyashita
 
ブートストラップ法とその周辺とR
ブートストラップ法とその周辺とRブートストラップ法とその周辺とR
ブートストラップ法とその周辺とRDaisuke Yoneoka
 
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)Yoshitake Takebayashi
 
スパース性に基づく機械学習 2章 データからの学習
スパース性に基づく機械学習 2章 データからの学習スパース性に基づく機械学習 2章 データからの学習
スパース性に基づく機械学習 2章 データからの学習hagino 3000
 
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)StanとRでベイズ統計モデリング読書会 導入編(1章~3章)
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)Hiroshi Shimizu
 
ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介Naoki Hayashi
 
第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場Daisuke Yoneoka
 
負の二項分布について
負の二項分布について負の二項分布について
負の二項分布についてHiroshi Shimizu
 
ベイズ統計モデリングと心理学
ベイズ統計モデリングと心理学ベイズ統計モデリングと心理学
ベイズ統計モデリングと心理学Shushi Namba
 
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法Ken'ichi Matsui
 
トピックモデルの評価指標 Perplexity とは何なのか?
トピックモデルの評価指標 Perplexity とは何なのか?トピックモデルの評価指標 Perplexity とは何なのか?
トピックモデルの評価指標 Perplexity とは何なのか?hoxo_m
 
初めてのグラフカット
初めてのグラフカット初めてのグラフカット
初めてのグラフカットTsubasa Hirakawa
 
マルコフ連鎖モンテカルロ法入門-1
マルコフ連鎖モンテカルロ法入門-1マルコフ連鎖モンテカルロ法入門-1
マルコフ連鎖モンテカルロ法入門-1Nagi Teramo
 
最近思った機械学習(PyTorch)のベストプラクティス
最近思った機械学習(PyTorch)のベストプラクティス最近思った機械学習(PyTorch)のベストプラクティス
最近思った機械学習(PyTorch)のベストプラクティスMasato Fujitake
 
Pythonではじめるロケーションデータ解析
Pythonではじめるロケーションデータ解析Pythonではじめるロケーションデータ解析
Pythonではじめるロケーションデータ解析Hiroaki Sengoku
 
深層学習と確率プログラミングを融合したEdwardについて
深層学習と確率プログラミングを融合したEdwardについて深層学習と確率プログラミングを融合したEdwardについて
深層学習と確率プログラミングを融合したEdwardについてryosuke-kojima
 
研究室リテラシー教育スライド
研究室リテラシー教育スライド研究室リテラシー教育スライド
研究室リテラシー教育スライドNobutaka Shimada
 

What's hot (20)

最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情
 
「全ての確率はコイン投げに通ず」 Japan.R 発表資料
「全ての確率はコイン投げに通ず」 Japan.R 発表資料「全ての確率はコイン投げに通ず」 Japan.R 発表資料
「全ての確率はコイン投げに通ず」 Japan.R 発表資料
 
差分プライバシーとは何か? (定義 & 解釈編)
差分プライバシーとは何か? (定義 & 解釈編)差分プライバシーとは何か? (定義 & 解釈編)
差分プライバシーとは何か? (定義 & 解釈編)
 
モンテカルロ法と情報量
モンテカルロ法と情報量モンテカルロ法と情報量
モンテカルロ法と情報量
 
ブートストラップ法とその周辺とR
ブートストラップ法とその周辺とRブートストラップ法とその周辺とR
ブートストラップ法とその周辺とR
 
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)
マルコフ連鎖モンテカルロ法 (2/3はベイズ推定の話)
 
スパース性に基づく機械学習 2章 データからの学習
スパース性に基づく機械学習 2章 データからの学習スパース性に基づく機械学習 2章 データからの学習
スパース性に基づく機械学習 2章 データからの学習
 
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)StanとRでベイズ統計モデリング読書会 導入編(1章~3章)
StanとRでベイズ統計モデリング読書会 導入編(1章~3章)
 
ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介
 
第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場
 
負の二項分布について
負の二項分布について負の二項分布について
負の二項分布について
 
ベイズ統計モデリングと心理学
ベイズ統計モデリングと心理学ベイズ統計モデリングと心理学
ベイズ統計モデリングと心理学
 
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法
基礎からのベイズ統計学 輪読会資料 第4章 メトロポリス・ヘイスティングス法
 
トピックモデルの評価指標 Perplexity とは何なのか?
トピックモデルの評価指標 Perplexity とは何なのか?トピックモデルの評価指標 Perplexity とは何なのか?
トピックモデルの評価指標 Perplexity とは何なのか?
 
初めてのグラフカット
初めてのグラフカット初めてのグラフカット
初めてのグラフカット
 
マルコフ連鎖モンテカルロ法入門-1
マルコフ連鎖モンテカルロ法入門-1マルコフ連鎖モンテカルロ法入門-1
マルコフ連鎖モンテカルロ法入門-1
 
最近思った機械学習(PyTorch)のベストプラクティス
最近思った機械学習(PyTorch)のベストプラクティス最近思った機械学習(PyTorch)のベストプラクティス
最近思った機械学習(PyTorch)のベストプラクティス
 
Pythonではじめるロケーションデータ解析
Pythonではじめるロケーションデータ解析Pythonではじめるロケーションデータ解析
Pythonではじめるロケーションデータ解析
 
深層学習と確率プログラミングを融合したEdwardについて
深層学習と確率プログラミングを融合したEdwardについて深層学習と確率プログラミングを融合したEdwardについて
深層学習と確率プログラミングを融合したEdwardについて
 
研究室リテラシー教育スライド
研究室リテラシー教育スライド研究室リテラシー教育スライド
研究室リテラシー教育スライド
 

Similar to Pythonista iOS Development with Python

APIs in production - we built it, can we fix it?
APIs in production - we built it, can we fix it?APIs in production - we built it, can we fix it?
APIs in production - we built it, can we fix it?Martin Gutenbrunner
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合Carl Su
 
LTから入門するPython開発環境 #PyLadiesTokyo
LTから入門するPython開発環境 #PyLadiesTokyoLTから入門するPython開発環境 #PyLadiesTokyo
LTから入門するPython開発環境 #PyLadiesTokyoHidenori Matsuki
 
Xcodeを用いた iPhone/iPadアプリ開発
Xcodeを用いた iPhone/iPadアプリ開発Xcodeを用いた iPhone/iPadアプリ開発
Xcodeを用いた iPhone/iPadアプリ開発一樹 濱崎
 
Xcodeを用いたiPhone/iPadアプリ開発
Xcodeを用いたiPhone/iPadアプリ開発Xcodeを用いたiPhone/iPadアプリ開発
Xcodeを用いたiPhone/iPadアプリ開発ashphy
 
Python. Why to learn?
Python. Why to learn?Python. Why to learn?
Python. Why to learn?Oleh Korkh
 
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」techtalkdwango
 
Pythonistaの使い方
Pythonistaの使い方Pythonistaの使い方
Pythonistaの使い方Yusuke Muraoka
 
Python to go
Python to goPython to go
Python to goWeng Wei
 
Why the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceWhy the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceAndy Piper
 
Try EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test NightTry EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test Nightichiko_revjune
 
OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] Jose Manuel Ortega Candel
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platformsKirti Verma
 
Speedupiosdevelopment
SpeedupiosdevelopmentSpeedupiosdevelopment
Speedupiosdevelopmentslidepaddemo
 

Similar to Pythonista iOS Development with Python (20)

APIs in production - we built it, can we fix it?
APIs in production - we built it, can we fix it?APIs in production - we built it, can we fix it?
APIs in production - we built it, can we fix it?
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合
 
LTから入門するPython開発環境 #PyLadiesTokyo
LTから入門するPython開発環境 #PyLadiesTokyoLTから入門するPython開発環境 #PyLadiesTokyo
LTから入門するPython開発環境 #PyLadiesTokyo
 
Xcodeを用いた iPhone/iPadアプリ開発
Xcodeを用いた iPhone/iPadアプリ開発Xcodeを用いた iPhone/iPadアプリ開発
Xcodeを用いた iPhone/iPadアプリ開発
 
Applebu
ApplebuApplebu
Applebu
 
Applebu
ApplebuApplebu
Applebu
 
Xcodeを用いたiPhone/iPadアプリ開発
Xcodeを用いたiPhone/iPadアプリ開発Xcodeを用いたiPhone/iPadアプリ開発
Xcodeを用いたiPhone/iPadアプリ開発
 
Python. Why to learn?
Python. Why to learn?Python. Why to learn?
Python. Why to learn?
 
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
 
Pythonistaの使い方
Pythonistaの使い方Pythonistaの使い方
Pythonistaの使い方
 
Python to go
Python to goPython to go
Python to go
 
Why the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceWhy the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open Source
 
Introduction to the Python
Introduction to the PythonIntroduction to the Python
Introduction to the Python
 
Try EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test NightTry EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test Night
 
OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition]
 
Ik in action
Ik in actionIk in action
Ik in action
 
Python 1
Python 1Python 1
Python 1
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
 
Speedupiosdevelopment
SpeedupiosdevelopmentSpeedupiosdevelopment
Speedupiosdevelopment
 

More from Yusuke Muraoka

いかにして問題をとくか
いかにして問題をとくかいかにして問題をとくか
いかにして問題をとくかYusuke Muraoka
 
私のPythonとの関わりかた
私のPythonとの関わりかた私のPythonとの関わりかた
私のPythonとの関わりかたYusuke Muraoka
 
Substance D world-plone-day-2017
Substance D world-plone-day-2017Substance D world-plone-day-2017
Substance D world-plone-day-2017Yusuke Muraoka
 
Gunma.web #24 MySQL HA
Gunma.web #24 MySQL HAGunma.web #24 MySQL HA
Gunma.web #24 MySQL HAYusuke Muraoka
 
The Substance D - Plone Symposium Tokyo 2015
The Substance D - Plone Symposium Tokyo 2015The Substance D - Plone Symposium Tokyo 2015
The Substance D - Plone Symposium Tokyo 2015Yusuke Muraoka
 
プロパティディスクリプタとその拡張ライブラリ
プロパティディスクリプタとその拡張ライブラリプロパティディスクリプタとその拡張ライブラリ
プロパティディスクリプタとその拡張ライブラリYusuke Muraoka
 
Debug it-python-hack-a-thon-2011.02
Debug it-python-hack-a-thon-2011.02Debug it-python-hack-a-thon-2011.02
Debug it-python-hack-a-thon-2011.02Yusuke Muraoka
 
App Engineと非同期とテストと私
App Engineと非同期とテストと私App Engineと非同期とテストと私
App Engineと非同期とテストと私Yusuke Muraoka
 
Can A Python Go Beyond The Python
Can A Python Go Beyond The PythonCan A Python Go Beyond The Python
Can A Python Go Beyond The PythonYusuke Muraoka
 

More from Yusuke Muraoka (14)

いかにして問題をとくか
いかにして問題をとくかいかにして問題をとくか
いかにして問題をとくか
 
私のPythonとの関わりかた
私のPythonとの関わりかた私のPythonとの関わりかた
私のPythonとの関わりかた
 
Substance D world-plone-day-2017
Substance D world-plone-day-2017Substance D world-plone-day-2017
Substance D world-plone-day-2017
 
Gunma.web #24 MySQL HA
Gunma.web #24 MySQL HAGunma.web #24 MySQL HA
Gunma.web #24 MySQL HA
 
The Substance D - Plone Symposium Tokyo 2015
The Substance D - Plone Symposium Tokyo 2015The Substance D - Plone Symposium Tokyo 2015
The Substance D - Plone Symposium Tokyo 2015
 
プロパティディスクリプタとその拡張ライブラリ
プロパティディスクリプタとその拡張ライブラリプロパティディスクリプタとその拡張ライブラリ
プロパティディスクリプタとその拡張ライブラリ
 
Django learning Part2
Django learning Part2Django learning Part2
Django learning Part2
 
Django learning
Django learningDjango learning
Django learning
 
Poolboy
PoolboyPoolboy
Poolboy
 
Pyramid Security
Pyramid SecurityPyramid Security
Pyramid Security
 
Some about chef
Some about chefSome about chef
Some about chef
 
Debug it-python-hack-a-thon-2011.02
Debug it-python-hack-a-thon-2011.02Debug it-python-hack-a-thon-2011.02
Debug it-python-hack-a-thon-2011.02
 
App Engineと非同期とテストと私
App Engineと非同期とテストと私App Engineと非同期とテストと私
App Engineと非同期とテストと私
 
Can A Python Go Beyond The Python
Can A Python Go Beyond The PythonCan A Python Go Beyond The Python
Can A Python Go Beyond The Python
 

Recently uploaded

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Pythonista iOS Development with Python

  • 4.
  • 5. Pythonista • Pythonista: A full-featured Python environment for iOS devices • europython 2014 https://ep2014.europython.eu/en/ schedule/sessions/109/ • Pythonista Pythonista 
 iOS Pythonista • https://pycon.jp/2016/ja/schedule/presentation/47/ PyCon JP 2016 • Pythonista • PyCon mini Kumamoto
  • 6. (1) • • • Pythonista iOS • iOS Pythonista • • NumPy SymPy, SimPy, Matplotlib • StaSh • , Git
  • 7. (2) • • iOS Python • • Python • Objective-C • iOS
  • 8. Pythonista iOS • • Xcode • • AppStore ? • • Xcode https://github.com/omz/ PythonistaAppTemplate • Python
  • 9. Pythonista iOS • Pythonista Python • iOS Framework Python • •
  • 11. • Pythonista • • (BLE) • iOS • ( , C/S) • GPIO •
  • 12. • Python • NG • iOS Pythonista • objc_util • ( Framework … ) • •
  • 15. Framework from objc_util import * NSBundle.bundleWithPath_('/System/Library/ Frameworks/Photos.framework').load() AVFoundation.framework AVKit.framework Accelerate.framework Accounts.framework AdSupport.framework AddressBook.framework AddressBookUI.framework AssetsLibrary.framework AudioToolbox.framework AudioUnit.framework CFNetwork.framework CallKit.framework CloudKit.framework Contacts.framework ContactsUI.framework CoreAudio.framework CoreAudioKit.framework CoreBluetooth.framework CoreData.framework CoreFoundation.framework CoreGraphics.framework CoreImage.framework CoreLocation.framework CoreMIDI.framework CoreMedia.framework CoreMotion.framework CoreSpotlight.framework CoreTelephony.framework CoreText.framework CoreVideo.framework EventKit.framework EventKitUI.framework ExternalAccessory.framework Foundation.framework GLKit.framework GSS.framework GameController.framework GameKit.framework GameplayKit.framework HealthKit.framework HealthKitUI.framework HomeKit.framework IOKit.framework ImageIO.framework Intents.framework IntentsUI.framework JavaScriptCore.framework LocalAuthentication.framework MapKit.framework MediaAccessibility.framework MediaPlayer.framework MediaToolbox.framework MessageUI.framework Messages.framework Metal.framework MetalKit.framework MetalPerformanceShaders.framework MobileCoreServices.framework ModelIO.framework MultipeerConnectivity.framework NetworkExtension.framework NewsstandKit.framework NotificationCenter.framework OpenAL.framework OpenGLES.framework PassKit.framework Photos.framework PhotosUI.framework PushKit.framework QuartzCore.framework QuickLook.framework ReplayKit.framework SafariServices.framework SceneKit.framework Security.framework Social.framework Speech.framework SpriteKit.framework StoreKit.framework System.framework SystemConfiguration.framework Twitter.framework UIKit.framework UserNotifications.framework UserNotificationsUI.framework VideoSubscriberAccount.framework VideoToolbox.framework WatchConnectivity.framework WebKit.framework iAd.framework
  • 16. from objc_util import * UIScreen = ObjCClass('UIScreen') screen = UIScreen.mainScreen() if screen.brightness() < 0.3: screen.setBrightness_(0.6) else: screen.setBrightness_(0.1)
  • 17. from objc_util import * def DemoClass_foo_(_self, _cmd, _s): print('result: %s' % ObjCInstance(_s)) # NSObject DemoClass = create_objc_class( 'DemoClass', ObjCClass('NSObject'), methods=[DemoClass_foo_], protocols=[]) demo_obj = DemoClass.alloc().init() demo_obj.foo_("hello") result: hello
  • 18. def DemoClass_foo_(_self, _cmd, _s): ... def bar_baz_(_self, _cmd, _x1, _x2): ... DemoClass = create_objc_class( ... methods=[DemoClass_foo_, bar_baz_], ... demo_obj = DemoClass.alloc().init() demo_obj.foo_("hello") demo_obj.bar_baz_(2, 3) demo_obj.bar_(2, baz=5) # UIColor.colorWithRed:green:blue:alpha UIColor.colorWithRed(1.0, green=0.0, blue=0.0, alpha=1.0) UIColor.color(red=1.0, green=0.0, blue=0.0, alpha=1.0)
  • 19. from objc_util import ObjCClass def is_word_valid(word): reflib = ObjCClass('UIReferenceLibraryViewController') return reflib.dictionaryHasDefinitionForTerm_(word) test_words = ['foo', 'bar', 'quuz', 'cat', 'dog'] for word in test_words: print('%s: %s' % (word, is_word_valid(word))) foo: False bar: True quuz: False cat: True dog: True https://gist.github.com/omz/599ef8aeae22620261c6
  • 20. from objc_util import * UIApplication = ObjCClass('UIApplication') vc = UIApplication.sharedApplication().keyWindow ().rootViewController() print(vc.childViewControllers()) <b'__NSArrayI': ( "<UINavigationController: 0x1038db200>", "<PA2TabViewController: 0x104003000>", "<PA2AccessoryTabViewController: 0x1038dac00>" )> Pythonista
  • 21.
  • 22.
  • 23. • objc_util • iOS Framework • ObjCClass ObjCInstance Python • • •
  • 24.
  • 25. IoT • cb • BLE • CoreBluetooth • Sony MESH https://youtu.be/uJ6VVklLUQc https://github.com/jbking/pythonista-misc/blob/master/mesh/button_demo.py
  • 27. • • ui, Requests • • appex, webbrowser, (pythonista://ScriptName)
  • 29. • Omz gist • https://gist.github.com/omz/ • Pythonista Tools • https://github.com/Pythonista-Tools/Pythonista- Tools