pyzotero-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyzotero_cli-0.1.0/PKG-INFO +214 -0
- pyzotero_cli-0.1.0/README.md +199 -0
- pyzotero_cli-0.1.0/pyproject.toml +28 -0
- pyzotero_cli-0.1.0/pyzotero_cli/__init__.py +1 -0
- pyzotero_cli-0.1.0/pyzotero_cli/collection_cmds.py +521 -0
- pyzotero_cli-0.1.0/pyzotero_cli/file_cmds.py +245 -0
- pyzotero_cli-0.1.0/pyzotero_cli/fulltext_cmds.py +176 -0
- pyzotero_cli-0.1.0/pyzotero_cli/group_cmds.py +81 -0
- pyzotero_cli-0.1.0/pyzotero_cli/item_cmds.py +615 -0
- pyzotero_cli-0.1.0/pyzotero_cli/search_cmds.py +139 -0
- pyzotero_cli-0.1.0/pyzotero_cli/tag_cmds.py +97 -0
- pyzotero_cli-0.1.0/pyzotero_cli/util_cmds.py +152 -0
- pyzotero_cli-0.1.0/pyzotero_cli/utils.py +442 -0
- pyzotero_cli-0.1.0/pyzotero_cli/zot_cli.py +341 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/PKG-INFO +214 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/SOURCES.txt +28 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/dependency_links.txt +1 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/entry_points.txt +2 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/requires.txt +9 -0
- pyzotero_cli-0.1.0/pyzotero_cli.egg-info/top_level.txt +1 -0
- pyzotero_cli-0.1.0/setup.cfg +4 -0
- pyzotero_cli-0.1.0/tests/test_collection_cmds.py +827 -0
- pyzotero_cli-0.1.0/tests/test_file_cmds.py +351 -0
- pyzotero_cli-0.1.0/tests/test_fulltext_cmds.py +471 -0
- pyzotero_cli-0.1.0/tests/test_group_cmds.py +179 -0
- pyzotero_cli-0.1.0/tests/test_item_cmds.py +533 -0
- pyzotero_cli-0.1.0/tests/test_search_cmds.py +386 -0
- pyzotero_cli-0.1.0/tests/test_tag_cmds.py +242 -0
- pyzotero_cli-0.1.0/tests/test_util_cmds.py +226 -0
- pyzotero_cli-0.1.0/tests/test_zot_cli.py +277 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyzotero-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI wrapper for pyzotero
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: click>=8.2.0
|
|
8
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
9
|
+
Requires-Dist: pyzotero>=1.6.11
|
|
10
|
+
Requires-Dist: tabulate>=0.9.0
|
|
11
|
+
Requires-Dist: pytest>=7.0
|
|
12
|
+
Requires-Dist: python-dotenv>=1.1.0
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
15
|
+
|
|
16
|
+
# pyzotero-cli
|
|
17
|
+
|
|
18
|
+
[](https://badge.fury.io/py/pyzotero-cli)
|
|
19
|
+

|
|
20
|
+
[](https://opensource.org/licenses/MIT)
|
|
21
|
+
<!-- [](https://github.com/chriscarrollsmith/pyzotero-cli/actions/workflows/python-package.yml) -->
|
|
22
|
+
|
|
23
|
+
`pyzotero-cli` is a powerful command-line interface (CLI) for interacting with your Zotero library. It acts as a wrapper around the excellent [pyzotero](https://github.com/zotero/pyzotero) library, exposing its rich functionality directly to your terminal.
|
|
24
|
+
|
|
25
|
+
This tool is designed for users who prefer a command-line workflow, for scripting Zotero interactions, or for integration with other tools and AI agents that can leverage shell commands.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
* **Comprehensive Zotero API Coverage:** Manage items, collections, tags, attachments, saved searches, full-text content, and groups.
|
|
30
|
+
* **Flexible Configuration:**
|
|
31
|
+
* Support for multiple profiles.
|
|
32
|
+
* Configuration via interactive setup, environment variables, or direct CLI flags.
|
|
33
|
+
* Option to use a local Zotero instance (read-only).
|
|
34
|
+
* **Multiple Output Formats:** Get data as JSON (default), YAML, or user-friendly tables. Also supports `keys` output for easy piping.
|
|
35
|
+
* **Rich Querying Capabilities:**
|
|
36
|
+
* Pagination (`--limit`, `--start`).
|
|
37
|
+
* Sorting (`--sort`, `--direction`).
|
|
38
|
+
* Filtering (`--query`, `--filter-tag`, `--filter-item-type`).
|
|
39
|
+
* Versioning/Syncing (`--since`).
|
|
40
|
+
* **Full CRUD Operations:** Create, Read, Update, and Delete various Zotero entities.
|
|
41
|
+
* **File Management:** Download and upload attachments.
|
|
42
|
+
* **Utility Commands:** Access API key info, library versions, item type definitions, and more.
|
|
43
|
+
|
|
44
|
+
## Why `pyzotero-cli`?
|
|
45
|
+
|
|
46
|
+
* **Automation & Scripting:** Easily integrate Zotero operations into your shell scripts and automated workflows.
|
|
47
|
+
* **Terminal Power Users:** Manage your Zotero library without leaving the command line.
|
|
48
|
+
* **AI Agent Integration:** Designed to be easily consumable by AI systems with Bash/shell execution capabilities.
|
|
49
|
+
* **Focused Interface:** Provides direct access to `pyzotero` features in a command-line paradigm.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
`pyzotero-cli` requires Python 3.10 or higher.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install pyzotero-cli
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Before you can use `pyzotero-cli` to interact with your Zotero library (unless using the `--local` flag for a local Zotero instance), you need to configure it with your Zotero API key and library details.
|
|
62
|
+
|
|
63
|
+
The easiest way to get started is with the interactive setup:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
zot configure setup
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This will guide you through setting up a default profile, asking for:
|
|
70
|
+
* **Zotero Library ID:** Your Zotero User ID (for personal libraries) or Group ID.
|
|
71
|
+
* **Library Type:** `user` or `group`.
|
|
72
|
+
* **Zotero API Key:** Generate one from your Zotero account settings ([Feeds/API page](https://www.zotero.org/settings/keys)).
|
|
73
|
+
* **Use local Zotero instance:** Whether to connect to a running Zotero desktop client locally (read-only).
|
|
74
|
+
* **Locale:** Defaults to `en-US`.
|
|
75
|
+
|
|
76
|
+
Configuration is stored in `~/.config/zotcli/config.ini`.
|
|
77
|
+
|
|
78
|
+
### Profiles
|
|
79
|
+
|
|
80
|
+
You can manage multiple configurations using profiles:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Set up a new profile named 'work_group'
|
|
84
|
+
zot configure setup --profile work_group
|
|
85
|
+
|
|
86
|
+
# List available profiles
|
|
87
|
+
zot configure list-profiles
|
|
88
|
+
|
|
89
|
+
# Set the default active profile
|
|
90
|
+
zot configure current-profile work_group
|
|
91
|
+
|
|
92
|
+
# Use a specific profile for a single command
|
|
93
|
+
zot --profile work_group items list
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Configuration Precedence
|
|
97
|
+
|
|
98
|
+
The CLI respects the following order of precedence for configuration settings:
|
|
99
|
+
1. Command-line flags (e.g., `--api-key`, `--library-id`).
|
|
100
|
+
2. Environment variables (e.g., `ZOTERO_API_KEY`, `ZOTERO_LIBRARY_ID`, `ZOTERO_LIBRARY_TYPE`).
|
|
101
|
+
3. Active profile in `~/.config/zotcli/config.ini`.
|
|
102
|
+
|
|
103
|
+
## Basic Usage
|
|
104
|
+
|
|
105
|
+
Once configured, you can interact with your library using the `zot` command.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# List the 5 most recently modified items (default JSON output)
|
|
109
|
+
zot items list --limit 5
|
|
110
|
+
|
|
111
|
+
# Get details for a specific item (replace <ITEM_KEY> with an actual key)
|
|
112
|
+
zot items get <ITEM_KEY>
|
|
113
|
+
|
|
114
|
+
# List top-level collections in a table format
|
|
115
|
+
zot collections list --top --output table
|
|
116
|
+
|
|
117
|
+
# Get help for the 'items' command group
|
|
118
|
+
zot items --help
|
|
119
|
+
|
|
120
|
+
# Get help for a specific subcommand
|
|
121
|
+
zot items create --help
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Command Overview
|
|
125
|
+
|
|
126
|
+
`pyzotero-cli` is organized into several command groups:
|
|
127
|
+
|
|
128
|
+
* `items`: Manage library items (books, articles, etc.).
|
|
129
|
+
* `list`, `get`, `create`, `update`, `delete`, `add-tags`, `children`, `count`, `versions`, `bib`, `citation`.
|
|
130
|
+
* `collections`: Manage collections.
|
|
131
|
+
* `list`, `get`, `create`, `update`, `delete`, `items`, `item-count`, `versions`, `add-item`, `remove-item`, `tags`.
|
|
132
|
+
* `tags`: Manage tags.
|
|
133
|
+
* `list`, `list-for-item`, `delete`.
|
|
134
|
+
* `files`: Manage file attachments.
|
|
135
|
+
* `download`, `upload`, `upload-batch`.
|
|
136
|
+
* `search`: Manage saved searches.
|
|
137
|
+
* `list`, `create`, `delete`.
|
|
138
|
+
* `fulltext`: Work with full-text content of attachments.
|
|
139
|
+
* `get`, `list-new`, `set`.
|
|
140
|
+
* `groups`: List accessible groups.
|
|
141
|
+
* `list`.
|
|
142
|
+
* `util`: Utility and informational commands.
|
|
143
|
+
* `key-info`, `last-modified-version`, `item-types`, `item-fields`, `item-type-fields`, `item-template`.
|
|
144
|
+
* `configure`: Manage CLI configuration and profiles.
|
|
145
|
+
* `setup`, `set`, `get`, `list-profiles`, `current-profile`.
|
|
146
|
+
|
|
147
|
+
### Common Options
|
|
148
|
+
|
|
149
|
+
Many commands support common options:
|
|
150
|
+
|
|
151
|
+
* `--output <format>`: Set output format (`json`, `yaml`, `table`, `keys`). Default is `json`.
|
|
152
|
+
* `--limit <N>`: Limit the number of results.
|
|
153
|
+
* `--start <N>`: Offset for pagination.
|
|
154
|
+
* `--sort <field>`: Field to sort by (e.g., `dateModified`, `title`).
|
|
155
|
+
* `--direction <asc|desc>`: Sort direction.
|
|
156
|
+
* `--query <term>`: Quick search query.
|
|
157
|
+
* `--qmode <titleCreatorYear|everything>`: Quick search mode.
|
|
158
|
+
* `--filter-tag <tag>`: Filter by tag (can be used multiple times).
|
|
159
|
+
* `--filter-item-type <type>`: Filter by item type.
|
|
160
|
+
* `--since <version>`: Retrieve objects modified after a Zotero library version.
|
|
161
|
+
* `--local`: Use local Zotero instance (read-only, global option for `zot`).
|
|
162
|
+
* `--profile <name>`: Use a specific configuration profile (global option for `zot`).
|
|
163
|
+
* `--verbose`/`-v`, `--debug`: Increase verbosity.
|
|
164
|
+
* `--no-interaction`: Disable interactive prompts (e.g., for confirmations).
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Configure a profile named "personal_lib"
|
|
170
|
+
zot configure setup --profile personal_lib
|
|
171
|
+
# ... follow interactive prompts ...
|
|
172
|
+
|
|
173
|
+
# List 10 most recent journal articles in your personal library, output as a table
|
|
174
|
+
zot --profile personal_lib items list --filter-item-type journalArticle --sort dateModified --direction desc --limit 10 --output table
|
|
175
|
+
|
|
176
|
+
# Create a new book item from a Zotero item template
|
|
177
|
+
zot util item-template book > book_template.json
|
|
178
|
+
# ... edit book_template.json ...
|
|
179
|
+
zot items create --from-json book_template.json
|
|
180
|
+
|
|
181
|
+
# Get all collections containing the word "AI" in their name
|
|
182
|
+
zot collections list --query AI
|
|
183
|
+
|
|
184
|
+
# Download an attachment (replace <ATTACHMENT_KEY> and <PATH_TO_SAVE>)
|
|
185
|
+
zot files download <ATTACHMENT_KEY> -o <PATH_TO_SAVE>/attachment.pdf
|
|
186
|
+
|
|
187
|
+
# Add a tag to an item
|
|
188
|
+
zot items add-tags <ITEM_KEY> "needs-review" "important"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
Contributions are welcome!
|
|
194
|
+
|
|
195
|
+
1. Clone the repository:
|
|
196
|
+
```bash
|
|
197
|
+
git clone https://github.com/chriscarrollsmith/pyzotero-cli.git
|
|
198
|
+
cd pyzotero-cli
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
2. This project uses `uv` for dependency management (see `uv.lock`).
|
|
202
|
+
```bash
|
|
203
|
+
# Create a venv and install dependencies
|
|
204
|
+
uv sync
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
3. Run tests:
|
|
208
|
+
```bash
|
|
209
|
+
uv run pytest
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details (assuming one will be added).
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# pyzotero-cli
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/pyzotero-cli)
|
|
4
|
+

|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
<!-- [](https://github.com/chriscarrollsmith/pyzotero-cli/actions/workflows/python-package.yml) -->
|
|
7
|
+
|
|
8
|
+
`pyzotero-cli` is a powerful command-line interface (CLI) for interacting with your Zotero library. It acts as a wrapper around the excellent [pyzotero](https://github.com/zotero/pyzotero) library, exposing its rich functionality directly to your terminal.
|
|
9
|
+
|
|
10
|
+
This tool is designed for users who prefer a command-line workflow, for scripting Zotero interactions, or for integration with other tools and AI agents that can leverage shell commands.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
* **Comprehensive Zotero API Coverage:** Manage items, collections, tags, attachments, saved searches, full-text content, and groups.
|
|
15
|
+
* **Flexible Configuration:**
|
|
16
|
+
* Support for multiple profiles.
|
|
17
|
+
* Configuration via interactive setup, environment variables, or direct CLI flags.
|
|
18
|
+
* Option to use a local Zotero instance (read-only).
|
|
19
|
+
* **Multiple Output Formats:** Get data as JSON (default), YAML, or user-friendly tables. Also supports `keys` output for easy piping.
|
|
20
|
+
* **Rich Querying Capabilities:**
|
|
21
|
+
* Pagination (`--limit`, `--start`).
|
|
22
|
+
* Sorting (`--sort`, `--direction`).
|
|
23
|
+
* Filtering (`--query`, `--filter-tag`, `--filter-item-type`).
|
|
24
|
+
* Versioning/Syncing (`--since`).
|
|
25
|
+
* **Full CRUD Operations:** Create, Read, Update, and Delete various Zotero entities.
|
|
26
|
+
* **File Management:** Download and upload attachments.
|
|
27
|
+
* **Utility Commands:** Access API key info, library versions, item type definitions, and more.
|
|
28
|
+
|
|
29
|
+
## Why `pyzotero-cli`?
|
|
30
|
+
|
|
31
|
+
* **Automation & Scripting:** Easily integrate Zotero operations into your shell scripts and automated workflows.
|
|
32
|
+
* **Terminal Power Users:** Manage your Zotero library without leaving the command line.
|
|
33
|
+
* **AI Agent Integration:** Designed to be easily consumable by AI systems with Bash/shell execution capabilities.
|
|
34
|
+
* **Focused Interface:** Provides direct access to `pyzotero` features in a command-line paradigm.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
`pyzotero-cli` requires Python 3.10 or higher.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install pyzotero-cli
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
Before you can use `pyzotero-cli` to interact with your Zotero library (unless using the `--local` flag for a local Zotero instance), you need to configure it with your Zotero API key and library details.
|
|
47
|
+
|
|
48
|
+
The easiest way to get started is with the interactive setup:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
zot configure setup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This will guide you through setting up a default profile, asking for:
|
|
55
|
+
* **Zotero Library ID:** Your Zotero User ID (for personal libraries) or Group ID.
|
|
56
|
+
* **Library Type:** `user` or `group`.
|
|
57
|
+
* **Zotero API Key:** Generate one from your Zotero account settings ([Feeds/API page](https://www.zotero.org/settings/keys)).
|
|
58
|
+
* **Use local Zotero instance:** Whether to connect to a running Zotero desktop client locally (read-only).
|
|
59
|
+
* **Locale:** Defaults to `en-US`.
|
|
60
|
+
|
|
61
|
+
Configuration is stored in `~/.config/zotcli/config.ini`.
|
|
62
|
+
|
|
63
|
+
### Profiles
|
|
64
|
+
|
|
65
|
+
You can manage multiple configurations using profiles:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Set up a new profile named 'work_group'
|
|
69
|
+
zot configure setup --profile work_group
|
|
70
|
+
|
|
71
|
+
# List available profiles
|
|
72
|
+
zot configure list-profiles
|
|
73
|
+
|
|
74
|
+
# Set the default active profile
|
|
75
|
+
zot configure current-profile work_group
|
|
76
|
+
|
|
77
|
+
# Use a specific profile for a single command
|
|
78
|
+
zot --profile work_group items list
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Configuration Precedence
|
|
82
|
+
|
|
83
|
+
The CLI respects the following order of precedence for configuration settings:
|
|
84
|
+
1. Command-line flags (e.g., `--api-key`, `--library-id`).
|
|
85
|
+
2. Environment variables (e.g., `ZOTERO_API_KEY`, `ZOTERO_LIBRARY_ID`, `ZOTERO_LIBRARY_TYPE`).
|
|
86
|
+
3. Active profile in `~/.config/zotcli/config.ini`.
|
|
87
|
+
|
|
88
|
+
## Basic Usage
|
|
89
|
+
|
|
90
|
+
Once configured, you can interact with your library using the `zot` command.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# List the 5 most recently modified items (default JSON output)
|
|
94
|
+
zot items list --limit 5
|
|
95
|
+
|
|
96
|
+
# Get details for a specific item (replace <ITEM_KEY> with an actual key)
|
|
97
|
+
zot items get <ITEM_KEY>
|
|
98
|
+
|
|
99
|
+
# List top-level collections in a table format
|
|
100
|
+
zot collections list --top --output table
|
|
101
|
+
|
|
102
|
+
# Get help for the 'items' command group
|
|
103
|
+
zot items --help
|
|
104
|
+
|
|
105
|
+
# Get help for a specific subcommand
|
|
106
|
+
zot items create --help
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Command Overview
|
|
110
|
+
|
|
111
|
+
`pyzotero-cli` is organized into several command groups:
|
|
112
|
+
|
|
113
|
+
* `items`: Manage library items (books, articles, etc.).
|
|
114
|
+
* `list`, `get`, `create`, `update`, `delete`, `add-tags`, `children`, `count`, `versions`, `bib`, `citation`.
|
|
115
|
+
* `collections`: Manage collections.
|
|
116
|
+
* `list`, `get`, `create`, `update`, `delete`, `items`, `item-count`, `versions`, `add-item`, `remove-item`, `tags`.
|
|
117
|
+
* `tags`: Manage tags.
|
|
118
|
+
* `list`, `list-for-item`, `delete`.
|
|
119
|
+
* `files`: Manage file attachments.
|
|
120
|
+
* `download`, `upload`, `upload-batch`.
|
|
121
|
+
* `search`: Manage saved searches.
|
|
122
|
+
* `list`, `create`, `delete`.
|
|
123
|
+
* `fulltext`: Work with full-text content of attachments.
|
|
124
|
+
* `get`, `list-new`, `set`.
|
|
125
|
+
* `groups`: List accessible groups.
|
|
126
|
+
* `list`.
|
|
127
|
+
* `util`: Utility and informational commands.
|
|
128
|
+
* `key-info`, `last-modified-version`, `item-types`, `item-fields`, `item-type-fields`, `item-template`.
|
|
129
|
+
* `configure`: Manage CLI configuration and profiles.
|
|
130
|
+
* `setup`, `set`, `get`, `list-profiles`, `current-profile`.
|
|
131
|
+
|
|
132
|
+
### Common Options
|
|
133
|
+
|
|
134
|
+
Many commands support common options:
|
|
135
|
+
|
|
136
|
+
* `--output <format>`: Set output format (`json`, `yaml`, `table`, `keys`). Default is `json`.
|
|
137
|
+
* `--limit <N>`: Limit the number of results.
|
|
138
|
+
* `--start <N>`: Offset for pagination.
|
|
139
|
+
* `--sort <field>`: Field to sort by (e.g., `dateModified`, `title`).
|
|
140
|
+
* `--direction <asc|desc>`: Sort direction.
|
|
141
|
+
* `--query <term>`: Quick search query.
|
|
142
|
+
* `--qmode <titleCreatorYear|everything>`: Quick search mode.
|
|
143
|
+
* `--filter-tag <tag>`: Filter by tag (can be used multiple times).
|
|
144
|
+
* `--filter-item-type <type>`: Filter by item type.
|
|
145
|
+
* `--since <version>`: Retrieve objects modified after a Zotero library version.
|
|
146
|
+
* `--local`: Use local Zotero instance (read-only, global option for `zot`).
|
|
147
|
+
* `--profile <name>`: Use a specific configuration profile (global option for `zot`).
|
|
148
|
+
* `--verbose`/`-v`, `--debug`: Increase verbosity.
|
|
149
|
+
* `--no-interaction`: Disable interactive prompts (e.g., for confirmations).
|
|
150
|
+
|
|
151
|
+
## Examples
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Configure a profile named "personal_lib"
|
|
155
|
+
zot configure setup --profile personal_lib
|
|
156
|
+
# ... follow interactive prompts ...
|
|
157
|
+
|
|
158
|
+
# List 10 most recent journal articles in your personal library, output as a table
|
|
159
|
+
zot --profile personal_lib items list --filter-item-type journalArticle --sort dateModified --direction desc --limit 10 --output table
|
|
160
|
+
|
|
161
|
+
# Create a new book item from a Zotero item template
|
|
162
|
+
zot util item-template book > book_template.json
|
|
163
|
+
# ... edit book_template.json ...
|
|
164
|
+
zot items create --from-json book_template.json
|
|
165
|
+
|
|
166
|
+
# Get all collections containing the word "AI" in their name
|
|
167
|
+
zot collections list --query AI
|
|
168
|
+
|
|
169
|
+
# Download an attachment (replace <ATTACHMENT_KEY> and <PATH_TO_SAVE>)
|
|
170
|
+
zot files download <ATTACHMENT_KEY> -o <PATH_TO_SAVE>/attachment.pdf
|
|
171
|
+
|
|
172
|
+
# Add a tag to an item
|
|
173
|
+
zot items add-tags <ITEM_KEY> "needs-review" "important"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Development
|
|
177
|
+
|
|
178
|
+
Contributions are welcome!
|
|
179
|
+
|
|
180
|
+
1. Clone the repository:
|
|
181
|
+
```bash
|
|
182
|
+
git clone https://github.com/chriscarrollsmith/pyzotero-cli.git
|
|
183
|
+
cd pyzotero-cli
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
2. This project uses `uv` for dependency management (see `uv.lock`).
|
|
187
|
+
```bash
|
|
188
|
+
# Create a venv and install dependencies
|
|
189
|
+
uv sync
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
3. Run tests:
|
|
193
|
+
```bash
|
|
194
|
+
uv run pytest
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details (assuming one will be added).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pyzotero-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A CLI wrapper for pyzotero"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"click>=8.2.0",
|
|
9
|
+
"pyyaml>=6.0.2",
|
|
10
|
+
"pyzotero>=1.6.11",
|
|
11
|
+
"tabulate>=0.9.0",
|
|
12
|
+
"pytest>=7.0",
|
|
13
|
+
"python-dotenv>=1.1.0",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
dev = [
|
|
18
|
+
"pytest>=8.3.5",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
zot = "pyzotero_cli.zot_cli:zot"
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
include = ["pyzotero_cli"]
|
|
26
|
+
|
|
27
|
+
[tool.uv]
|
|
28
|
+
package = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|