Python tools to work with JabRef libraries
Project description
ppf.jabref
ppf.jabref provides a python interface to JabRef SQL databases. It maps database relations to python classes using SQLAlchemy. Also, ppf.jabref provides tools to parse the data stored inside the database tables.
Using ppf.jabref
ppf.jabref relies on SQLAlchemy for database access. All that ppf.jabref adds to this is a data model which makes sqlalchemy understand how a JabRef database is structured (by providing classes Entry and Field).
A simple example that queries all entries and prints a selection of the fields looks like this:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from ppf.jabref import Entry, File
engine = create_engine('<your connection string here>', echo=False)
Session = sessionmaker(bind=engine)
session = Session()
q = session.query(Entry)
for entry in q:
print(entry.fields['author'], '\t',
entry.fields['title'], '\t',
entry.fields['year'], '\t', end='')
files = File.from_string(entry.fields['file'])
for i in range(len(files)):
f = files[i]
print(f.path, '\t', end='')
The first 6 lines are setup code to import required packages and to set up the database connection. The query then uses ppf.jabref's Entry class to obtain all Entries (=references) in the JabRef database. The for-loop shows how to access fields and uses the File class to find out where the documents linked to this entry are stored.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ppf-jabref-0.1.0.tar.gz
.
File metadata
- Download URL: ppf-jabref-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b913e79782116a16d63afe21c871c9ed58980fc24cb0a5ad757afabe9bb80b4 |
|
MD5 | 74cf1d98a29b17941317818d1c9208aa |
|
BLAKE2b-256 | 8c2da5abdf0e8e25f74b3cccd6035d96930ea2a5e3e3d604616807a4aa4de66a |
File details
Details for the file ppf_jabref-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ppf_jabref-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69838cd2b36b084835c385cbb6c43b2e798ee6f332c369b43ad6c81c3820021c |
|
MD5 | 6ecb99a50cb843aeb9ae162824e992f1 |
|
BLAKE2b-256 | 82e31424b776af5f7693038739885e52d565d1cb2d159ad99e4135c2b55b4968 |