citepy
Python 3.7+
Easily cite software libraries using information from automatically gathered from their package repository.
Installation
For installing python-based system tools, I recommend pipx. With pipx installed:
pipx install citepy
If you only have pip available:
pip install --user citepy
Usage
usage: citepy [-h] [--all-python] [--repo {cran,crates,pypi}]
[--infile INFILE] [--outfile OUTFILE]
[--format {csl-json/lines,csl-json/min,csl-json/pretty}]
[--verbose] [--date-accessed DATE_ACCESSED] [--version]
[package ...]
Fetch citation data from software package repositories.
positional arguments:
package names of packages you want to cite, optionally with
(full) version string. e.g. 'numpy==1.16.3'
'beautifulsoup4==4.7.1' . Note that version strings
are handled differently by different repositories, and
may be ignored. In particular, any non-exact version
constraint is ignored. '-' will read a newline-
separated list from stdin.
optional arguments:
-h, --help show this help message and exit
--all-python, -a if set, will get information for all python packages
accessible to `pip freeze`
--repo {cran,crates,pypi}, -r {cran,crates,pypi}
which package repository to use (default pypi)
--infile INFILE, -i INFILE
path to read input packages from as newline-separated
items (can be given multiple times; - reads from
stdin)
--outfile OUTFILE, -o OUTFILE
path to write output to (default or - writes to
stdout)
--format {csl-json/lines,csl-json/min,csl-json/pretty}, -f {csl-json/lines,csl-json/min,csl-json/pretty}
format to write out (default 'csl-json/pretty')
--verbose, -v Increase verbosity of logging (can be repeated).
--date-accessed DATE_ACCESSED, -d DATE_ACCESSED
Manually set access date, in format 'YYYY-MM-DD'.
Falls back to CITEPY_DATE_ACCESSED environment
variable, then today's date.
--version print version information and exit
Supported package repos
- PyPI (
pypi) - crates.io (
crates)
Supported output formats
- CSL-data JSON
CSL-data can be converted into bibtex, HTML, or a plaintext bibliography using another tool, e.g. citation-js.
Example
To get a CSL-data JSON representation of the citation information of this package:
citepy citepy
[
{
"URL": "https://www.github.com/clbarnes/citepy",
"abstract": "Automatically create citations for packages",
"accessed": {
"date-parts": [
[
2063,
4,
5
]
]
},
"author": [
{
"literal": "Chris L. Barnes"
}
],
"categories": [
"software",
"python",
"libraries",
"pypi"
],
"id": "citepy",
"issued": {
"date-parts": [
[
2021,
2,
2
]
]
},
"original-date": {
"date-parts": [
[
2019,
5,
25
]
]
},
"publisher": "GitHub",
"title": "citepy",
"type": "webpage",
"version": "0.4.0"
}
]
Limitations
- Author names are not parsed, and are therefore taken as literals
- This is a "wontfix". Author names should be literals. A huge amount of complexity is added to tools which attempt, and fail, to encode the complexity of different cultural conventions around handling names.
- If the package has its own citation information (as numpy, scipy, astropy etc do), citepy will not pick it up - it just uses the package publication metadata
- Software libraries do not fit into the CSL or bibtex categories very well, and so are cited as the web pages which host them
Metadata
Release files for citepy 0.5.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 | |
|---|---|---|---|
| citepy-0.5.0.tar.gz | 19.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| citepy-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.1 kB
Release files / citepy-0.5.0.tar.gz
| Download URL | citepy-0.5.0.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e21682a7846e4afadeace775419455147e53edad7816bb038dfd40db656616a
|
|
BLAKE2b-256 checksum How to use checksums |
c1b6ced368f2958fa29356ea5e9d90d43808c94ba6eb24685ea9d6ecd5396d7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / citepy-0.5.0-py3-none-any.whl
| Download URL | citepy-0.5.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0bc549ca69a3db27029840c37ec01746adfa2497173b185f823604f3070cdd1
|
|
BLAKE2b-256 checksum How to use checksums |
c79fed1370425f491045dc6f62dd31df77e45642b79779aff44980f6bc598acd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|