Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Python Docker
mypy Playground
Yusuke Miyazaki @ymyzk
PyCon mini Osaka 2018
2018/5/19 Grand Front Osaka
Development of mypy...
• / @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(12...
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.con...
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="1...
# tar (Docker API )
tarball = create_archive(source)
c.put_archive("/tmp", tarball)#
c.start() # mypy
exit_code = c.wait()...
• Docker mypy
•
• ?
• :
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
• mypy Playground
•
• typeshed / PEP 561
• Facebook Pyre
• : / dmypy
• Python + Docker mypy Playground (mypy-play.net)
• Web Python
• Docker
• Twitter: @mypy_playground / GitHub: ymyzk/mypy-p...
Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話
Upcoming SlideShare
Loading in …5
×

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

1,469 views

Published on

PyCon mini Osaka 2018 https://osaka.pycon.jp

Published in: Software
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

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

  1. 1. 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
  2. 2. • / @ymyzk • @ / Indeed • Python 6 + / PyCon JP / … • ymyzk.com
  3. 3. • : → (2 ) → ( ) • Python Boot Camp in • IT CAMPHOR- ( )
  4. 4. Python ? 
 
 Python Docker 
 mypy Playground
  5. 5. • • mypy Playground • Python + Docker mypy • •
  6. 6. mypy Playground
  7. 7. mypy ? 🙋
  8. 8. mypy ? 🙋
  9. 9. 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"
  10. 10. mypy Playground: mypy-play.net • mypy Web • • mypy • • Gist
  11. 11. mypy Playground: URL HERE
  12. 12. mypy Playground • mypy • /tmp/test1.py • • mypy typeshed
  13. 13. : • • : The Go Playground / Rust Playground / Scastie (Scala) • • : Wandbox • : ymyzk/awesome-playgrounds
  14. 14. mypy Playground 
 
 
 UI 
 

  15. 15. 
 
 
 UI 
 
 Ace Bootstrap Bottle Docker
  16. 16. • • CPU
  17. 17. • • … • • • import •
  18. 18. Python + Docker mypy
  19. 19. Docker ? "
  20. 20. Docker • • : jail / LXC / systemd-nspawn • • Linux ( cgroups) •
  21. 21. Docker • • • Docker Hub • • Docker • Docker
  22. 22. Python Docker • Docker Engine API HTTP API • CLI docker API • Python Docker docker-py
  23. 23. • CLI • docker-py Python Docker $ docker run ubuntu echo Hello Osaka! import docker client = docker.from_env()
 client.containers.run("ubuntu", "echo Hello Osaka!")
  24. 24. mypy 1. mypy Docker 2. mypy 3.
  25. 25. Docker # typed-ast manylinux1 
 FROM python:3.6 RUN pip install mypy # root USER nobody CMD ["mypy"]
  26. 26. 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"])
  27. 27. # 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()
  28. 28. • Docker mypy • • ? • :
  29. 29. Docker in Docker (dind) • Docker Docker • Docker 
 Docker Docker 

  30. 30. Docker in Docker • Docker • Docker • Docker
  31. 31. Docker in Docker • vfs 
 • 
 dind
  32. 32. mypy Playground • I/O • mypy • mypy • WSGI •
  33. 33. mypy Playground with asyncio • Bottle Tornado • Docker asyncio aiodocker • aiodocker docker-py
  34. 34. • mypy Playground • • typeshed / PEP 561 • Facebook Pyre • : / dmypy
  35. 35. • Python + Docker mypy Playground (mypy-play.net) • Web Python • Docker • Twitter: @mypy_playground / GitHub: ymyzk/mypy-playground • !!

×