PYPI에서 패키지 정보를 얻으십시오. 요구 사항 파일을 수정하십시오.
최신 버전을 얻기 위해 종속성을 업그레이드 할 때 주로 PYPI 페이지를 매우 자주 확인합니다. 나는 본질적으로 게으르고 내 엉덩이를 터미널 창에서 꺼내고 싶지 않았습니다.
여기에 진짜 마법이 없습니다. requests 패키지를 사용하여 공개 PYPI REST API를 치고 JSON을 구문 분석하고 표시합니다. 요구 사항 파일을 수정하기위한 몇 가지 기본 파일 조작도 있습니다. 당황스럽게 단순합니다.
pip install whatsonpypi
PYPI에서 패키지에 대한 정보를 찾으십시오
예 :
$ whatsonpypi django NAME Django LATEST VERSION 2.1.5 SUMMARY A high-level Python Web framework that encourages rapid development and clean, pragmatic design. PACKAGE URL https://pypi.org/project/Django/ AUTHOR Django Software Foundation LATEST RELEASES 2.2a1, 2.1rc1, 2.1b1, 2.1a1, 2.1.5
자세한 내용은 ..
예 :
$ whatsonpypi django --more ...
버전 특정 정보 ..
예 :
$ whatsonpypi django==2.1.4 --more ...
브라우저 탭에서 프로젝트의 PYPI URL을 시작하십시오
예 :
$ whatsonpypi django --open
브라우저 탭에서 프로젝트의 문서 URL을 시작합니다
예 :
$ whatsonpypi django --docs
요구 사항 파일에 패키지를 추가하십시오.
예 :
$ whatsonpypi django --add기본적으로 현재 작업 디렉토리에서 이름
requirements*.txt가있는 파일을 검색하고 파일 끝에 종속성을 추가합니다.검색 할 파일 이름 패턴을 변경할 수 있습니다. 패턴에는 간단한 쉘 스타일 와일드 카드가 포함될 수 있습니다.
$ whatsonpypi django --add --req-pattern " *.txt "파일이 둘 이상인 경우 수정해야 할 파일을 선택할 수있는 프롬프트가 표시됩니다.
의존성을 특정 줄에 추가하려면 자체 라인에
#wopp언급하면 종속성으로 대체됩니다.예:
요구 사항에서이를 수행하십시오 .txt :
# Django django==2.1.5 # testing pytest==4.1.1 # wopp그런 다음 이것을 실행하십시오 :
$ whatsonpypi pytest-runner --add이것을 생산할 것입니다 :
# Django django==2.1.5 # testing pytest==4.1.1 pytest-runner==4.2필요에 따라 요구 사항 사양을 사용합니다.
==,>=,<=또는~=사용--ee,--ge,--le또는--te. 기본값은--ee입니다.$ whatsonpypi pytest-runner --add --ge이것을 생산할 것입니다 :
# Django django==2.1.5 # testing pytest==4.1.1 pytest-runner>=4.2기존 의존성은 최신 버전으로 대체됩니다. 기본적으로 의존성 버전은 명시 적으로 명시 적으로 마음에 들지 않는 한 최신입니다.
$ whatsonpypi pytest-runner==4.1 --addBash가 구문 분석하는 것을 방지하기 위해 인용을 두 번 인용해야 할 수도 있습니다.
$ whatsonpypi " pytest-runner>=4.1 " --add선택적으로 요구 사항 파일을 검색하기위한 디렉토리는
--req-dir로 지정할 수 있습니다. 절대 및 상대 경로가 모두 허용됩니다. 디렉토리 여야합니다.$ whatsonpypi pytest-runner==4.1 --add --req-dir /Users/Me/Documents/GitHub/project/requirements기본값 (제공되지 않은 경우)은 명령이 실행되는 디렉토리 (CWD)입니다.
또한 선택적으로 종속성 전에 추가 할 주석을 지정할 수 있습니다. 종속성이 파일에 이미 존재하면 주석이 추가되지 않습니다.
예를 들어, 이것을 실행합니다 :
$ whatsonpypi pytest-runner --add --comment ' testing '이것을 추가합니다 :
# testing pytest-runner==4.2
$ whatsonpypi --help
Usage: whatsonpypi [OPTIONS] PACKAGE
CLI tool to get package info from PyPI and/or manipulate requirements.
Example usages:
$ whatsonpypi django
Options:
-v, --version Show the version and exit.
-m, --more Flag to enable expanded output [required]
-d, --docs Flag to open docs or homepage of project
-o, --open Flag to open PyPI page
-a, --add Flag to enable adding of dependencies to requirement
files. By default, it searches for files with names
matching requirements*.txt in the current working
directory and adds the dependency to the end of the
file. If you want the dependency to be added to a
specific line, mention the comment '#wopp' on its own
line which will be replaced with the dependency.
Existing dependencies will be replaced with newer
versions. Dependency version by default is the latest
unless specified explicitly with 'whatsonpypi
package==version'. Directory to search for
requirement files can be specified with --req-dir
-r, --req-dir DIRECTORY Directory to search for requirement files. Only used
when --add is used. [default: .]
-p, --req-pattern TEXT Filename pattern for searching requirements files.
[default: requirements*.txt; required]
-c, --comment TEXT Comment to be added for the dependency when using
--add.
--ee use == when adding to requirements.
--le use <= when adding to requirements.
--ge use >= when adding to requirements.
--te use ~= when adding to requirements.
-h, --help Show this message and exit.