How to get the short and long description of a not installed pip package?
To my great disappointment the pip package manager does not show any information for packages not already installed. The only way to get anything, seem to be to grep the output of the short description with pip search XXX |grep -i XXX
.
- Q: Is there an easy way to get the long description for a pip package XXX?
(From command line and without having to install it.)
Perhaps a smart way of using wget
or curl
from PyPI could work?
EDIT:
I managed to get a curl one-liner with:
Here's Bash one-liner:
curl -sG -H 'Host: pypi.org' -H 'Accept: application/json' https://pypi.org/pypi/numpy/json | awk -F "description":"" '{ print $2 }' |cut -d ',' -f 1
# NumPy is a general-purpose array-processing package designed to...
However, a different and more robust way would be preferable.
python pip package pypi
add a comment |
To my great disappointment the pip package manager does not show any information for packages not already installed. The only way to get anything, seem to be to grep the output of the short description with pip search XXX |grep -i XXX
.
- Q: Is there an easy way to get the long description for a pip package XXX?
(From command line and without having to install it.)
Perhaps a smart way of using wget
or curl
from PyPI could work?
EDIT:
I managed to get a curl one-liner with:
Here's Bash one-liner:
curl -sG -H 'Host: pypi.org' -H 'Accept: application/json' https://pypi.org/pypi/numpy/json | awk -F "description":"" '{ print $2 }' |cut -d ',' -f 1
# NumPy is a general-purpose array-processing package designed to...
However, a different and more robust way would be preferable.
python pip package pypi
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
1
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.
– hoefling
Nov 26 '18 at 17:16
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (yolk
is nice too, but a bit bloated overkill for that single purpose.)
– not2qubit
Nov 26 '18 at 19:46
add a comment |
To my great disappointment the pip package manager does not show any information for packages not already installed. The only way to get anything, seem to be to grep the output of the short description with pip search XXX |grep -i XXX
.
- Q: Is there an easy way to get the long description for a pip package XXX?
(From command line and without having to install it.)
Perhaps a smart way of using wget
or curl
from PyPI could work?
EDIT:
I managed to get a curl one-liner with:
Here's Bash one-liner:
curl -sG -H 'Host: pypi.org' -H 'Accept: application/json' https://pypi.org/pypi/numpy/json | awk -F "description":"" '{ print $2 }' |cut -d ',' -f 1
# NumPy is a general-purpose array-processing package designed to...
However, a different and more robust way would be preferable.
python pip package pypi
To my great disappointment the pip package manager does not show any information for packages not already installed. The only way to get anything, seem to be to grep the output of the short description with pip search XXX |grep -i XXX
.
- Q: Is there an easy way to get the long description for a pip package XXX?
(From command line and without having to install it.)
Perhaps a smart way of using wget
or curl
from PyPI could work?
EDIT:
I managed to get a curl one-liner with:
Here's Bash one-liner:
curl -sG -H 'Host: pypi.org' -H 'Accept: application/json' https://pypi.org/pypi/numpy/json | awk -F "description":"" '{ print $2 }' |cut -d ',' -f 1
# NumPy is a general-purpose array-processing package designed to...
However, a different and more robust way would be preferable.
python pip package pypi
python pip package pypi
edited Nov 26 '18 at 19:44
not2qubit
asked Nov 26 '18 at 12:20
not2qubitnot2qubit
4,27613762
4,27613762
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
1
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.
– hoefling
Nov 26 '18 at 17:16
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (yolk
is nice too, but a bit bloated overkill for that single purpose.)
– not2qubit
Nov 26 '18 at 19:46
add a comment |
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
1
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.
– hoefling
Nov 26 '18 at 17:16
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (yolk
is nice too, but a bit bloated overkill for that single purpose.)
– not2qubit
Nov 26 '18 at 19:46
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
1
1
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:
python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.– hoefling
Nov 26 '18 at 17:16
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:
python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.– hoefling
Nov 26 '18 at 17:16
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (
yolk
is nice too, but a bit bloated overkill for that single purpose.)– not2qubit
Nov 26 '18 at 19:46
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (
yolk
is nice too, but a bit bloated overkill for that single purpose.)– not2qubit
Nov 26 '18 at 19:46
add a comment |
1 Answer
1
active
oldest
votes
PyPI offers an API to access package metadata:
Simple: a response from
https://pypi.org/simple/<pkgname>
is an HTML page that is a list of download URLs and can be parsed with any HTML parser, likebeautifulsoup
orlxml
.JSON: a response from
http://pypi.org/pypi/<pkgname>/json
is a JSON string that can be processed using any JSON processing tool. Example from comments usingrequests
:
In [1]: import requests
In [2]: data = requests.get('https://pypi.org/pypi/lxml/json').json()
In [3]: data['info']['summary']
Out[3]: 'Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.'
In [4]: data['info']['description']
Out[4]: 'lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. Itnprovides safe and convenient access to these libraries using the ElementTreenAPI.nnIt extends the ElementTree API significantly to offer support for XPath,nRelaxNG, XML Schema, XSLT, C14N and much more.nnTo contact the project, go to the `project home pagen<http://lxml.de/>`_ or see our bug tracker atnhttps://launchpad.net/lxmlnnIn case you want to use the current in-development version of lxml,nyou can get it from the github repository atnhttps://github.com/lxml/lxml . Note that this requires Cython tonbuild the sources, see the build instructions on the project homenpage. To the same end, running ``easy_install lxml==dev`` willninstall lxml fromnhttps://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you havenan appropriate version of Cython installed.nnnAfter an official release of a new stable series, bug fixes may becomenavailable atnhttps://github.com/lxml/lxml/tree/lxml-4.2 .nRunning ``easy_install lxml==4.2bugfix`` will installnthe unreleased branch state fromnhttps://github.com/lxml/lxml/tarball/lxml-4.2#egg=lxml-4.2bugfixnas soon as a maintenance branch has been established. Note that thisnrequires Cython to be installed at an appropriate version for the build.nn4.2.5 (2018-09-09)n==================nnBugs fixedn----------nn* Javascript URLs that used URL escaping were not removed by the HTML cleaner.n Security problem found by Omar Eissa.nnnnn'
A command line alternative would be using yolk
. Install with
$ pip install yolk3k
Above query of lxml
for summary and description with yolk
:
$ yolk -M lxml -f summary,description
summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
provides safe and convenient access to these libraries using the ElementTree
API.
It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT, C14N and much more.
...
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481014%2fhow-to-get-the-short-and-long-description-of-a-not-installed-pip-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
PyPI offers an API to access package metadata:
Simple: a response from
https://pypi.org/simple/<pkgname>
is an HTML page that is a list of download URLs and can be parsed with any HTML parser, likebeautifulsoup
orlxml
.JSON: a response from
http://pypi.org/pypi/<pkgname>/json
is a JSON string that can be processed using any JSON processing tool. Example from comments usingrequests
:
In [1]: import requests
In [2]: data = requests.get('https://pypi.org/pypi/lxml/json').json()
In [3]: data['info']['summary']
Out[3]: 'Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.'
In [4]: data['info']['description']
Out[4]: 'lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. Itnprovides safe and convenient access to these libraries using the ElementTreenAPI.nnIt extends the ElementTree API significantly to offer support for XPath,nRelaxNG, XML Schema, XSLT, C14N and much more.nnTo contact the project, go to the `project home pagen<http://lxml.de/>`_ or see our bug tracker atnhttps://launchpad.net/lxmlnnIn case you want to use the current in-development version of lxml,nyou can get it from the github repository atnhttps://github.com/lxml/lxml . Note that this requires Cython tonbuild the sources, see the build instructions on the project homenpage. To the same end, running ``easy_install lxml==dev`` willninstall lxml fromnhttps://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you havenan appropriate version of Cython installed.nnnAfter an official release of a new stable series, bug fixes may becomenavailable atnhttps://github.com/lxml/lxml/tree/lxml-4.2 .nRunning ``easy_install lxml==4.2bugfix`` will installnthe unreleased branch state fromnhttps://github.com/lxml/lxml/tarball/lxml-4.2#egg=lxml-4.2bugfixnas soon as a maintenance branch has been established. Note that thisnrequires Cython to be installed at an appropriate version for the build.nn4.2.5 (2018-09-09)n==================nnBugs fixedn----------nn* Javascript URLs that used URL escaping were not removed by the HTML cleaner.n Security problem found by Omar Eissa.nnnnn'
A command line alternative would be using yolk
. Install with
$ pip install yolk3k
Above query of lxml
for summary and description with yolk
:
$ yolk -M lxml -f summary,description
summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
provides safe and convenient access to these libraries using the ElementTree
API.
It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT, C14N and much more.
...
add a comment |
PyPI offers an API to access package metadata:
Simple: a response from
https://pypi.org/simple/<pkgname>
is an HTML page that is a list of download URLs and can be parsed with any HTML parser, likebeautifulsoup
orlxml
.JSON: a response from
http://pypi.org/pypi/<pkgname>/json
is a JSON string that can be processed using any JSON processing tool. Example from comments usingrequests
:
In [1]: import requests
In [2]: data = requests.get('https://pypi.org/pypi/lxml/json').json()
In [3]: data['info']['summary']
Out[3]: 'Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.'
In [4]: data['info']['description']
Out[4]: 'lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. Itnprovides safe and convenient access to these libraries using the ElementTreenAPI.nnIt extends the ElementTree API significantly to offer support for XPath,nRelaxNG, XML Schema, XSLT, C14N and much more.nnTo contact the project, go to the `project home pagen<http://lxml.de/>`_ or see our bug tracker atnhttps://launchpad.net/lxmlnnIn case you want to use the current in-development version of lxml,nyou can get it from the github repository atnhttps://github.com/lxml/lxml . Note that this requires Cython tonbuild the sources, see the build instructions on the project homenpage. To the same end, running ``easy_install lxml==dev`` willninstall lxml fromnhttps://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you havenan appropriate version of Cython installed.nnnAfter an official release of a new stable series, bug fixes may becomenavailable atnhttps://github.com/lxml/lxml/tree/lxml-4.2 .nRunning ``easy_install lxml==4.2bugfix`` will installnthe unreleased branch state fromnhttps://github.com/lxml/lxml/tarball/lxml-4.2#egg=lxml-4.2bugfixnas soon as a maintenance branch has been established. Note that thisnrequires Cython to be installed at an appropriate version for the build.nn4.2.5 (2018-09-09)n==================nnBugs fixedn----------nn* Javascript URLs that used URL escaping were not removed by the HTML cleaner.n Security problem found by Omar Eissa.nnnnn'
A command line alternative would be using yolk
. Install with
$ pip install yolk3k
Above query of lxml
for summary and description with yolk
:
$ yolk -M lxml -f summary,description
summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
provides safe and convenient access to these libraries using the ElementTree
API.
It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT, C14N and much more.
...
add a comment |
PyPI offers an API to access package metadata:
Simple: a response from
https://pypi.org/simple/<pkgname>
is an HTML page that is a list of download URLs and can be parsed with any HTML parser, likebeautifulsoup
orlxml
.JSON: a response from
http://pypi.org/pypi/<pkgname>/json
is a JSON string that can be processed using any JSON processing tool. Example from comments usingrequests
:
In [1]: import requests
In [2]: data = requests.get('https://pypi.org/pypi/lxml/json').json()
In [3]: data['info']['summary']
Out[3]: 'Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.'
In [4]: data['info']['description']
Out[4]: 'lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. Itnprovides safe and convenient access to these libraries using the ElementTreenAPI.nnIt extends the ElementTree API significantly to offer support for XPath,nRelaxNG, XML Schema, XSLT, C14N and much more.nnTo contact the project, go to the `project home pagen<http://lxml.de/>`_ or see our bug tracker atnhttps://launchpad.net/lxmlnnIn case you want to use the current in-development version of lxml,nyou can get it from the github repository atnhttps://github.com/lxml/lxml . Note that this requires Cython tonbuild the sources, see the build instructions on the project homenpage. To the same end, running ``easy_install lxml==dev`` willninstall lxml fromnhttps://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you havenan appropriate version of Cython installed.nnnAfter an official release of a new stable series, bug fixes may becomenavailable atnhttps://github.com/lxml/lxml/tree/lxml-4.2 .nRunning ``easy_install lxml==4.2bugfix`` will installnthe unreleased branch state fromnhttps://github.com/lxml/lxml/tarball/lxml-4.2#egg=lxml-4.2bugfixnas soon as a maintenance branch has been established. Note that thisnrequires Cython to be installed at an appropriate version for the build.nn4.2.5 (2018-09-09)n==================nnBugs fixedn----------nn* Javascript URLs that used URL escaping were not removed by the HTML cleaner.n Security problem found by Omar Eissa.nnnnn'
A command line alternative would be using yolk
. Install with
$ pip install yolk3k
Above query of lxml
for summary and description with yolk
:
$ yolk -M lxml -f summary,description
summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
provides safe and convenient access to these libraries using the ElementTree
API.
It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT, C14N and much more.
...
PyPI offers an API to access package metadata:
Simple: a response from
https://pypi.org/simple/<pkgname>
is an HTML page that is a list of download URLs and can be parsed with any HTML parser, likebeautifulsoup
orlxml
.JSON: a response from
http://pypi.org/pypi/<pkgname>/json
is a JSON string that can be processed using any JSON processing tool. Example from comments usingrequests
:
In [1]: import requests
In [2]: data = requests.get('https://pypi.org/pypi/lxml/json').json()
In [3]: data['info']['summary']
Out[3]: 'Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.'
In [4]: data['info']['description']
Out[4]: 'lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. Itnprovides safe and convenient access to these libraries using the ElementTreenAPI.nnIt extends the ElementTree API significantly to offer support for XPath,nRelaxNG, XML Schema, XSLT, C14N and much more.nnTo contact the project, go to the `project home pagen<http://lxml.de/>`_ or see our bug tracker atnhttps://launchpad.net/lxmlnnIn case you want to use the current in-development version of lxml,nyou can get it from the github repository atnhttps://github.com/lxml/lxml . Note that this requires Cython tonbuild the sources, see the build instructions on the project homenpage. To the same end, running ``easy_install lxml==dev`` willninstall lxml fromnhttps://github.com/lxml/lxml/tarball/master#egg=lxml-dev if you havenan appropriate version of Cython installed.nnnAfter an official release of a new stable series, bug fixes may becomenavailable atnhttps://github.com/lxml/lxml/tree/lxml-4.2 .nRunning ``easy_install lxml==4.2bugfix`` will installnthe unreleased branch state fromnhttps://github.com/lxml/lxml/tarball/lxml-4.2#egg=lxml-4.2bugfixnas soon as a maintenance branch has been established. Note that thisnrequires Cython to be installed at an appropriate version for the build.nn4.2.5 (2018-09-09)n==================nnBugs fixedn----------nn* Javascript URLs that used URL escaping were not removed by the HTML cleaner.n Security problem found by Omar Eissa.nnnnn'
A command line alternative would be using yolk
. Install with
$ pip install yolk3k
Above query of lxml
for summary and description with yolk
:
$ yolk -M lxml -f summary,description
summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
provides safe and convenient access to these libraries using the ElementTree
API.
It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT, C14N and much more.
...
answered Nov 27 '18 at 13:31
hoeflinghoefling
12.7k43265
12.7k43265
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481014%2fhow-to-get-the-short-and-long-description-of-a-not-installed-pip-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
yolk -M pkgname -f description
– hoefling
Nov 26 '18 at 13:57
1
Or, if you prefer the more low-level approach, you can query PyPI's API directly (Simple, JSON). Example:
python -c "import requests; data = requests.get('https://pypi.org/pypi/lxml/json').json(); print(data['info']['description'])"
.– hoefling
Nov 26 '18 at 17:16
@hoefling Fantastic! Exactly what I was looking for. Please post the answer so I can accept it. (
yolk
is nice too, but a bit bloated overkill for that single purpose.)– not2qubit
Nov 26 '18 at 19:46