heprefs: CLI for high-energy physics references
Do you think the commands are too long? Simply configure your shell by editing .zshrc; for example,
function xa() { if [ $# != 0 ]; then for i in $*; do heprefs abs $i; done; fi }
function xx() { if [ $# != 0 ]; then for i in $*; do heprefs pdf $i; done; fi }
function xget() { if [ $# != 0 ]; then for i in $*; do heprefs get -o $i; done; fi }
function xsource() { if [ $# != 0 ]; then for i in $*; do heprefs source -u $i; done; fi }
(or see below) and you will just type xget 1802.07720 1708.00283 etc. to download multiple PDFs!
Set up
For Python 3.10 or later.
Install
$ pip install heprefs
or you can install specific version by, e.g.,
$ pip install git+https://github.com/misho104/heprefs.git@v0.1.0 # for v0.1.0
$ pip install git+https://github.com/misho104/heprefs.git@development # for development version
Upgrade
$ pip install --upgrade heprefs
Uninstall
$ pip uninstall heprefs
Usage
Open abstract pages by a browser
$ heprefs abs 1505.02996 # arXiv
$ heprefs abs hep-th/9711200 # arXiv (old style)
$ heprefs abs ATLAS-CONF-2017-018 # CERN Document Server
$ heprefs abs 10.1038/nphys3005 # DOI (inspireHEP)
$ heprefs abs "fin a Ellis" # inspireHEP (first result is only shown)
$ heprefs abs 9709356 # equivalent to 'hep-ph/9709356'
Open PDF by browser, or Download PDF file
PDF may not be found for CDS or inspireHEP queries.
$ heprefs pdf 1505.02996 # arXiv
$ heprefs pdf ATLAS-CONF-2017-018 # CERN Document Server
$ heprefs get 10.1038/nphys3005 # DOI (inspireHEP)
$ heprefs get "fin a Ellis" # inspireHEP (first result)
$ heprefs get -o "fin a Giudice" # open the PDF file
Show information
$ heprefs authors 1505.02996
$ heprefs first_author hep-th/9711200
$ heprefs title 10.1038/nphys3005
$ heprefs short_info ATLAS-CONF-2017-018
Advanced usage
Specify search engine
There are three types: arXiv, inspireHEP, and CDS. They are automatically guessed, but you can specify a type:
$ heprefs abs -t arxiv 1505.02996 # arXiv
$ heprefs abs -t cds "top asymmetry" # CDS
$ heprefs abs -t ins "top asymmetry" # inspireHEP
$ heprefs abs ATLAS-CONF-2017-018 # guessed as CDS search
$ heprefs abs -t ins ATLAS-CONF-2017-018 # forced to use inspireHEP
Commands are too long?
In your .zshrc, .bashrc, etc...
alias xa='heprefs abs'
alias xx='heprefs pdf'
alias xget='heprefs get'
or if you want to handle multiple arguments,
function xa() { if [ $# != 0 ]; then for i in $*; do heprefs abs $i; done; fi }
function xx() { if [ $# != 0 ]; then for i in $*; do heprefs pdf $i; done; fi }
function xget() { if [ $# != 0 ]; then for i in $*; do heprefs get -o $i; done; fi }
function xsource() { if [ $# != 0 ]; then for i in $*; do heprefs source -u $i; done; fi }
(You may want to use inspire search as well, though this is not a feature of this software.)
function browser() {
google-chrome $* & # on Linux
# open $* -a Google\ Chrome # on macOS
}
function fin() {
local query; if [ $# != 0 ]; then; for i in $*; do; query="$query+$i"; done; fi
query=`echo $query | sed 's/^\+//'`
browser http://inspirehep.net/search\?p=fin+$query &
}
function insp() {
local query; if [ $# != 0 ]; then; for i in $*; do; query="$query+$i"; done; fi
query=`echo $query | sed 's/^\+//'`
browser http://inspirehep.net/search\?p=$query &
}
and now you can invoke
$ xa 1505.02996
$ xget 9709356
$ fin a Giudice and Masiero
$ fin bb hep-th/9711200
$ insp relaxion
Debug command for developers
$ heprefs debug 1505.02996
Metadata
Release files for heprefs 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| heprefs-0.2.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| heprefs-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / heprefs-0.2.0.tar.gz
| Download URL | heprefs-0.2.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c71b6cb9472bff25b6b78aa25258fe5cac7ba8bca849a69b9a739c0f0a333ef5
|
|
BLAKE2b-256 checksum How to use checksums |
0af34db058ed312eca5cc118bcb340c246c907412b2a2c2ee9a168215e52e7b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / heprefs-0.2.0-py3-none-any.whl
| Download URL | heprefs-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ea702d06fb4f0f0a132523ddbeb615fed737e7ecf20051348e648655185eb34
|
|
BLAKE2b-256 checksum How to use checksums |
180ccc21a23eecbafbc1a166b998bc3c84be29f81945fc59008ce0b6c9d88bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|