Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/source/migrate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ While in v1 entries were represented as dicts, in v2 they are represented as ``E
# ... but to facilitate migration or simple cases, this shorthand notation also works ...
print(entry['title'])

If you need plain dicts as in v1, e.g. to pass entries on to another library, convert them:

.. code-block:: python

# v1
entries = bib_database.entries
entries_dict = bib_database.entries_dict

# v2
entries = [dict(entry) for entry in library.entries]
entries_dict = {entry["ID"]: entry for entry in entries}

Field values are whatever the middleware produced (e.g. a list of names after ``SeparateCoAuthors``), not necessarily strings.


Similarly, other block types (comments, strings, ...) are now also represented as dedicated :ref:`object types <vocab>`,
but for them, the migration is straight forward and we will not go into detail here.
Expand Down
Loading