zensols.zotsite


Namezensols.zotsite JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/plandes/zotsite
SummaryThis project exports your local Zotero library to a usable HTML website.
upload_time2025-01-11 20:03:09
maintainerNone
docs_urlNone
authorPaul Landes
requires_pythonNone
licenseNone
keywords tooling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Zotsite: A Zotero Export Utility

[![PyPI][pypi-badge]][pypi-link]
[![Python 3.11][python311-badge]][python311-link]
[![Build Status][build-badge]][build-link]

This project exports your local [Zotero] library to a usable HTML website with
following features:

* Easily access your papers, site snapshots, notes from a navigation tree.
* Provides metadata from collections and attachments (i.e. referenes etc).
* Display PDF papers and website snapshot (the latter as framed).
* Search function dynamically narrows down the papers you're looking for.
* Embed links to a specific collection, article, item, note etc.
* Export only a portion of your collection with regular expressions using the
  collection name.
* [BetterBibtex] integration.
* Snazzy look and feel from the latest [Bootstrap] CSS/Javascript library.

<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
## Table of Contents

- [Documentation](#documentation)
- [Obtaining](#obtaining)
- [Process](#process)
- [Sample Site Demonstration](#sample-site-demonstration)
- [Requirements](#requirements)
- [Usage](#usage)
    - [Command Line](#command-line)
    - [API](#api)
    - [Configuration File](#configuration-file)
- [Screenshot](#screenshot)
- [Ubuntu and Linux Systems with Python 3.5 or Previous Version](#ubuntu-and-linux-systems-with-python-35-or-previous-version)
- [Attribution](#attribution)
- [Todo](#todo)
- [Zotero Plugin Listing](#zotero-plugin-listing)
- [Changelog](#changelog)
- [Community](#community)
- [License](#license)

<!-- markdown-toc end -->


## Documentation

See the [full documentation](https://plandes.github.io/zotsite/index.html).
The [API reference](https://plandes.github.io/zotsite/api.html) is also
available.


## Obtaining

The library can be installed with pip from the [pypi] repository:
```bash
pip3 install zensols.zotsite
```


## Process

The tool does the following:

1. Exports the meta data (directory structure, references, notes, etc) from
   your [Zotero] library.  On MacOS, this is done by querying the file system
   SQLite DB files.
2. Copies a static site that enables traversal of the exported data.
3. Copies your [Zotero] stored papers, snapshot (sites) etc.
4. Generates a navigation tree to easily find your papers/content.


## Sample Site Demonstration

See the [live demo], which provides a variety of resources found in my own
library.  *Note:* To my knowledge, all of these resources are free to
distribute and violate no laws.  If I've missed one,
please [create an issue](CONTRIBUTING.md).

## Requirements

[BetterBibtex] plugin for Zotero.


## Usage

The library is typically used from the command line to create websites, but it
can also be used as an API from Python.


### Command Line

The command line program has two modes: show configuration (a good first step)
and to create the web site.  You can see what the program is parsing from your
[Zotero] library:

```bash
zotsite print
```

To create the stand-alone site, run the program (without the angle brackets):

```bash
zotsite export
```

If your library is not in the default `~/zotero` directory you will need to
change that path by making a zotsite.conf config file.  This will create the
html files in the directory `./zotsite`:

```bash
zotsite export --collection zotsite.conf
```

A mapping of BetterBibtex citation keys to Zotero's database unique *item keys*
can be useful to scripts:
```bash
zotsite citekey -k all
```

The tool also provides a means of finding where papers are by *item key*:
```bash
zotsite docpath -k all
```

See [usage](doc/usage.md) for more information.  Command line usage as provided
with the `--help` option.


### API

The API provides access to a Python object that creates the website, can
resolve BetterBibtex citation keys to Zotero unique identifier *item keys* and
provide paths of item attachments (such as papers).

The following example come from [this working script](example/showpaper.py).

```python
>>> from typing import Dict, Any
>>> from pathlib import Path
>>> from zensols.zotsite import Resource, ApplicationFactory
# get the resource facade objects, which provides access to create the site,
# citation and path lookup methods
>>> resource: Resource = ApplicationFactory.get_resource()
# get a mapping from <library ID>_<item key> to entry dictionaries
>>> entries: Dict[str, Dict[str, Any]] = resource.cite_db.entries
# get a mapping from item key (sans library ID) to the attachment path
>>> paths: Dict[str, Path] = resource.zotero_db.item_paths
# create BetterBibtex citation key to item key mapping
>>> bib2item: Dict[str, str] = dict(map(
...     lambda e: (e['citationKey'], e['itemKey']),
...     entries.values()))
# get the item key from the citation key
>>> itemKey: str = bib2item['landesCALAMRComponentALignment2024']
# get the path using the Zotero DB item key
>>> paper_path: Path = paths[itemKey]
>>> print(paper_path)
# display the paper (needs 'pip install zensols.rend')
>>> from zensols.rend import ApplicationFactory as RendAppFactory
>>> RendAppFactory.get_browser_manager()(paper_path)
```


### Configuration File

Either an environment variable `ZOTSITERC` must be set or a `-c` configuration
option must be given and point to a file to customize how the program works.
See the test [configuration file] for an example and inline comments for more
detail on how and what can be configured.


## Screenshot

Also see the [live demo].

![Screenshot][screenshot]


## Ubuntu and Linux Systems with Python 3.5 or Previous Version

Please [read this issue](https://github.com/plandes/zotsite/issues/4) if you
are installing a Ubuntu or any Linux system with Python 3.5 or previous
version.


## Attribution

This software uses:
* Python 3
* [jQuery] version 3
* [DataTables] version 1.12
* [Bootstrap] version 4
* [Tree View] for Bootstrap
* [Popper] for tooltips
* [Copy to Clipboard] function


## Todo

* Make the site portion a proper Javascript site.  Right now, all the `min`s
  are added in the distribution to same directory as
  the [main navigation/content](resources/site/src/js/zotero.js) file.
* Use something like zotxt to make this work with a plugin rather than directly
  against the SQLite DB.


## Zotero Plugin Listing

This is listed as a [plugin] on the Zotero site.


## Changelog

An extensive changelog is available [here](CHANGELOG.md).


## Community

Please star this repository and let me know how and where you use this API.
Contributions as pull requests, feedback and any input is welcome.


## License

[MIT License](LICENSE.md)

Copyright (c) 2019 - 2025 Paul Landes


<!-- links -->
[pypi]: https://pypi.org/project/zensols.zotsite/
[pypi-link]: https://pypi.python.org/pypi/zensols.zotsite
[pypi-badge]: https://img.shields.io/pypi/v/zensols.zotsite.svg
[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg
[python311-link]: https://www.python.org/downloads/release/python-3110
[build-badge]: https://github.com/plandes/zotsite/workflows/CI/badge.svg
[build-link]: https://github.com/plandes/zotsite/actions
[gitter-link]: https://gitter.im/zoterosite/zotsite
[gitter-badge]: https://badges.gitter.im/zoterosite/gitter.png

[live demo]: https://plandes.github.io/zotsite/demo/index.html
[screenshot]: https://raw.githubusercontent.com/plandes/zotsite/master/doc/snapshot.png

[Zotero]: https://www.zotero.org
[jQuery]: https://jquery.com
[DataTables]: https://datatables.net
[Bootstrap]: https://getbootstrap.com
[Tree View]: https://github.com/jonmiles/bootstrap-treeview
[Popper]: https://popper.js.org
[plugin]: https://www.zotero.org/support/plugins#website_integration
[Copy to Clipboard]: https://ourcodeworld.com/articles/read/143/how-to-copy-text-to-clipboard-with-javascript-easily
[BetterBibtex]: https://github.com/retorquere/zotero-better-bibtex
[configuration file]: test-resources/zotsite.conf
[Python regular expression]: https://docs.python.org/3/library/re.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/plandes/zotsite",
    "name": "zensols.zotsite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "tooling",
    "author": "Paul Landes",
    "author_email": "landes@mailc.net",
    "download_url": "https://github.com/plandes/zotsite/releases/download/v1.1.0/zensols.zotsite-1.1.0-py3-none-any.whl",
    "platform": null,
    "description": "# Zotsite: A Zotero Export Utility\n\n[![PyPI][pypi-badge]][pypi-link]\n[![Python 3.11][python311-badge]][python311-link]\n[![Build Status][build-badge]][build-link]\n\nThis project exports your local [Zotero] library to a usable HTML website with\nfollowing features:\n\n* Easily access your papers, site snapshots, notes from a navigation tree.\n* Provides metadata from collections and attachments (i.e. referenes etc).\n* Display PDF papers and website snapshot (the latter as framed).\n* Search function dynamically narrows down the papers you're looking for.\n* Embed links to a specific collection, article, item, note etc.\n* Export only a portion of your collection with regular expressions using the\n  collection name.\n* [BetterBibtex] integration.\n* Snazzy look and feel from the latest [Bootstrap] CSS/Javascript library.\n\n<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->\n## Table of Contents\n\n- [Documentation](#documentation)\n- [Obtaining](#obtaining)\n- [Process](#process)\n- [Sample Site Demonstration](#sample-site-demonstration)\n- [Requirements](#requirements)\n- [Usage](#usage)\n    - [Command Line](#command-line)\n    - [API](#api)\n    - [Configuration File](#configuration-file)\n- [Screenshot](#screenshot)\n- [Ubuntu and Linux Systems with Python 3.5 or Previous Version](#ubuntu-and-linux-systems-with-python-35-or-previous-version)\n- [Attribution](#attribution)\n- [Todo](#todo)\n- [Zotero Plugin Listing](#zotero-plugin-listing)\n- [Changelog](#changelog)\n- [Community](#community)\n- [License](#license)\n\n<!-- markdown-toc end -->\n\n\n## Documentation\n\nSee the [full documentation](https://plandes.github.io/zotsite/index.html).\nThe [API reference](https://plandes.github.io/zotsite/api.html) is also\navailable.\n\n\n## Obtaining\n\nThe library can be installed with pip from the [pypi] repository:\n```bash\npip3 install zensols.zotsite\n```\n\n\n## Process\n\nThe tool does the following:\n\n1. Exports the meta data (directory structure, references, notes, etc) from\n   your [Zotero] library.  On MacOS, this is done by querying the file system\n   SQLite DB files.\n2. Copies a static site that enables traversal of the exported data.\n3. Copies your [Zotero] stored papers, snapshot (sites) etc.\n4. Generates a navigation tree to easily find your papers/content.\n\n\n## Sample Site Demonstration\n\nSee the [live demo], which provides a variety of resources found in my own\nlibrary.  *Note:* To my knowledge, all of these resources are free to\ndistribute and violate no laws.  If I've missed one,\nplease [create an issue](CONTRIBUTING.md).\n\n## Requirements\n\n[BetterBibtex] plugin for Zotero.\n\n\n## Usage\n\nThe library is typically used from the command line to create websites, but it\ncan also be used as an API from Python.\n\n\n### Command Line\n\nThe command line program has two modes: show configuration (a good first step)\nand to create the web site.  You can see what the program is parsing from your\n[Zotero] library:\n\n```bash\nzotsite print\n```\n\nTo create the stand-alone site, run the program (without the angle brackets):\n\n```bash\nzotsite export\n```\n\nIf your library is not in the default `~/zotero` directory you will need to\nchange that path by making a zotsite.conf config file.  This will create the\nhtml files in the directory `./zotsite`:\n\n```bash\nzotsite export --collection zotsite.conf\n```\n\nA mapping of BetterBibtex citation keys to Zotero's database unique *item keys*\ncan be useful to scripts:\n```bash\nzotsite citekey -k all\n```\n\nThe tool also provides a means of finding where papers are by *item key*:\n```bash\nzotsite docpath -k all\n```\n\nSee [usage](doc/usage.md) for more information.  Command line usage as provided\nwith the `--help` option.\n\n\n### API\n\nThe API provides access to a Python object that creates the website, can\nresolve BetterBibtex citation keys to Zotero unique identifier *item keys* and\nprovide paths of item attachments (such as papers).\n\nThe following example come from [this working script](example/showpaper.py).\n\n```python\n>>> from typing import Dict, Any\n>>> from pathlib import Path\n>>> from zensols.zotsite import Resource, ApplicationFactory\n# get the resource facade objects, which provides access to create the site,\n# citation and path lookup methods\n>>> resource: Resource = ApplicationFactory.get_resource()\n# get a mapping from <library ID>_<item key> to entry dictionaries\n>>> entries: Dict[str, Dict[str, Any]] = resource.cite_db.entries\n# get a mapping from item key (sans library ID) to the attachment path\n>>> paths: Dict[str, Path] = resource.zotero_db.item_paths\n# create BetterBibtex citation key to item key mapping\n>>> bib2item: Dict[str, str] = dict(map(\n...     lambda e: (e['citationKey'], e['itemKey']),\n...     entries.values()))\n# get the item key from the citation key\n>>> itemKey: str = bib2item['landesCALAMRComponentALignment2024']\n# get the path using the Zotero DB item key\n>>> paper_path: Path = paths[itemKey]\n>>> print(paper_path)\n# display the paper (needs 'pip install zensols.rend')\n>>> from zensols.rend import ApplicationFactory as RendAppFactory\n>>> RendAppFactory.get_browser_manager()(paper_path)\n```\n\n\n### Configuration File\n\nEither an environment variable `ZOTSITERC` must be set or a `-c` configuration\noption must be given and point to a file to customize how the program works.\nSee the test [configuration file] for an example and inline comments for more\ndetail on how and what can be configured.\n\n\n## Screenshot\n\nAlso see the [live demo].\n\n![Screenshot][screenshot]\n\n\n## Ubuntu and Linux Systems with Python 3.5 or Previous Version\n\nPlease [read this issue](https://github.com/plandes/zotsite/issues/4) if you\nare installing a Ubuntu or any Linux system with Python 3.5 or previous\nversion.\n\n\n## Attribution\n\nThis software uses:\n* Python 3\n* [jQuery] version 3\n* [DataTables] version 1.12\n* [Bootstrap] version 4\n* [Tree View] for Bootstrap\n* [Popper] for tooltips\n* [Copy to Clipboard] function\n\n\n## Todo\n\n* Make the site portion a proper Javascript site.  Right now, all the `min`s\n  are added in the distribution to same directory as\n  the [main navigation/content](resources/site/src/js/zotero.js) file.\n* Use something like zotxt to make this work with a plugin rather than directly\n  against the SQLite DB.\n\n\n## Zotero Plugin Listing\n\nThis is listed as a [plugin] on the Zotero site.\n\n\n## Changelog\n\nAn extensive changelog is available [here](CHANGELOG.md).\n\n\n## Community\n\nPlease star this repository and let me know how and where you use this API.\nContributions as pull requests, feedback and any input is welcome.\n\n\n## License\n\n[MIT License](LICENSE.md)\n\nCopyright (c) 2019 - 2025 Paul Landes\n\n\n<!-- links -->\n[pypi]: https://pypi.org/project/zensols.zotsite/\n[pypi-link]: https://pypi.python.org/pypi/zensols.zotsite\n[pypi-badge]: https://img.shields.io/pypi/v/zensols.zotsite.svg\n[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg\n[python311-link]: https://www.python.org/downloads/release/python-3110\n[build-badge]: https://github.com/plandes/zotsite/workflows/CI/badge.svg\n[build-link]: https://github.com/plandes/zotsite/actions\n[gitter-link]: https://gitter.im/zoterosite/zotsite\n[gitter-badge]: https://badges.gitter.im/zoterosite/gitter.png\n\n[live demo]: https://plandes.github.io/zotsite/demo/index.html\n[screenshot]: https://raw.githubusercontent.com/plandes/zotsite/master/doc/snapshot.png\n\n[Zotero]: https://www.zotero.org\n[jQuery]: https://jquery.com\n[DataTables]: https://datatables.net\n[Bootstrap]: https://getbootstrap.com\n[Tree View]: https://github.com/jonmiles/bootstrap-treeview\n[Popper]: https://popper.js.org\n[plugin]: https://www.zotero.org/support/plugins#website_integration\n[Copy to Clipboard]: https://ourcodeworld.com/articles/read/143/how-to-copy-text-to-clipboard-with-javascript-easily\n[BetterBibtex]: https://github.com/retorquere/zotero-better-bibtex\n[configuration file]: test-resources/zotsite.conf\n[Python regular expression]: https://docs.python.org/3/library/re.html\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This project exports your local Zotero library to a usable HTML website.",
    "version": "1.1.0",
    "project_urls": {
        "Download": "https://github.com/plandes/zotsite/releases/download/v1.1.0/zensols.zotsite-1.1.0-py3-none-any.whl",
        "Homepage": "https://github.com/plandes/zotsite"
    },
    "split_keywords": [
        "tooling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e22358bc90f4500fa8d08b737521e9bb8377bae11e1af4a16b912be1efa354c9",
                "md5": "4a1c058f332e4ab672e016c6320751d0",
                "sha256": "695374f519d2369ad422519f229f11a159f68fb396584ecd657c1cb096af5baf"
            },
            "downloads": -1,
            "filename": "zensols.zotsite-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a1c058f332e4ab672e016c6320751d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 629001,
            "upload_time": "2025-01-11T20:03:09",
            "upload_time_iso_8601": "2025-01-11T20:03:09.128184Z",
            "url": "https://files.pythonhosted.org/packages/e2/23/58bc90f4500fa8d08b737521e9bb8377bae11e1af4a16b912be1efa354c9/zensols.zotsite-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-11 20:03:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plandes",
    "github_project": "zotsite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zensols.zotsite"
}
        
Elapsed time: 0.71754s