Minimal bibtex io
Format according to “Tame the BeaST” by Nicolas Markey, Oct. 2009.
@TYPE{citekey, key = {value}, ...}, This will be loaded as bib-entry of type TYPE
@string{key = {value}, ...}
@preamble{value}
Functions
loads
Loads the raw bytes of a bibtex-file into a dictionary and makes only minimal assumptions on the structrue but not on the content.
normalize
Takes the raw bib-dictionary and tries to decode and normalize it. All optionally. It strips away leading, trailing, and consecutive whitespaces. It converts all keys, entrytypes, and citekyes to lowercase. It decodes keys and/or values to ‘’ascii’’.
dumps
Dumps a normalized (all ascii string) bib-dictionary into a bib-file-string.
Example
import minimal_bibtex_io as mbib
# Read bytes, make no assumptions on keys or encoding
with open("minimal_bibtex_io/tests/resources/example.bib", "rb") as f:
rawbib = mbib.loads(f.read())
# Try to decode to ascii and set keys to lower case
bib = mbib.normalize(rawbib)
entry = {"type": "book", "citekey": "kasperle1887", "fields": {}}
entry["fields"]["title"] = "The hills are green"
entry["fields"]["year"] = 1887
entry["fields"]["whateverkeyiwant"] = "This is only relevant for me."
bib["entries"].append(entry)
# eventually ...
with open("my.bib", "wt") as f:
f.write(mbib.dumps(bib, indent=4, width=79))
Metadata
Release files for minimal-bibtex-io-sebastian-achim-mueller 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minimal_bibtex_io_sebastian_achim_mueller-0.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for minimal_bibtex_io_sebastian_achim_mueller-0.0.3-py2.py3-none-any.whl |
Release files / minimal_bibtex_io_sebastian_achim_mueller-0.0.3-py2.py3-none-any.whl
| Download URL | minimal_bibtex_io_sebastian_achim_mueller-0.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d15c121c57a6999abb82809639c5e829eb7083c12ac96857c644f8797eddf65d
|
|
BLAKE2b-256 checksum How to use checksums |
8f7fdb8171d63a218b059caf1976d5ab5fe094df797b43a30a5dc6fbb88d72f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for minimal-bibtex-io-sebastian-achim-mueller 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.