Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Autodoc
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
heavenshell
March 13, 2014
Programming
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Autodoc
Py-Autodoc
heavenshell
March 13, 2014
More Decks by heavenshell
See All by heavenshell
2014-10-21-osakapy
heavenshell
0
360
Other Decks in Programming
See All in Programming
New "Type" system on PicoRuby
pocke
1
710
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.3k
Modding RubyKaigi for Myself
yui_knk
0
900
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
6.2k
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
110
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
120
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.3k
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
1.8k
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.9k
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
470
AIエージェントの隔離技術の徹底比較
kawayu
0
470
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
370
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
15k
The SEO Collaboration Effect
kristinabergwall1
1
480
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
30 Presentation Tips
portentint
PRO
1
320
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
How STYLIGHT went responsive
nonsquared
100
6.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Google's AI Overviews - The New Search
badams
0
1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
GitHub's CSS Performance
jonrohan
1033
470k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
940
Transcript
Autodoc ʹ͍ͭͯ େࡕ Python Ϣʔβͷू·Γ 2014/03 2014.03.13 @heavenshell 143݄14༵ۚ
͓·͑ɺ୭Α Software engineer, Programmer py-qiita, py-jokk, vim-pydocstring, vim-jsdoc, vim- connpass,
etc — Python, Vim, Vimperator PHP, Perl, Java, JavaScript ͖ͳ Python ͷඪ४ؔ print() ͱ dir() 143݄14༵ۚ
My contribution 143݄14༵ۚ
My contribution 143݄14༵ۚ
My contribution 143݄14༵ۚ
My contribution 143݄14༵ۚ
My best pull request @2013 143݄14༵ۚ
143݄14༵ۚ
143݄14༵ۚ
143݄14༵ۚ
orz 143݄14༵ۚ
Autodoc 143݄14༵ۚ
143݄14༵ۚ
ࠓճ Sphinx ͷAutodoc ͞Μ Ͱͳ͘ผͷ Autodoc ͞Μ 143݄14༵ۚ
143݄14༵ۚ
143݄14༵ۚ
3BDLBQQMJDBUJPOͰ࣮͞Εͨ"1*ʹରͯ͠ɺ 34QFDͰॻ͔ΕͨςετΛݩʹ"1*υΩϡϝϯτΛੜ ͢ΔͷɻςετΛ࣮ߦ͢Δͱɺςετதʹൃߦ ͨ͠ϦΫΤετϨεϙϯεɺͦͷςετʹ͚ΒΕ ͨϝοηʔδΛݩʹɺྑ͍ײ͡ʹใΛ·ͱΊɺ .BSLEPXOܗࣜͰ"1*υΩϡϝϯτΛهͨ͠ϑΝΠϧ Λੜͯ͘͠ΕΔɻྫ͑(JU)VCͰ.BSLEPXOϑ ΝΠϧΛదʹඳըͯ͘͠ΕΔͷͰɺԼਤͷΑ͏ʹ (JU)VC্Ͱ؆୯ʹυΩϡϝϯτΛӾཡग़དྷΔΑ͏ʹ ͳΔɻ
http://r7kamura.github.io/2013/12/01/autodoc.html 143݄14༵ۚ
ࠓ࢈ۀ RSpec Ͱ API αʔόʹରͯ͠ςετΛॻ͘ ϦΫΤετͱϨεϙϯεͷ༰Λ Markdown Ͱग़ྗ ςετ͔ΒυΩϡϝϯτੜͯ͘͠Εͯศར 143݄14༵ۚ
ࣗಈతʹυΩϡϝϯτΛੜͰ͖ΔͷૉΒ͍͠ ςετΛ࣮ߦ͢ΔͱυΩϡϝϯτ͕ੜ͞ΕΔͷϝϯ ςφϯείετ͕͍ ࣮ࡏ͢Δ API ʹର࣮ͯ͠ߦ͢ΔͷͰɺੜ͖ͨυΩϡϝ ϯτ υΩϡϝϯτΛࣗಈੜ͞ΕΔϝϦοτ Python Ϣʔβ
ʔྑͬͯ͘Δ 143݄14༵ۚ
ଞݴޠʹΑΔ࣮ 143݄14༵ۚ
Test::JsonAPI::Autodoc http://moznion.hatenadiary.com/entry/ 2013/11/02/232144 143݄14༵ۚ
ॻ͖ํͪΐͬͱҟͳΔ͚ Ͳςετ͔ΒυΩϡϝϯτ Λग़ྗ͢Δͷಉ͡ 143݄14༵ۚ
Py-Autodoc http://github.com/heavenshell/py-autodoc 143݄14༵ۚ
ରԠͯ͠ΔςετFW Unittest py.test nose ֬ೝͯ͠ͳ͍͚Ͳଟಈ͘ 143݄14༵ۚ
from unittest import TestCase from webtest import TestApp from autodoc
import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 143݄14༵ۚ
from unittest import TestCase from webtest import TestApp from autodoc
import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 143݄14༵ۚ
from unittest import TestCase from webtest import TestApp from autodoc
import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 143݄14༵ۚ
from unittest import TestCase from webtest import TestApp from autodoc
import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 143݄14༵ۚ
143݄14༵ۚ
import sys import pytest from webtest import TestApp from autodoc
import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 143݄14༵ۚ
import sys import pytest from webtest import TestApp from autodoc
import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 143݄14༵ۚ
import sys import pytest from webtest import TestApp from autodoc
import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 143݄14༵ۚ
import sys import pytest from webtest import TestApp from autodoc
import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 143݄14༵ۚ
143݄14༵ۚ
ςετΫϥΠΞϯτʹ WebTest Λ༻ͯ͠Δ @autodoc.describe ͰυΩϡϝϯτΛग़ྗ͢Δϝιο υ/ؔΛఆٛ͢Δ @autodoc.generete ͰσίϨʔτͨ͠ϝιου/ؔ ͕࣮ߦ͞ΕͨλΠϛϯάͰυΩϡϝϯτΛग़ྗ 143݄14༵ۚ
υΩϡϝϯτΛੜ͢ΔλΠϛϯάςετϝιο υ/ؔ͝ͱʹ͢Εɺϝιου/ؔ୯ҐͰυΩϡϝ ϯτΛग़ྗͰ͖Δ tearDownClass Έ͍ͨͷ߹ɺ࣮ߦͨ͠શͯͷϝιο υΛ 1 ϑΝΠϧʹग़ྗ͢Δ reStracturedText
ʹରԠ͍ͯ͠Δ 143݄14༵ۚ
ςϯϓϨʔτࣗͰ࡞Մೳ ͨͩ͠String.template ΛͬͯΔͨΊࣗ༝͕͍ Ruby ඪ४Ͱ ERB Λ࣋ͬͯΔͷ͕ત·͍͠ Python ϏϧτΠϯͰ͏গ͠ߴػೳͳςϯϓϨ ʔτΤϯδϯཉ͍͠
143݄14༵ۚ
࣮γϯϓϧ(ʹͨͭ͠Γ) @autodoc.describe Ͱ return ͨ͠ response ΦϒδΣ ΫτΛύʔεͯ͠Ϧετʹ֨ೲ @autodoc.generate ͕࣮ߦͨ͠ΒϦετͷதΛϑΝΠ
ϧʹग़ྗ 143݄14༵ۚ
੍ ඞͣςετϝιου/ؔͰ WebTest ͷϨεϙϯεΛ Ԡ͢Δඞཁ͋Γ Ruby ͷ autodoc Rack-Test
Λ͏ͱ last_response ͔ΒϨεϙϯεΛऔಘͯ͠Δ͚ͲɺWebTest ʹͦΜͳ ͷແ͍ͷͰ return ͯ͠ड͚औΔ༷ Flask(ͱ͍͏͔Werkzueg)ͷςετΫϥΠΞϯτର Ԡ͠Α͏͔ͱࢥ͚ͬͨͲɺResponse ʹ Request Φϒ δΣΫτ͕֨ೲ͞Εͯͳ͍ͷͰμϝͩͬͨ 143݄14༵ۚ
·ͱΊ Autodoc ࡞ͬͨ ςετΛ࣮ߦ͢ΔͱυΩϡϝϯτΛੜͯ͘͠ΕΔͷ ศར σίϨʔλͬͯศར Web API ΛԠ͢ΔϞοΫαʔόͱΈ߹ΘͤΕ υΩϡϝϯτΛઌʹ࡞ΔࣄՄೳ
͜Ε͍͔ͭ·͍ͨͨ͠ 143݄14༵ۚ
Thank you! Any Questions? 143݄14༵ۚ