Python と Docker で mypy Playground を開発した話

Yusuke Miyazaki
Yusuke MiyazakiSite Reliability Engineer at Indeed
Python Docker
mypy Playground
Yusuke Miyazaki @ymyzk
PyCon mini Osaka 2018
2018/5/19 Grand Front Osaka
Development of mypy Playground with Python and Docker
• / @ymyzk
• @ / Indeed
• Python 6 + / PyCon JP / …
• ymyzk.com
• : → (2 ) → ( )
• Python Boot Camp in
• IT CAMPHOR-
( )
Python ? 



Python Docker 

mypy Playground
•
• mypy Playground
• Python + Docker mypy
•
•
mypy Playground
mypy ? 🙋
mypy ? 🙋
mypy
• Python
• PEP 484 / 526
• CLI
def greeting(name: str) -> str:
return f"Hello, {name}!!"
greeting("Taro")
greeting(123) # error: Argument 1 to "greeting" has
# incompatible type "int"; expected "str"
mypy Playground: mypy-play.net
• mypy Web
•
• mypy
•
• Gist
mypy Playground: URL HERE
mypy Playground
• mypy
• /tmp/test1.py
•
• mypy typeshed
:
•
• : The Go Playground / Rust Playground / Scastie (Scala)
•
• : Wandbox
• : ymyzk/awesome-playgrounds
mypy Playground

 



UI





 



UI




Ace Bootstrap Bottle Docker
•
• CPU
•
• …
•
•
• import
•
Python + Docker
mypy
Docker ? "
Docker
•
• : jail / LXC / systemd-nspawn
•
• Linux ( cgroups)
•
Docker
•
•
• Docker Hub
•
• Docker
• Docker
Python Docker
• Docker Engine API HTTP API
• CLI docker API
• Python Docker docker-py
• CLI
• docker-py
Python Docker
$ docker run ubuntu echo Hello Osaka!
import docker
client = docker.from_env()

client.containers.run("ubuntu", "echo Hello Osaka!")
mypy
1. mypy Docker
2. mypy
3.
Docker
# typed-ast manylinux1 

FROM python:3.6
RUN pip install mypy
# root
USER nobody
CMD ["mypy"]
c = client.containers.create(
"ymyzk/mypy-playground:sandbox",
command="mypy main.py",
network_mode="none", #
mem_limit="128m", #
pids_limit=32,
cap_drop="ALL",
security_opt=["no-new-privileges"])
# tar (Docker API )
tarball = create_archive(source)
c.put_archive("/tmp", tarball)#
c.start() # mypy
exit_code = c.wait() #
#
stdout = c.logs(stdout=True, stderr=False).decode("utf-8")
stderr = c.logs(stdout=False, stderr=True).decode("utf-8")
c.remove()
• Docker mypy
•
• ?
• :
Python と Docker で mypy Playground を開発した話
Docker in Docker (dind)
• Docker Docker
• Docker 

Docker Docker


Docker in Docker
• Docker
• Docker
• Docker
Docker in Docker
• vfs 

• 

dind
mypy Playground
• I/O
• mypy
• mypy
• WSGI
•
mypy Playground with asyncio
• Bottle Tornado
• Docker asyncio aiodocker
• aiodocker docker-py
Python と Docker で mypy Playground を開発した話
• mypy Playground
•
• typeshed / PEP 561
• Facebook Pyre
• : / dmypy
• Python + Docker mypy Playground (mypy-play.net)
• Web Python
• Docker
• Twitter: @mypy_playground / GitHub: ymyzk/mypy-playground
• !!
1 of 37

Recommended

OSS AWS 핸즈온 강의 by
OSS AWS 핸즈온 강의OSS AWS 핸즈온 강의
OSS AWS 핸즈온 강의Juhong Jung
1.1K views70 slides
Fabric by
FabricFabric
FabricJS Lee
755 views16 slides
Infra@LINE_Chris by
Infra@LINE_ChrisInfra@LINE_Chris
Infra@LINE_ChrisLINE_Engineer
109 views48 slides
Pimp my dev box (Friday Training at Itnig) by
Pimp my dev box (Friday Training at Itnig)Pimp my dev box (Friday Training at Itnig)
Pimp my dev box (Friday Training at Itnig)itnig
1.1K views31 slides
Going All-In With Go For CLI Apps by
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI AppsTom Elliott
8K views35 slides
How to build and distribute CLI tool in 15 minutes with Golang by
How to build and distribute CLI tool in 15 minutes with GolangHow to build and distribute CLI tool in 15 minutes with Golang
How to build and distribute CLI tool in 15 minutes with GolangKohei Kimura
2.2K views23 slides

More Related Content

What's hot

SwiftyGPIO by
SwiftyGPIOSwiftyGPIO
SwiftyGPIOCocoaHeads France
4.5K views33 slides
2 docker engine_hands_on by
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_onFEG
19 views22 slides
Docker + Arm - Multi-arch builds with Docker `buildx` by
Docker + Arm - Multi-arch builds with Docker `buildx`Docker + Arm - Multi-arch builds with Docker `buildx`
Docker + Arm - Multi-arch builds with Docker `buildx`Elton Stoneman
545 views30 slides
Build Android OS on OSX by
Build Android OS on OSXBuild Android OS on OSX
Build Android OS on OSXPietro Alberto Rossi
466 views10 slides
Why ruby by
Why rubyWhy ruby
Why rubyKenneth Kalmer
399 views32 slides
Linux containers by
Linux containersLinux containers
Linux containersAlex Gonzalez
522 views22 slides

What's hot(20)

2 docker engine_hands_on by FEG
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
FEG19 views
Docker + Arm - Multi-arch builds with Docker `buildx` by Elton Stoneman
Docker + Arm - Multi-arch builds with Docker `buildx`Docker + Arm - Multi-arch builds with Docker `buildx`
Docker + Arm - Multi-arch builds with Docker `buildx`
Elton Stoneman545 views
Let's talk about the Ubuntu 18.04 LTS Roadmap! by Dustin Kirkland
Let's talk about the Ubuntu 18.04 LTS Roadmap!Let's talk about the Ubuntu 18.04 LTS Roadmap!
Let's talk about the Ubuntu 18.04 LTS Roadmap!
Dustin Kirkland49.3K views
Full-stack go with GopherJS by Poga Po
Full-stack go with GopherJSFull-stack go with GopherJS
Full-stack go with GopherJS
Poga Po3.7K views
Git 개념 및 사용법 by Lee Yongmin
Git 개념 및 사용법Git 개념 및 사용법
Git 개념 및 사용법
Lee Yongmin221 views
用 Bitbar Tool 寫 Script 自動擷取外幣 by Win Yu
用 Bitbar Tool 寫 Script 自動擷取外幣用 Bitbar Tool 寫 Script 自動擷取外幣
用 Bitbar Tool 寫 Script 自動擷取外幣
Win Yu1.4K views
Ubuntu 17.10 by Maki Turki
Ubuntu 17.10Ubuntu 17.10
Ubuntu 17.10
Maki Turki599 views
PuppetConf 2017: State of Union: Containers at Puppet- Gert Drapers, Puppet by Puppet
PuppetConf 2017: State of Union: Containers at Puppet- Gert Drapers, PuppetPuppetConf 2017: State of Union: Containers at Puppet- Gert Drapers, Puppet
PuppetConf 2017: State of Union: Containers at Puppet- Gert Drapers, Puppet
Puppet180 views
Ansible PyWAW by gnosek
Ansible PyWAWAnsible PyWAW
Ansible PyWAW
gnosek1.3K views
20160929 android taipei Sonatype nexus on amazon ec2 by TSE-JU LIN(Louis)
20160929 android taipei Sonatype nexus on amazon ec2 20160929 android taipei Sonatype nexus on amazon ec2
20160929 android taipei Sonatype nexus on amazon ec2
TSE-JU LIN(Louis)2.2K views
Docker 入門 Introduction to Docker by Genchi Lu
Docker 入門  Introduction to DockerDocker 入門  Introduction to Docker
Docker 入門 Introduction to Docker
Genchi Lu369 views
Collaboration With Git and GitHub by Alec Clews
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHub
Alec Clews1.1K views
Complementing Docker with Puppet by Docker, Inc.
Complementing Docker with PuppetComplementing Docker with Puppet
Complementing Docker with Puppet
Docker, Inc.646 views
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra by Leo Lorieri
Deis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @WayraDeis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
Leo Lorieri1.1K views

Similar to Python と Docker で mypy Playground を開発した話

Getting Started with Go by
Getting Started with GoGetting Started with Go
Getting Started with GoSteven Francia
39.8K views249 slides
リバースプロキシで webサーバを集約 ついでにdocker化しよう by
リバースプロキシでwebサーバを集約ついでにdocker化しようリバースプロキシでwebサーバを集約ついでにdocker化しよう
リバースプロキシで webサーバを集約 ついでにdocker化しようYasunori Kuji
1.9K views16 slides
Giving back with GitHub - Putting the Open Source back in iOS by
Giving back with GitHub - Putting the Open Source back in iOSGiving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOSMadhava Jay
350 views31 slides
Learning Python with Minecraft and my Dad - PyOhio 2018 by
Learning Python with Minecraft and my Dad - PyOhio 2018Learning Python with Minecraft and my Dad - PyOhio 2018
Learning Python with Minecraft and my Dad - PyOhio 2018Hank Preston
417 views38 slides
CPAN 模組二三事 by
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事Lin Yo-An
2.8K views79 slides
Hello world by
Hello worldHello world
Hello worldBrad Montgomery
573 views13 slides

Similar to Python と Docker で mypy Playground を開発した話(20)

Getting Started with Go by Steven Francia
Getting Started with GoGetting Started with Go
Getting Started with Go
Steven Francia39.8K views
リバースプロキシで webサーバを集約 ついでにdocker化しよう by Yasunori Kuji
リバースプロキシでwebサーバを集約ついでにdocker化しようリバースプロキシでwebサーバを集約ついでにdocker化しよう
リバースプロキシで webサーバを集約 ついでにdocker化しよう
Yasunori Kuji1.9K views
Giving back with GitHub - Putting the Open Source back in iOS by Madhava Jay
Giving back with GitHub - Putting the Open Source back in iOSGiving back with GitHub - Putting the Open Source back in iOS
Giving back with GitHub - Putting the Open Source back in iOS
Madhava Jay350 views
Learning Python with Minecraft and my Dad - PyOhio 2018 by Hank Preston
Learning Python with Minecraft and my Dad - PyOhio 2018Learning Python with Minecraft and my Dad - PyOhio 2018
Learning Python with Minecraft and my Dad - PyOhio 2018
Hank Preston417 views
CPAN 模組二三事 by Lin Yo-An
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事
Lin Yo-An2.8K views
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ by Erica Windisch
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQDocker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Erica Windisch1.3K views
Codetainer: a Docker-based browser code 'sandbox' by Jen Andre
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
Jen Andre3.8K views
Offensive Python for Pentesting by Mike Felch
Offensive Python for PentestingOffensive Python for Pentesting
Offensive Python for Pentesting
Mike Felch1.1K views
On the Edge Systems Administration with Golang by Chris McEniry
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
Chris McEniry1.4K views
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた by Taro Matsuzawa
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
Taro Matsuzawa1.4K views
Introduction to docker by Wei-Ting Kuo
Introduction to dockerIntroduction to docker
Introduction to docker
Wei-Ting Kuo2.4K views
Dependencies Managers in C/C++. Using stdcpp 2014 by biicode
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode4.4K views
Ci for i-os-codemash-01.2013 by Kevin Munc
Ci for i-os-codemash-01.2013Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013
Kevin Munc1.9K views
もうひとつのコンテナ実行環境 runq のご紹介 by Takehiko Amano
もうひとつのコンテナ実行環境 runq のご紹介もうひとつのコンテナ実行環境 runq のご紹介
もうひとつのコンテナ実行環境 runq のご紹介
Takehiko Amano1.4K views
シェル芸でライフハック(特論) by Yuki Shimazaki
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)
Yuki Shimazaki688 views
Python于Web 2.0网站的应用 - QCon Beijing 2010 by Qiangning Hong
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong22.2K views

More from Yusuke Miyazaki

Dynamic Type Inference for Gradual Hindley–Milner Typing by
Dynamic Type Inference for Gradual Hindley–Milner TypingDynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner TypingYusuke Miyazaki
685 views27 slides
Introducing wsgi_lineprof / PyCon JP 2017 LT by
Introducing wsgi_lineprof / PyCon JP 2017 LTIntroducing wsgi_lineprof / PyCon JP 2017 LT
Introducing wsgi_lineprof / PyCon JP 2017 LTYusuke Miyazaki
1.2K views17 slides
オープンソースソフトウェア入門 by
オープンソースソフトウェア入門オープンソースソフトウェア入門
オープンソースソフトウェア入門Yusuke Miyazaki
624 views67 slides
型ヒントについて考えよう! by
型ヒントについて考えよう!型ヒントについて考えよう!
型ヒントについて考えよう!Yusuke Miyazaki
4K views76 slides
iot.ymyzk.com の紹介 by
iot.ymyzk.com の紹介iot.ymyzk.com の紹介
iot.ymyzk.com の紹介Yusuke Miyazaki
686 views19 slides
Django から各種チャットツールに通知するライブラリを作った話 by
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Yusuke Miyazaki
12.8K views25 slides

More from Yusuke Miyazaki(12)

Dynamic Type Inference for Gradual Hindley–Milner Typing by Yusuke Miyazaki
Dynamic Type Inference for Gradual Hindley–Milner TypingDynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner Typing
Yusuke Miyazaki685 views
Introducing wsgi_lineprof / PyCon JP 2017 LT by Yusuke Miyazaki
Introducing wsgi_lineprof / PyCon JP 2017 LTIntroducing wsgi_lineprof / PyCon JP 2017 LT
Introducing wsgi_lineprof / PyCon JP 2017 LT
Yusuke Miyazaki1.2K views
オープンソースソフトウェア入門 by Yusuke Miyazaki
オープンソースソフトウェア入門オープンソースソフトウェア入門
オープンソースソフトウェア入門
Yusuke Miyazaki624 views
型ヒントについて考えよう! by Yusuke Miyazaki
型ヒントについて考えよう!型ヒントについて考えよう!
型ヒントについて考えよう!
Yusuke Miyazaki4K views
Django から各種チャットツールに通知するライブラリを作った話 by Yusuke Miyazaki
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話
Yusuke Miyazaki12.8K views
iOS 開発のいま (ADF2015 LT会) by Yusuke Miyazaki
iOS 開発のいま (ADF2015 LT会)iOS 開発のいま (ADF2015 LT会)
iOS 開発のいま (ADF2015 LT会)
Yusuke Miyazaki562 views
iOS 開発のいま (CAMPHOR- x KMC 合同LT会) by Yusuke Miyazaki
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
Yusuke Miyazaki518 views
最新の iOS に対応したアプリの開発 by Yusuke Miyazaki
最新の iOS に対応したアプリの開発最新の iOS に対応したアプリの開発
最新の iOS に対応したアプリの開発
Yusuke Miyazaki481 views
コンピューターネットワーク入門 by Yusuke Miyazaki
コンピューターネットワーク入門コンピューターネットワーク入門
コンピューターネットワーク入門
Yusuke Miyazaki1.4K views

Recently uploaded

Advanced API Mocking Techniques Using Wiremock by
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using WiremockDimpy Adhikary
5 views11 slides
.NET Deserialization Attacks by
.NET Deserialization Attacks.NET Deserialization Attacks
.NET Deserialization AttacksDharmalingam Ganesan
7 views50 slides
Playwright Retries by
Playwright RetriesPlaywright Retries
Playwright Retriesartembondar5
7 views1 slide
Techstack Ltd at Slush 2023, Ukrainian delegation by
Techstack Ltd at Slush 2023, Ukrainian delegationTechstack Ltd at Slush 2023, Ukrainian delegation
Techstack Ltd at Slush 2023, Ukrainian delegationViktoriiaOpanasenko
8 views4 slides
Ports-and-Adapters Architecture for Embedded HMI by
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
37 views19 slides
Streamlining Your Business Operations with Enterprise Application Integration... by
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...Flexsin
5 views12 slides

Recently uploaded(20)

Advanced API Mocking Techniques Using Wiremock by Dimpy Adhikary
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using Wiremock
Dimpy Adhikary5 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert37 views
Streamlining Your Business Operations with Enterprise Application Integration... by Flexsin
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...
Flexsin 5 views
predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app10 views
Understanding HTML terminology by artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar59 views
How to build dyanmic dashboards and ensure they always work by Wiiisdom
How to build dyanmic dashboards and ensure they always workHow to build dyanmic dashboards and ensure they always work
How to build dyanmic dashboards and ensure they always work
Wiiisdom18 views
Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS13 views
Google Solutions Challenge 2024 Talk pdf by MohdAbdulAleem4
Google Solutions Challenge 2024 Talk pdfGoogle Solutions Challenge 2024 Talk pdf
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem447 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1225 views
Supercharging your Python Development Environment with VS Code and Dev Contai... by Dawn Wages
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages9 views
University of Borås-full talk-2023-12-09.pptx by Mahdi_Fahmideh
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptx
Mahdi_Fahmideh13 views

Python と Docker で mypy Playground を開発した話