Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Geofront 개발 후기: Python 2와 작별하고 Python 3로 개발하기

Geofront 개발 후기: Python 2와 작별하고 Python 3로 개발하기

Geofront는 소규모 팀에서 운영하는 서버에 인증하는 SSH 키를 관리하기 위한 오픈 소스 소프트웨어입니다. (Geofront 자체에 대한 설명은 스포카 개발팀 블로그에 올라온 “Geofront: 소규모 팀을 위한 SSH 키 관리 서비스”를 읽어주세요. http://spoqa.github.io/2014/07/09/geofront.html)

Geofront는 Python 3 전용으로 작성되었는데, Python 3만 사용하여 개발하며 경험한 바를 공유합니다.

주로 Python 2를 쓸 때에 비교해서 Python 3를 쓰면 어떤 점이 좋은지, 과연 이제 정말 Python 3를 써도 괜찮은 것인지, Python 3를 쓸 때 유의해야할 것이 무엇이 있는지를 다루려고 합니다.

Hong Minhee (洪 民憙)

August 30, 2014
Tweet

More Decks by Hong Minhee (洪 民憙)

Other Decks in Programming

Transcript

  1. ! Geofront .pub ݃झఠః authoriz ed_keys authoriz ed_keys authoriz ed_keys

    authoriz ed_keys A B C D id_rsa id_rsa id_rsa id_rsa
  2. ! Geofront .pub ݃झఠః authoriz ed_keys authoriz ed_keys authoriz ed_keys

    authoriz ed_keys A B C D id_rsa id_rsa id_rsa .pub id_rsa
  3. ! Geofront .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys authoriz

    ed_keys authoriz ed_keys A B C D id_rsa id_rsa id_rsa .pub id_rsa
  4. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys A B C D id_rsa id_rsa id_rsa .pub id_rsa
  5. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  6. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  7. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  8. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  9. ! Geofront .pub .pub .pub ݃झఠః authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  10. ! Geofront .pub .pub .pub ೠद੸ೲਊ authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  11. ! Geofront .pub .pub .pub ೠद੸ೲਊ authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  12. ೠߣী $ pip install --user geofront-cli $ geofront-cli authorize server-2

    $ ssh server-2 $ geofront-cli ssh server-2 # shortcut
  13. ! Geofront .pub .pub .pub ೠद੸ೲਊ authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  14. ! Geofront .pub .pub .pub ೠद੸ೲਊ authoriz ed_keys authoriz ed_keys

    authoriz ed_keys authoriz ed_keys id_rsa A B C D id_rsa id_rsa id_rsa .pub id_rsa
  15. ҕѐః١۾ ↟ п੗ҕѐఃܳ૑য়೐ۿ౟ী૒੽ৢܻա ↟ Ӓۡࣻب੓਺ ↟ ೞ૑݅ӥ೸োزਸࢸ੿ೞݶ੉޷ӥ೸҅੿ী
 ١۾ೠҕѐఃبࢎਊೡࣻ੓਺ ↟ नӏ౱ਗੑ੢ীࢲחӥ೸PSHBOJ[BUJPO҅੿ী


    ୶о݅غݶইޖࢸ੿بೡѱহ਺ ↟ ӝઓ౱ਗੑ੢ীࢲبӥ೸PSHBOJ[BUJPO҅੿ী
 ೧׼नӏ౱ਗ୶о݅ೞݶ׮ܲѤ೧઴೙ਃহ਺
  16. ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ
  17. ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ ↟ s&BSUI3FBEFS زद૑ਗ
  18. ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ ↟ s&BSUI3FBEFS زद૑ਗ ↟ sMJCTBTTQZUIPO ౵੉ॆ੹ਊªزद૑ਗ
  19. ࢤ೙ಿࠗ઒ ↟ OVNQZ TDJQZ ↟ %KBOHP 4PVUI ↟ 8FSL[FVH 'MBTL

    ↟ QZDSZQUP QBSBNJLP ↟ LPNCV DFMFSZ ↟ 1*-
  20. ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ ↟ %KBOHP 4PVUI ↟ 8FSL[FVH

    'MBTL ↟ QZDSZQUP QBSBNJLP ↟ DFMFSZ ↟ 1*-
  21. ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 4PVUI

    ↟ 8FSL[FVH 'MBTL ↟ QZDSZQUP  QBSBNJLP ↟ DFMFSZ   ↟ 1*-
  22. ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 

    4PVUI   ↟ 8FSL[FVH  'MBTL   ↟ QZDSZQUP  QBSBNJLP ↟ DFMFSZ   ↟ 1JMMPX 
  23. ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 

    4PVUI   ↟ 8FSL[FVH  'MBTL   ↟ QZDSZQUP  QBSBNJLP   ↟ DFMFSZ   ↟ 1JMMPX 
  24. ೒ۖಬ  ↟ ઱ਃֿܻझߓನ౸ীࢲݽف౵੉ॆܳಁః૑۽૑ਗ ↟ ઃై ই஖١਷ই৘౵੉ॆоӝࠄ ↟ ই૒ҳӖজূ૓਷౵੉ॆ݅૑ਗೞ૑݅ 


    ೻۽௢ח౵੉ॆܳ૑ਗೣ ↟ ইऔ૑݅ݓীࢲחৈ੹൤౵੉ॆ  ݅ߣٜ ↟ QZFOW١ਵ۽ࢸ஖ೞݶޙઁũũ
  25. ೒ۖಬ  ↟ ઱ਃֿܻझߓನ౸ীࢲݽف౵੉ॆܳಁః૑۽૑ਗ ↟ ઃై ই஖١਷ই৘౵੉ॆоӝࠄ ↟ ই૒ҳӖজূ૓਷౵੉ॆ݅૑ਗೞ૑݅ 


    ೻۽௢ח౵੉ॆܳ૑ਗೣ ↟ ইऔ૑݅ݓীࢲחৈ੹൤౵੉ॆ  ݅ߣٜ ↟ QZFOW١ਵ۽ࢸ஖ೞݶޙઁũũ ↟ 1Z1Zب੉ઁ౵੉ॆҳഅ೮਺
  26. 1&1n࠽౟ੋо࢚ജ҃ ↟ ౵੉ॆ୊਺ࣁ౴ೡٸݔզೞ؍૙ • easy_install pip • pip install virtualenv

    • virtualenv project-name-env ↟ ੉ઁӒրղ੢ػpyvenvݺ۸যॳݶؽ • pyvenv project-name-env
  27. 1&1nೣࣻয֢ప੉࣌ class Team: """Backend interface for team membership auth...""" @typed

    def authenticate(self, auth_nonce: str, requested_redirect_url: str, wsgi_environ: collections.abc.Mapping ) -> Identity: """Second step of authentication process, ..."""
  28. 1&1singledispatch @singledispatch def get_metadata(driver: NodeDriver, node: Node) -> collections.abc.Mapping: return

    driver.ex_get_metadata(node) ! @get_metadata.register(GCENodeDriver) def gce_get_metadata(driver: GCENodeDriver, node: Node ) -> collections.abc.Mapping: return node.extra['metadata']
  29. 1&1nউଃ৘৻಴द Traceback (most recent call last): File "t.py", line 6,

    in b a() File "t.py", line 2, in a raise ValueError('something went wrong') ValueError: something went wrong During handling of the above exception, another exception occurred: Traceback (most recent call last): File "t.py", line 10, in <module> b() File "t.py", line 8, in b raise RuntimeError('crashed') RuntimeError: crashed
  30. 1&1nৌѢഋ class KeyType(enum.Enum): """SSH key types.""" ecdsa_ssh2_nistp256 = 'ecdsa-sha2-nistp256' ecdsa_ssh2_nistp384

    = 'ecdsa-sha2-nistp384' ecdsa_ssh2_nistp521 = 'ecdsa-sha2-nistp521' ssh_dss = 'ssh-dss' ssh_rsa = 'ssh-rsa'