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를 쓸 때 유의해야할 것이 무엇이 있는지를 다루려고 합니다.

9ac051aa8b199b55b5da8aeb1679d71d?s=128

Hong Minhee

August 30, 2014
Tweet

Transcript

  1. 53.
  2. 86.
  3. 87.
  4. 88.
  5. 99.

    ! 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
  6. 100.

    ! 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
  7. 101.

    ! 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
  8. 102.

    ! 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
  9. 103.

    ! 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. 104.

    ! 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. 105.

    ! 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. 106.

    ! 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
  13. 107.

    ! 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. 117.

    ! 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. 118.

    ! 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
  16. 120.

    ೠߣী $ pip install --user geofront-cli $ geofront-cli authorize server-2

    $ ssh server-2 $ geofront-cli ssh server-2 # shortcut
  17. 125.

    ! 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
  18. 126.

    ! 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
  19. 138.

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


    ୶о݅غݶইޖࢸ੿بೡѱহ਺ ↟ ӝઓ౱ਗੑ੢ীࢲبӥ೸PSHBOJ[BUJPO҅੿ী
 ೧׼नӏ౱ਗ୶о݅ೞݶ׮ܲѤ೧઴೙ਃহ਺
  20. 146.
  21. 153.
  22. 157.

    ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ
  23. 158.

    ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ ↟ s&BSUI3FBEFS زद૑ਗ
  24. 159.

    ੹੸ ↟ sਢ೐ۨ੐ਕ௼ ౵੉ॆ੹ਊ nपಁ ↟ s8BOE ౵੉ॆ੹ਊªزद૑ਗ ↟ sBMFNCJD

    ౵੉ॆ੹ਊªزद૑ਗ ↟ s42-"MDIFNZ*NBHF"UUBDI زद૑ਗ ↟ s&BSUI3FBEFS زद૑ਗ ↟ sMJCTBTTQZUIPO ౵੉ॆ੹ਊªزद૑ਗ
  25. 160.
  26. 168.
  27. 169.
  28. 170.
  29. 179.
  30. 195.
  31. 196.

    ࢤ೙ಿࠗ઒ ↟ OVNQZ TDJQZ ↟ %KBOHP 4PVUI ↟ 8FSL[FVH 'MBTL

    ↟ QZDSZQUP QBSBNJLP ↟ LPNCV DFMFSZ ↟ 1*-
  32. 197.
  33. 221.

    ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ ↟ %KBOHP 4PVUI ↟ 8FSL[FVH

    'MBTL ↟ QZDSZQUP QBSBNJLP ↟ DFMFSZ ↟ 1*-
  34. 222.

    ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 4PVUI

    ↟ 8FSL[FVH 'MBTL ↟ QZDSZQUP  QBSBNJLP ↟ DFMFSZ   ↟ 1*-
  35. 223.

    ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 

    4PVUI   ↟ 8FSL[FVH  'MBTL   ↟ QZDSZQUP  QBSBNJLP ↟ DFMFSZ   ↟ 1JMMPX 
  36. 224.

    ֙੄౵੉ॆ ↟ OVNQZ  TDJQZ   ↟ %KBOHP 

    4PVUI   ↟ 8FSL[FVH  'MBTL   ↟ QZDSZQUP  QBSBNJLP   ↟ DFMFSZ   ↟ 1JMMPX 
  37. 225.
  38. 231.

    ೒ۖಬ  ↟ ઱ਃֿܻझߓನ౸ীࢲݽف౵੉ॆܳಁః૑۽૑ਗ ↟ ઃై ই஖١਷ই৘౵੉ॆоӝࠄ ↟ ই૒ҳӖজূ૓਷౵੉ॆ݅૑ਗೞ૑݅ 


    ೻۽௢ח౵੉ॆܳ૑ਗೣ ↟ ইऔ૑݅ݓীࢲחৈ੹൤౵੉ॆ  ݅ߣٜ ↟ QZFOW١ਵ۽ࢸ஖ೞݶޙઁũũ
  39. 232.

    ೒ۖಬ  ↟ ઱ਃֿܻझߓನ౸ীࢲݽف౵੉ॆܳಁః૑۽૑ਗ ↟ ઃై ই஖١਷ই৘౵੉ॆоӝࠄ ↟ ই૒ҳӖজূ૓਷౵੉ॆ݅૑ਗೞ૑݅ 


    ೻۽௢ח౵੉ॆܳ૑ਗೣ ↟ ইऔ૑݅ݓীࢲחৈ੹൤౵੉ॆ  ݅ߣٜ ↟ QZFOW١ਵ۽ࢸ஖ೞݶޙઁũũ ↟ 1Z1Zب੉ઁ౵੉ॆҳഅ೮਺
  40. 262.
  41. 263.

    1&1n࠽౟ੋо࢚ജ҃ ↟ ౵੉ॆ୊਺ࣁ౴ೡٸݔզೞ؍૙ • easy_install pip • pip install virtualenv

    • virtualenv project-name-env ↟ ੉ઁӒրղ੢ػpyvenvݺ۸যॳݶؽ • pyvenv project-name-env
  42. 268.

    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, ..."""
  43. 274.

    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']
  44. 296.
  45. 302.

    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
  46. 303.

    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'