Skip to content

Devpi

Python PyPi staging server and packaging, testing, release tool.

How to install

웹 인터페이스를 포함한 설치 방법:

pip install devpi-web
devpi-init --serverdir /data
devpi-server --host 0.0.0.0 --port 8080 --restrict-modify root --serverdir /data

Uploading Sphinx docs

Using plain setup.py for uploading

Authentication and User management

서버 실행시 --restrict-modify root 플래그를 사용했다면 root 사용자로 로그인한 후, 인덱스를 생성해야 한다.

우선, 클라이언트 설치:

pip install devpi-client

연결할 서버를 선택한다.

devpi use https://pypi.yourdomain.com/

참고로 다음과 같이 출력된다.

using server: https://pypi.yourdomain.com/ (not logged in)
no current index: type 'devpi use -l' to discover indices
/home/yourid/.pip/pip.conf: no config file exists
~/.pydistutils.cfg     : no config file exists
~/.buildout/default.cfg: no config file exists
always-set-cfg: no

root 사용자로 로그인한다.

devpi login root

암호를 입력한다.

password for user root at https://pypi.yourdomain.com/:
logged in 'root', credentials valid for 10.00 hours

새로운 사용자를 생성한다.

devpi user -c serverid

물론 사용자의 암호를 입력한다.

new password for user serverid:
repeat new password for user serverid:
user created: serverid

그리고 새로운 사용자의 인덱스를 생성한다.

devpi index -c serverid/answer volatile=False

다음과 같이 출력된다.

https://pypi.yourdomain.com/serverid/answer?no_projects=:
  type=stage
  bases=
  volatile=False
  acl_upload=serverid
  acl_toxresult_upload=:ANONYMOUS:
  mirror_whitelist=

로그아웃한다.

devpi logout

다음과 같이 출력된다.

login information deleted

Creating, configuring and using indices

서버 및 인덱스를 선택한후 root 사용자로 로그인하면 새로운 인덱스를 생성할 수 있다.

devpi index -c servername/answer volatile=True bases=root/pypi
새로운 사용자의 인덱스를 생성.

Options

volatile=True
True일 경우 인덱스에 대한 파괴적인 작업 (패키지 재정의 또는 삭제 등)을 수행 할 수 있다.
bases=root/pypi
root/pypi 인덱스를 상속받아 기반을 재구성할 수 있다.

Quickstart: uploading, testing, pushing releases

서버를 선택한다.

devpi use https://pypi.yourdomain.com/

서버 선택결과 출력:

using server: https://pypi.yourdomain.com/ (not logged in)
no current index: type 'devpi use -l' to discover indices
/home/yourid/.pip/pip.conf: no config file exists
~/.pydistutils.cfg     : no config file exists
~/.buildout/default.cfg: no config file exists
always-set-cfg: no

인덱스를 선택한다.

devpi use serverid/answer

선택 결과 출력:

current devpi index: https://pypi.yourdomain.com/serverid/answer (not logged in)
supported features: server-keyvalue-parsing
/home/yourid/.pip/pip.conf: no config file exists
~/.pydistutils.cfg     : no config file exists
~/.buildout/default.cfg: no config file exists
always-set-cfg: no

로그인한다.

devpi login serverid

로그인 출력 결과:

password for user serverid at https://pypi.yourdomain.com/:
logged in 'serverid' at 'https://pypi.yourdomain.com/serverid/answer', credentials valid for 10.00 hours

setup.py가 있는 폴더로 이동한후 업로드할 수 있다. (--with-docs옵션을 추가하면 문서도 업로드된다.</code>

devpi upload --with-docs

업로드 결과 출력:

using workdir /tmp/devpi4
copied repo /home/yourid/Project/recc/.git to /tmp/devpi4/upload/recc/.git
pre-build: cleaning /home/yourid/Project/recc/core/dist
-->  /tmp/devpi4/upload/recc/core$ /home/yourid/.pyenv/versions/opy-yourid-3.7.7/bin/python setup.py sdist --formats gztar
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

built: /home/yourid/Project/recc/core/dist/recc-2.0.0.tar.gz [SDIST.TGZ] 2.088kb
-->  /tmp/devpi4/upload/recc/core$ /home/yourid/.pyenv/versions/opy-yourid-3.7.7/bin/python setup.py build_sphinx -E --build-dir /tmp/devpi4/upload/recc/core/build
built: /home/yourid/Project/recc/core/dist/recc-2.0.0.doc.zip [sphinx docs] 14030.88kb
register recc-2.0.0 to https://pypi.yourdomain.com/serverid/answer/
file_upload of recc-2.0.0.tar.gz to https://pypi.yourdomain.com/serverid/answer/
doc_upload of recc-2.0.0.doc.zip to https://pypi.yourdomain.com/serverid/answer/

그리고 로그아웃한다.

devpi logout

업로드 된 패키지 설치는 다음과 같이 할 수 있다.

pip install -i https://pypi.yourdomain.com/serverid/answer recc

wheel upload

Try to use the devpi upload with the --formats option set to bdist_wheel:

devpi upload --formats bdist_wheel

Troubleshooting

웹사이트 테마가 정상적으로 적용되지 않을 경우

만약 --outside-url 옵션을 사용했다면, 주소를 https://test.site.com 과 같은 방식으로 적용했는지 확인해 보자.

Conflicting dependencies

새로운 서버로 부터 패키지를 다운로드 받는 방법은 다음과 같다:

pip install -i https://pypi.yourdomain.com/serverid/answer recc

다만 종속성으로 지정된 패키지를 설치할 수 없다는 에러가 출력될 수 있다.

Looking in indexes: https://pypi.yourdomain.com/serverid/answer
Collecting recc
  Using cached https://pypi.yourdomain.com/serverid/answer/%2Bf/73f/5adddc6aaaf1c/recc-2.0.1.tar.gz (2.1 kB)
  Using cached https://pypi.yourdomain.com/serverid/answer/%2Bf/1f0/8f923ef2bdbe1/recc-2.0.0.tar.gz (2.1 kB)
ERROR: Cannot install recc==2.0.0 and recc==2.0.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    recc 2.0.1 depends on docker>=4.4.0
    recc 2.0.0 depends on docker>=4.4.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

이 경우, PyPi 메인 서버를 미러링한 인덱스를 베이스로 사용해야 한다. (보통 최초 초기화시 root/pypi가 그렇다):

devpi index -c serverid/answer volatile=True bases=root/pypi

See also

Favorite site