Save 37% off PRO during our Black Friday Sale! »

Sphinx/docutilsの光と闇

85401912c23c7d5e656c08e7a751e95c?s=47 cocoatomo
November 28, 2018

 Sphinx/docutilsの光と闇

85401912c23c7d5e656c08e7a751e95c?s=128

cocoatomo

November 28, 2018
Tweet

Transcript

  1. Sphinx/docutils ܕ෇͚ͷޫͱҋ @cocoatomo

  2. ΞδΣϯμ 1. ܕͱ͸ 2. Pythonͷܕώϯτ 3. ޙ෇͚ͷܕ෇͚࡞ۀ 4. ܕ෇͚ͷҋ 5.

    ܕ෇͚ͷޫ 6. ऴΘΓʹ
  3. 1. ܕͱ͸ • ஋ͷछผ෼ྨ • ࣮ߦલʹ൑໌͠ͳ͍ܕʢಈతܕʣ • ॊೈͳϓϩάϥϜ͕ॻ͚Δ • ॊೈա͗ͯͲΜͳ஋͕དྷΔ͔෼͔Βͳ͍

    • ࣮ߦલʹ൑໌͢Δܕʢ੩తܕʣ • ࣮ߦલʹ෦෼తʹόά͕ݕग़Ͱ͖Δ • ܕγεςϜ͕ځ۶ͳ͜ͱ΋ʢ΋͏ੲͷ࿩ʣ
  4. 2. Pythonͷܕώϯτ • ม਺ɺؔ਺ʢύϥϝʔλ&ฦΓ஋ʣʹର͢Δܕࢦఆ • ͋͘·ͰΦϓγϣϯ • ੩తͳܕղੳπʔϧ͕ར༻/࣮ߦ࣌ʹ͸ແࢹ • PEP

    484 -- Type Hints • PEP 561 -- Distributing and Packaging Type Information
  5. 3. ޙ෇͚ͷܕ෇͚࡞ۀ • ม਺΍ؔ਺ͷ࢖ΘΕํ͔ΒܕΛਪଌ • ୅ೖ஋ɺଐੑɺҾ਺ɺฦΓ஋͕୅ೖ͞ΕΔม਺ͳͲ • ෳ਺ͷܕ͕༗ΓಘΔ৔߹͸UnionΛ࢖͏ • Ͳ͏ͯ͠΋ܕ͕෇͚ΒΕͳ͍ͱ͖͸ܕΛແࢹ͢Δ

    • # type: ignoreͱ͍͏ίϝϯτͰແࢹ • ಈతʹੜ͑Δଐੑɺ৯͍ҧ͏ϝιουΦʔόʔϥΠυ
  6. 4. ܕ෇͚ͷҋ • ܕ͕෼͔Βͳ͍ • ಛʹϑϨʔϜϫʔΫͷ൚༻తͳ࣮૷ • ઈରʹטΈ߹Θͳ͍ܕ • docutils.nodes.Elementͷ__add__ͱ__iadd__

    • Mypy͸Ҿ਺ͷܕ͕ಉ͡Ͱ͋Δ͜ͱΛٻΊΔ ͕……
  7. __add__ͱ__iadd__

  8. 5. ܕ෇͚ͷޫ • όά͕ݟ෇͔Δ • quote_plusͷฦΓ஋ʢstrʣͷdecodeϝιουΛ ݺ΅͏ͱ͢Δ͕ʢPy3ʹ͸ʣͦΜͳ΋ͷ͸ແ͍!! • https://github.com/sphinx-doc/sphinx/commit/ 3808405b50503f8902ce6c061272c2e7d1b359

    cc#diff-d0e894e396b3cee20ed52b6be6ad63e6
  9. decodeΛ࡟আ

  10. 6. ऴΘΓʹ • ΈΜͳγϯϓϧͳܕ͕෇͘PythonίʔυΛॻ͜ ͏ͳ!! • ※஫. docutilsʹ΋ޫ͸͋Δ͠ɺSphinxʹ΋ҋ͸͋ Δ