Skip to main content

Import Zotero annotations with Dendron integration. https://github.com/Mjvolk3/Zendron

Project description

PyPI version

"Buy Me A Coffee"

Showcase

  1. Show how you can structure a paper using note refernces in Dendron.
  2. Install Zendron and import references from the relevant library.
  3. Cite while you write, and view all relevant Zotero metadata, annotations, and comment notes with hover.
  4. Compile paper to .docx, .pdf, and .html with Pandoc.
  5. Find relevant papers via VsCode search.

Introduction

  • This package was developed for porting Zotero annotations and metadata to markdown. These markdown notes are then brought into a Dendron hierarchy for integration with vault notes. We recommend using the package within Visual Studio Code.The end goal is to get a two way sync between notes in Zotero and notes in Dendron, but this has some difficulties and limitations that are taking some time to address. For now only a one way sync from Zotero to Dendron is supported.

Install Instructions

  • It is recommended to build a conda env for installation.
  • Install Dendron CLI.
    • npm install -g @dendronhq/dendron-cli@latest
  • Install the zendron
    • python -m pip install zendron

Zotero Local Setup

  • To start you need Better BibTeX for Zotero
    • This allows pinning of of bibtex keys.v
  • Go to Zotero > Settings... > Advanced > General > Config Editor
  • Accept the risks
  • In the Search, type autoPinDelay and chance the integer value from 0 (default) to 1.

Zotero API key

  • Zotero API key
  • We recommend setting up you Zotero API key with the following settings to allow for full functionality.
    • Personal Library
      • Allow library access.
      • Allow notes access.
      • Allow write access.
    • Default Gropu Permissions
      • Read/Write

  • This key can then be copy pasted in the configuration file. You should add your key to .gitignore to prevent others from accessing your Zotoero database. If the key is lost you can always generate a new one.

Zotero and File Import Configuration

All zendron configuration is handled in config.yml.

library_id : 4932032 # Zotero library ID
library_type : group # [user, group] library
api_key : FoCauOvWMlNdYmpYuY5JplTw # Zotero API key
collection: null # Name of Zotero Collection, null for entire library
item_types: [journalArticle, book, preprint, conferencePaper, report] # List of item types according to [pyzotero](https://pyzotero.readthedocs.io/en/latest/)
local_image_path: /Users/<username>/Zotero/cache # Local path for importing annotated images
dendron_limb: zendron.import # Dendron import limb e.g. zendron.import.paper-title.annotations.md
zotero_comment_title: zendron comment # fixed for now... needed for eventual 2-way sync.
pod_path: zotero_pod # Name of dendron pod, removed after completion of import. We will later add configuration for this to remain. This will allow for non Dendron users to import markdown Zotero notes in a strucutred hierarchy.
  • library_id - Integer identifier of library. This is the number that matches the name of a library.
    • User ID.
    • For group ID visit Zotero Groups, click on your desired group, and copy the id from the URL.
  • library_type: group for group libraries and user for user library.
  • api_key: Use the API Key obtained from Zotero API KEY.
  • collection: This can be the name of any collection or subcollection in the specificed library. If there are multiple collections or sub collections with the same name, the import will arbitrarily choose one. To make sure you are importing the desired collection, make sure the name of the collection is unique in the Zotero library.
  • item_types: Zotero item types to import according to pyzotero syntax. local_image_path: Path to annotated images. /Users/<username>/Zotero/cache is the default path on MacOS.
  • dendron_limb: This is the period deliminated hierarchy prefix to all file imports for Dendron, e.g. root.zotero.import.<paper_title>.annotations.md.
  • zotero comment title - IGNORE FOR NOW. Eventually needed for 2-way sync.
  • pod_path - IGNORE FOR NOW. Eventually needed for markdown only import, without Dendron integration.

Basic Usage

There are only two basic commands that work as of now.

  • zendron
    • This command should only be run in the root directory of the workspace.
    • This command imports notes according to a defined config.yml. Once the command is run the first time the user needs to modify their configuration ./conf/config.yaml. All required configs are marked with a comment # STARTER CONFIG upon initialization.
    • Notes are imported with a ## Time Created heading. This allows for stable reference from other notes, within the note vault. We autogenerate a *.comments.md that should be used for taking any additional notes within Dendron. Additional notes taken within the meta data file (notes/zendron.import.<paper-title>.md), or the *.annotations.md will be overwritten after running zendron for a second time. All files downstream of import excpet *.comments.md should be treated as read only. We have plans to explicitly make them read only soon.
    • Upon import, notes and tags are left as stubs. To create these notes run > Dendron: Doctor then createMissingLinkedNotes. It is best practice to correc tag warnings before doing this.
  • zendron remove=true
    • This command removes imported notes and associated links. This command works by remove all notes downstream fo dendron_limb, excpet for comments.md. There is some difficult removing other files created becuase these are separate from the dendron_limb. These files include user.*.md, which comes from bibtex keys, and tags.*.md which come from metadata and annotation tags. For now, we don't remove tags, but we do remove bibex keys (<user.bibtex_key>.md).
    • There are more complicated removal's that could be desired so we plan to eventually change this from a bool to an str.

Miscellaneous

  • The zendron_cache is used for remove of <user.bibtex_key>.md. If it is deleted and you run remove, the <user.bibtex_key>.md will not be removed. In this case you can run zendron again, then run the zendron remove=true again.
  • If there are run that fail, sometimes a .hydra with the given configuraiton will be generated in the root dir. This isn't an issue but it contains the API information and should therefore be added to the .gitignore as a safeguard. In addition these files can be used to inspect the reason for the faiure.
  • __main__.log is generated after running a zendron, this can also be deleted as you please. It is also useful for inspecting an failures to import.

Troubleshooting

  • If you are having trouble with startup you can use this Zendron-Test template and try to reproduce your issues here. Simply click on Use this template, clone the repo and try to run zendron here. This will allow for us to catch things we overlooked for different user workspace configuration etc. Once you have tried to reproduce issues here please submit an issue on Zendron.

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

zendron-1.3.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

zendron-1.3.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file zendron-1.3.0.tar.gz.

File metadata

  • Download URL: zendron-1.3.0.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.8

File hashes

Hashes for zendron-1.3.0.tar.gz
Algorithm Hash digest
SHA256 8e2e83943d0973cd2b63e8921c523f7d8f4b8119b948c725fe6a37ce627a1090
MD5 3e5f065e1385e5a178108c924d812a36
BLAKE2b-256 b358eef3d897d29c0e162498b48a89961f5b28337eb140262cbcd9da893f050b

See more details on using hashes here.

File details

Details for the file zendron-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: zendron-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.8

File hashes

Hashes for zendron-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa1a9eafe4a898c56c4ab6df127a4636ffc12e29e5582dad1bb3e494c77cb3e0
MD5 7292941c00a488ddb870f4b9116a4681
BLAKE2b-256 5cbad851378a80aae52bcf30f449abfd4ee27df3977e7fb4c1f77dbb49cd45bc

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