Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

© 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触ったりしてます

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

© 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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

© 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)

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

© 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)

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

© 2012-2023 BASE, Inc. 29 Conclusion

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

© 2012-2023 BASE, Inc. 32 PR

Slide 33

Slide 33 text

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