๐ป Dev
โ๏ธ jupyter notebook autoreloadํ๊ธฐ
์ด์ YIYU
2024. 4. 8. 09:29
ํ์ด์ฌ์ ์ฌ์ฉํ๋ค๋ณด๋ฉด ๋ถํธํด์ง๋๊ฐ ์๋ค. ์คํฌ๋ฆฝํธ ์ฝ๋๋ฅผ ๋ฐ๊พธ๊ณ ์ฃผํผํฐ ๋ ธํธ๋ถ์์ ๋ฐ์๋ ์ฝ๋๋ฅผ ๋ถ๋ฌ์ค๊ธฐ ์ํด์ restart ๋ฒํผ์ ๋๋ฌ์ผํ๊ณ ๊ธฐ์กด์ ํ ๋น๋ ๋ณ์๋ค์ด ๋ค ์ฌ๋ผ์ง๋ ๊ฒฝํ..
์ด๋ด ๋ autoreload ์ค์ ์ ํด์ฃผ๋ฉด restart๋ฅผ ํด์ฃผ์ง ์์๋ ์ฃผํผํฐ ๋ ธํธ๋ถ์์ ๋ฐ์๋ ์ฝ๋๋ฅผ ๋ฐ๋ก ์ฌ์ฉํ ์ ์๋ค. ๋จผ์ profile์ ์์ฑํ๋ค. ์์ฑํด์ค๊ณผ ๋์์ ํ์ผ ์์น๋ ์๋ ค์ค๋ค.
ipython profile create
# ๊ฒฐ๊ณผ
[ProfileCreate] Generating default config file: PosixPath('/Users/username/.ipython/profile_default/ipython_config.py')
[ProfileCreate] Generating default config file: PosixPath('/Users/username/.ipython/profile_default/ipython_kernel_config.py')
ํ์ผ ์์น ๋๋ ํ ๋ฆฌ๋ก ์ฎ๊ธด ํ ipython_config.py๋ฅผ vi๋ก ์ด๊ณ ๋งจ ๋ง์ง๋ง์ ์๋์ ๊ฐ์ด ์ถ๊ฐํด์ฃผ๋ฉด ๋๋ค. ์ด์ jupyter๋ฅผ ์ฌ์คํํด์ ํ์ธํด๋ณด์!
c.InteractiveShellApp.exec_lines = []
c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
c.InteractiveShellApp.exec_lines.append('%autoreload 2')