이콜레모 개발자 위키

Page history of 파이썬 패키지 관리



Title: Setuptools | edited by Youngrok Pak at 10 years, 6 months ago.

<h2>easy_install과 pip</h2>
<p>pip는 easy_install을 대체하기 위해 나왔으며, <a href="http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install">몇 가지 장점</a>이 있다고 주장하고 있으나 실제로 쓸 때 와닿는 장점은 uninstall이 가능하다는 것. 심지어 easy_install로 설치한 것도 uninstall할 수 있다.</p>
<p>자신만의 패키지 관리를 한다면 몇 가지 더 신경써야 할 점이 있다. 둘다 site-packages에 패키지를 설치하지만, easy_install은 <code>패키지명-버전-파이썬버전.egg</code> 디렉토리를 만들고 그 안에 패키지를 집어넣은 후, easy-install.pth 파일에 해당 .egg 경로를 추가한다. 그러면 파이썬 import는 .pth 파일을 해석해서 .egg 아래의 패키지를 찾을 수 있다. 반면 pip는 site-packages 디렉토리에 직접 파이썬 패키지를 설치한다. 그래서 pth 조작 없이 바로 import가 가능하다.</p>
<p>또 easy_install은 바이너리 패키지를 설치할 수 있지만 pip는 못한다. 그래서 pip로 설치하게 하고 싶으면 패키지를 sdist로 upload해야 한다.</p>
<h2>setuptools와 distribute</h2>
<p>setuptools의 예전 버전이 구렸는지 distribute라는 게 나와서 대체하기 시작했는데, 처음에는 setuptools와 같이 설치되서 alias로 덮어서 쓰는 형태였는데, 지금은 distribute가 다시 setuptools에 통합되어 들어가서 그냥 setuptools만 생각하면 된다. <a href="https://devcenter.heroku.com/articles/getting-started-with-django#start-a-django-app-inside-a-virtualenv">virtualenv 가이드에서 간혹 --distribute 같은 옵션을 쓰라고 하는</a>데, 쓸데 없는 짓이다.</p>
<h2>PyPI에 내 패키지 올리기</h2>
<p><a href="http://pythonhosted.org/an_example_pypi_project/setuptools.html">http://pythonhosted.org/an_example_pypi_project/setuptools.html </a>setuptools를 이용해서 <a href="https://pypi.python.org/">PyPI</a>에 패키지를 올리는 법을 찬찬히 읽어보면 나도 파이썬 오픈소스 개발자가 될 수 있다.</p>
<h2>Namespace package</h2>
<p>&nbsp;</p>
Wiki at WikiNamu