Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Autodoc
Search
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
370
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
510
mrbgem 三角測量 開発
ogom
0
220
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
21
21k
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
160
dotNET_vulnclicker_intro.pdf
deka_morita
0
130
R8 の設定見直しでアプリサイズ削減
andpad
0
190
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
570
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
120
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
14
40k
Raft: Consensus for Rubyists
vanstee
142
7.7k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Product Roadmaps are Hard
iamctodd
55
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The browser strikes back
jonoalderson
0
1.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Done Done
chrislema
187
17k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
A Modern Web Designer's Workflow
chriscoyier
699
190k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
470
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༵ۚ