Skip to main content

Automatically create citations for packages

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

citepy-0.5.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

citepy-0.5.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file citepy-0.5.0.tar.gz.

File metadata

  • Download URL: citepy-0.5.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for citepy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2e21682a7846e4afadeace775419455147e53edad7816bb038dfd40db656616a
MD5 98f0eb731ad3aae8659e9e028bf0accd
BLAKE2b-256 c1b6ced368f2958fa29356ea5e9d90d43808c94ba6eb24685ea9d6ecd5396d7b

See more details on using hashes here.

File details

Details for the file citepy-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: citepy-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for citepy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0bc549ca69a3db27029840c37ec01746adfa2497173b185f823604f3070cdd1
MD5 a4ed198e0d60475f335c58388a671816
BLAKE2b-256 c79fed1370425f491045dc6f62dd31df77e45642b79779aff44980f6bc598acd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page