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

パッケージ管理ツール Ryeへの旅路

パッケージ管理ツール Ryeへの旅路

# pycon apac 2023で話をしてきました

glassmonenkey

October 27, 2023
Tweet

More Decks by glassmonenkey

Other Decks in Technology

Transcript

  1. © 2012-2023 BASE, Inc. 1
    PyCon APAC 2023
    BASE株式会社 永野 峻輔 ( @glassmonekey )
    パッケージ管理ツール
    Ryeへの旅路

    View full-size slide

  2. © 2012-2023 BASE, Inc. 2
    Introduce to Rye

    View full-size slide

  3. © 2012-2023 BASE, Inc. 3
    自己紹介
    所属
    BASE 株式会社 BASE BANKチーム Engineering Program Manager
    資金調達プロダクト「YELL BANK」の開発責任者やってます。
    Go, PHP, Pythonを書きつつ時々データエンジニアも。
    趣味
    個人開発
    最近は日帰り温泉とかも 
    SNS
    X(Twitter): @glassmonekey 
    Github: https://github.com/glassmonkey
    永野 峻輔 (ながの しゅんすけ)
    PHPでWasm触ったりしてます

    View full-size slide

  4. © 2012-2023 BASE, Inc. 4
    Our Product
    https://yellbank-lp.thebase.com/

    View full-size slide

  5. © 2012-2023 BASE, Inc. 5
    What is Rye?

    View full-size slide

  6. © 2012-2023 BASE, Inc. 6
    Rye
    https://github.com/mitsuhiko/rye
    An Experimental
    Package Management Solution for
    Python

    View full-size slide

  7. © 2012-2023 BASE, Inc. 7
    1
    2
    3
    Built in Rust (not depend on python)
    Management pyproject.toml
    Management virtualenvs
    behind the scenes
    Key Point

    View full-size slide

  8. © 2012-2023 BASE, Inc. 8
    Built in Rust

    View full-size slide

  9. © 2012-2023 BASE, Inc. 9
    Q: Why is it beneficial that
    Package Manager is built in Rust?

    View full-size slide

  10. © 2012-2023 BASE, Inc. 10
    A: Simplifies the setup process.

    View full-size slide

  11. © 2012-2023 BASE, Inc. 11
    The comparison of
    package manager setups

    View full-size slide

  12. © 2012-2023 BASE, Inc. 12
    pip + venv
    c
    Determine the Python version
    To fix version, using pyenv?

    View full-size slide

  13. © 2012-2023 BASE, Inc. 13
    pip + venv
    Activate venv every time
    we want to use it.
    c

    View full-size slide

  14. © 2012-2023 BASE, Inc. 14
    pip + venv
    dump dependencies, it’s not lock.
    so makes it difficult for us to reproduce
    the same.

    View full-size slide

  15. © 2012-2023 BASE, Inc. 15
    Poetry
    Determine the Python version
    To fix version, using pyenv?

    View full-size slide

  16. © 2012-2023 BASE, Inc. 16
    Poetry
    In Poetry, a lock file(poetry.lock) is generated
    automatically with add.

    View full-size slide

  17. © 2012-2023 BASE, Inc. 17
    Rye
    Setting up Rye does not
    require the installation of Python.

    View full-size slide

  18. © 2012-2023 BASE, Inc. 18
    Rye
    Dependencies are added to the 'project' in
    the pyproject.toml file.

    View full-size slide

  19. © 2012-2023 BASE, Inc. 19
    Rye
    Install and create two "lockfiles" .
    ● requirements.lock and
    ● requirements-dev.lock

    View full-size slide

  20. © 2012-2023 BASE, Inc. 20
    Simple Set up 🥰
    Simple setup reduces the potential for troubles arising
    from differences in CPU architecture(e.g. arm64 vs x86)

    View full-size slide

  21. © 2012-2023 BASE, Inc. 21
    Management pyproject.toml

    View full-size slide

  22. © 2012-2023 BASE, Inc. 22
    pyproject.toml
    File contains build system requirements and information
    - PEP 517: A build-system independent format for source trees
    - PEP 518: Specifying Minimum Build System Requirements for Python Projects
    - PEP 621: Storing project metadata in pyproject.toml
    - PEP 660: Editable installs for pyproject.toml based builds (wheel based)

    View full-size slide

  23. © 2012-2023 BASE, Inc. 23
    e.g. pyproject.toml for Rye
    Rye is based config (PEP 621)

    View full-size slide

  24. © 2012-2023 BASE, Inc. 24
    e.g. pyproject.toml for Poetry
    Poetry is based config (PEP 517 and extension for poetry)

    View full-size slide

  25. © 2012-2023 BASE, Inc. 25
    Files of Poetry and Rye
    are not compatible
    Poetry Rye

    View full-size slide

  26. © 2012-2023 BASE, Inc. 26
    How to migrate from
    Poetry to Rye? 🤔

    View full-size slide

  27. © 2012-2023 BASE, Inc. 27
    Idea, Using a requirements.txt
    1. dump requirements.txt
    2. init project

    View full-size slide

  28. © 2012-2023 BASE, Inc. 28
    Share operational insights,
    including Dependabot
    integration, at a later date 🙏

    View full-size slide

  29. © 2012-2023 BASE, Inc. 29
    Conclusion

    View full-size slide

  30. © 2012-2023 BASE, Inc. 30
    1
    2
    3
    Simply setup
    Based simply config on pyproject.toml
    Transparent virtual environments
    Rye features

    View full-size slide

  31. © 2012-2023 BASE, Inc. 31
    If we feel something is missing,
    chance to contribute! 💪💪

    View full-size slide

  32. © 2012-2023 BASE, Inc. 32
    PR

    View full-size slide

  33. © 2012-2023 BASE, Inc. 33
    フルサイクル開発やってます!!
    Go, Pythonも書いてます!!
    DM待ってます!!
    We are hiring !!

    View full-size slide