Ruby의 번 들러 / Perl의 상자에 해당하는 Python은 무엇입니까?
나는 virtualenv와 pip에 대해 알고 있습니다. 그러나 이것들은 번 들러 / 카톤과는 약간 다릅니다.
예를 들면 :
- pip는 shebang 또는 activate 스크립트에 대한 절대 경로를 작성합니다.
- pip에는
exec
하위 명령 (bundle exec bar
) 이 없습니다. - virtualenv는 Python 인터프리터를 로컬 디렉토리에 복사합니다.
모든 Python 개발자가 virtualenv / pip를 사용합니까? Python 용 다른 패키지 관리 도구가 있습니까?
번 들러에 대해 읽은 내용에서-virtualenv가없는 pip가 잘 작동합니다. 일반 gem 명령과 번 들러 사이의 것으로 생각할 수 있습니다. pip로 할 수있는 일반적인 작업 :
패키지 설치 (gem 설치)
pip install mypackage
종속성 및 대량 설치 (gemfile)
아마도 가장 쉬운 방법은 pip의 requirements.txt 파일을 사용하는 것입니다. 기본적으로 가능한 버전 제약이있는 필수 패키지의 일반 목록입니다. 다음과 같이 보일 수 있습니다.
nose==1.1.2 django<1.3 PIL
나중에 이러한 종속성을 설치하려면 다음을 수행하십시오.
$ pip install -r requirements.txt
요구 사항 파일 구문에서 현재 패키지를 모두 보는 간단한 방법은 다음과 같습니다.
$ pip freeze
여기에서 자세한 내용을 읽을 수 있습니다 .
실행 (번 들러 exec)
실행 파일과 함께 제공되는 모든 Python 패키지는 일반적으로 설치 후 직접 사용할 수 있습니다 (사용자 지정 설치가 있거나 특수 패키지가 아닌 경우). 예를 들면 :
$ pip install gunicorn $ gunicorn -h
캐시에서 설치할 gem 패키지 (번 들러 패키지)
이
pip bundle
와pip zip/unzip
. 하지만 많은 사람들이 그것을 사용하는지 잘 모르겠습니다.
ps 환경 격리에 관심이 있다면 pip와 함께 virtualenv를 사용할 수도 있습니다 (가까운 친구이며 완벽하게 함께 작동합니다). 기본적으로 pip는 관리자 권한이 필요할 수있는 시스템 전체 패키지를 설치합니다.
bundler와 유사한 인터페이스를 가진 pipenv 를 사용할 수 있습니다 .
$ pip install pipenv
Pipenv는 virtualenv를 자동으로 생성하고 Pipfile
또는 에서 종속성을 설치합니다 Pipfile.lock
.
$ pipenv --three # Create virtualenv with Python3
$ pipenv install # Install dependencies from Pipfile
$ pipenv install requests # Install `requests` and update Pipfile
$ pipenv lock # Generate `Pipfile.lock`
$ pipenv shell # Run shell with virtualenv activated
다음과 같은 virtualenv 범위로 명령을 실행할 수 있습니다 bundle exec
.
$ pipenv run python3 -c "print('hello!')"
클론 pbundler가 있습니다.
현재 pip에있는 버전은 단순히 requirements.txt
이미 가지고 있는 파일을 읽지 만 훨씬 오래되었습니다. 또한 완전히 동일하지는 않습니다 virtualenv
.. Bundler는 누락 된 패키지 만 설치하고 시스템 디렉토리에 설치할 sudo 암호를 제공하거나 pbundler의 기능이 아닌 다시 시작하는 옵션을 제공합니다.
그러나 git의 버전은 "Cheesefile"이 있고 이제 requirements.txt를 지원하지 않는 것을 포함하여 Bundler의 동작에 훨씬 더 가깝도록 거의 완전히 재 작성되었습니다. pythonland에서 requirements.txt가 사실상의 표준이기 때문에 이것은 불행한 일이며 표준화를위한 Offical BDFL 스탬프 작업도 있습니다 . 이것이 시행되면 pbundler와 같은 것이 사실상의 표준이 될 것임을 확신 할 수 있습니다. 아아, 아직 상당히 안정적인 아무것도 내가 알고 없다 (그러나 나는 것 사랑 잘못을 입증 할).
https://github.com/Deepwalker/pundler를 썼습니다 . PIP pundle
에서 이름은 이미 사용되었습니다.
그것은 사용 requirements(_\w+)?.txt
하여 원하는 종속 관계로 파일과 생성 frozen(_\w+)?.txt
냉동 버전 파일을.
About (_\w+)?
thing — this is envs. You can create requirements_test.txt and then use PUNDLEENV=test
to use this deps in your run with requirements.txt ones alongside.
And about virtualenv – you need not one, its what pundle takes from bundler in first head.
I'd say Shovel is worth a look. It was developed specifically to the the Pythonish version of Rake. There's not a ton of commit activity on the project, but seems stable and useful.
No, no all the developers use virtualenv and/or pip, but many developers use/prefer these tools
And now, for package development tools and diferent environments that is your real question. Exist any other tools like Buildout (http://www.buildout.org/en/latest/) for the same purpose, isolate your environment Python build system for every project that you manage. For some time I use this, but not now.
Independent environments per project, in Python are a little different that the same situation in Ruby. In my case i use pyenv (https://github.com/yyuu/pyenv) that is something like rbenv but, for Python. diferent versions of python and virtualenvs per project, and, in this isolated environments, i can use pip or easy-install (if is needed).
'program tip' 카테고리의 다른 글
비동기 / 대기 대 스레드 (0) | 2020.09.04 |
---|---|
읽기 트랜잭션을 커밋하거나 롤백해야합니까? (0) | 2020.09.04 |
API 문서 함수 매개 변수를 해석하는 방법은 무엇입니까? (0) | 2020.09.04 |
생성자 이니셜 라이저에서 멤버 배열 초기화 (0) | 2020.09.04 |
Javascript가 포함 된 HTML 파일을 편집하기 위해 emacs를 어떻게 구성합니까? (0) | 2020.09.04 |