bibdeskparser 0.1.0__tar.gz → 0.2.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.
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/PKG-INFO +31 -3
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/README.md +28 -2
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/pyproject.toml +9 -2
- bibdeskparser-0.2.0/src/bibdeskparser/__init__.py +40 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/bdskfile.py +8 -8
- bibdeskparser-0.2.0/src/bibdeskparser/cli.py +922 -0
- bibdeskparser-0.2.0/src/bibdeskparser/config.py +753 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/editing.py +126 -51
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/entry.py +237 -217
- bibdeskparser-0.2.0/src/bibdeskparser/entrytypes.py +554 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/exporting.py +4 -4
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/groups.py +43 -1
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/header.py +5 -5
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/library.py +808 -195
- bibdeskparser-0.2.0/src/bibdeskparser/macros.py +204 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/middleware.py +5 -5
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/render.py +10 -10
- bibdeskparser-0.2.0/src/bibdeskparser/search.py +297 -0
- bibdeskparser-0.2.0/src/bibdeskparser/specifiers.py +1282 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/writer.py +3 -3
- bibdeskparser-0.1.0/src/bibdeskparser/__init__.py +0 -23
- bibdeskparser-0.1.0/src/bibdeskparser/macros.py +0 -109
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/names.py +0 -0
- {bibdeskparser-0.1.0 → bibdeskparser-0.2.0}/src/bibdeskparser/texmap.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: bibdeskparser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Parser for Bibdesk database files
|
|
5
5
|
Author: Michael Goerz
|
|
6
6
|
Author-email: Michael Goerz <mail@michaelgoerz.net>
|
|
@@ -15,6 +15,8 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
17
|
Requires-Dist: bibtexparser==2.0.0b9
|
|
18
|
+
Requires-Dist: click>=8
|
|
19
|
+
Requires-Dist: tomli>=1.1.0 ; python_full_version < '3.11'
|
|
18
20
|
Requires-Dist: pyobjc-framework-cocoa ; sys_platform == 'darwin' and extra == 'macos'
|
|
19
21
|
Requires-Python: >=3.10
|
|
20
22
|
Project-URL: Homepage, https://github.com/goerz/bibdeskparser
|
|
@@ -24,7 +26,7 @@ Description-Content-Type: text/markdown
|
|
|
24
26
|
# BibDeskParser
|
|
25
27
|
|
|
26
28
|
[][Github]
|
|
27
|
-
[](https://pypi.python.org/pypi/bibdeskparser)
|
|
28
30
|
[][docs]
|
|
29
31
|
[](https://github.com/goerz/bibdeskparser/actions/workflows/docs.yml)
|
|
30
32
|
[](https://github.com/goerz/bibdeskparser/actions/workflows/test.yml)
|
|
@@ -66,6 +68,16 @@ library directly in Python -- for batch edits, automation, or
|
|
|
66
68
|
integration with other tools. It provides a simplified API on top
|
|
67
69
|
of the [BibtexParser][] library.
|
|
68
70
|
|
|
71
|
+
Making the bibliographic database accessible to AI coding agents is an
|
|
72
|
+
explicit goal of the project: the [`bibdeskparser` command-line
|
|
73
|
+
tool][cli] mirrors the public Python API, so any agent that can run
|
|
74
|
+
shell commands can inspect and edit a BibDesk library, with no
|
|
75
|
+
dedicated integration and no server to keep running. See [How to give
|
|
76
|
+
an AI coding agent access to your library][howto-ai].
|
|
77
|
+
|
|
78
|
+
[cli]: https://goerz.github.io/bibdeskparser/cli.html
|
|
79
|
+
[howto-ai]: https://goerz.github.io/bibdeskparser/howto.html#how-to-give-an-ai-coding-agent-access-to-your-library
|
|
80
|
+
|
|
69
81
|
|
|
70
82
|
## Installation
|
|
71
83
|
|
|
@@ -75,12 +87,20 @@ To install the latest released version of BibDeskParser:
|
|
|
75
87
|
pip install bibdeskparser
|
|
76
88
|
```
|
|
77
89
|
|
|
78
|
-
|
|
90
|
+
If you use [uv](https://docs.astral.sh/uv/), add BibDeskParser as a
|
|
91
|
+
dependency of your project with
|
|
79
92
|
|
|
80
93
|
```
|
|
81
94
|
uv add bibdeskparser
|
|
82
95
|
```
|
|
83
96
|
|
|
97
|
+
or install the `bibdeskparser` [command-line tool][cli] on your `PATH`,
|
|
98
|
+
independently of any project, with
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
uv tool install bibdeskparser
|
|
102
|
+
```
|
|
103
|
+
|
|
84
104
|
|
|
85
105
|
To install the latest development version from [Github][]:
|
|
86
106
|
|
|
@@ -137,6 +157,14 @@ make develop
|
|
|
137
157
|
|
|
138
158
|
to create a virtual environment with all development dependencies. Run `make help` for an overview of available targets, and see [CONTRIBUTING.md][] for full contributing guidelines.
|
|
139
159
|
|
|
160
|
+
To put the `bibdeskparser` [command-line tool][cli] on your `PATH` as an *editable* install that links back to your working copy — so changes to the source take effect without reinstalling — run
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
make install
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use `make uninstall` to remove it again.
|
|
167
|
+
|
|
140
168
|
[BibDesk]: https://bibdesk.sourceforge.io
|
|
141
169
|
[BibTeX]: https://en.wikipedia.org/wiki/BibTeX
|
|
142
170
|
[BibtexParser]: https://bibtexparser.readthedocs.io/en/main/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# BibDeskParser
|
|
2
2
|
|
|
3
3
|
[][Github]
|
|
4
|
-
[](https://pypi.python.org/pypi/bibdeskparser)
|
|
5
5
|
[][docs]
|
|
6
6
|
[](https://github.com/goerz/bibdeskparser/actions/workflows/docs.yml)
|
|
7
7
|
[](https://github.com/goerz/bibdeskparser/actions/workflows/test.yml)
|
|
@@ -43,6 +43,16 @@ library directly in Python -- for batch edits, automation, or
|
|
|
43
43
|
integration with other tools. It provides a simplified API on top
|
|
44
44
|
of the [BibtexParser][] library.
|
|
45
45
|
|
|
46
|
+
Making the bibliographic database accessible to AI coding agents is an
|
|
47
|
+
explicit goal of the project: the [`bibdeskparser` command-line
|
|
48
|
+
tool][cli] mirrors the public Python API, so any agent that can run
|
|
49
|
+
shell commands can inspect and edit a BibDesk library, with no
|
|
50
|
+
dedicated integration and no server to keep running. See [How to give
|
|
51
|
+
an AI coding agent access to your library][howto-ai].
|
|
52
|
+
|
|
53
|
+
[cli]: https://goerz.github.io/bibdeskparser/cli.html
|
|
54
|
+
[howto-ai]: https://goerz.github.io/bibdeskparser/howto.html#how-to-give-an-ai-coding-agent-access-to-your-library
|
|
55
|
+
|
|
46
56
|
|
|
47
57
|
## Installation
|
|
48
58
|
|
|
@@ -52,12 +62,20 @@ To install the latest released version of BibDeskParser:
|
|
|
52
62
|
pip install bibdeskparser
|
|
53
63
|
```
|
|
54
64
|
|
|
55
|
-
|
|
65
|
+
If you use [uv](https://docs.astral.sh/uv/), add BibDeskParser as a
|
|
66
|
+
dependency of your project with
|
|
56
67
|
|
|
57
68
|
```
|
|
58
69
|
uv add bibdeskparser
|
|
59
70
|
```
|
|
60
71
|
|
|
72
|
+
or install the `bibdeskparser` [command-line tool][cli] on your `PATH`,
|
|
73
|
+
independently of any project, with
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
uv tool install bibdeskparser
|
|
77
|
+
```
|
|
78
|
+
|
|
61
79
|
|
|
62
80
|
To install the latest development version from [Github][]:
|
|
63
81
|
|
|
@@ -114,6 +132,14 @@ make develop
|
|
|
114
132
|
|
|
115
133
|
to create a virtual environment with all development dependencies. Run `make help` for an overview of available targets, and see [CONTRIBUTING.md][] for full contributing guidelines.
|
|
116
134
|
|
|
135
|
+
To put the `bibdeskparser` [command-line tool][cli] on your `PATH` as an *editable* install that links back to your working copy — so changes to the source take effect without reinstalling — run
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
make install
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use `make uninstall` to remove it again.
|
|
142
|
+
|
|
117
143
|
[BibDesk]: https://bibdesk.sourceforge.io
|
|
118
144
|
[BibTeX]: https://en.wikipedia.org/wiki/BibTeX
|
|
119
145
|
[BibtexParser]: https://bibtexparser.readthedocs.io/en/main/
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bibdeskparser"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Parser for Bibdesk database files"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -23,7 +23,14 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.13",
|
|
24
24
|
"Programming Language :: Python :: 3.14",
|
|
25
25
|
]
|
|
26
|
-
dependencies = [
|
|
26
|
+
dependencies = [
|
|
27
|
+
"bibtexparser==2.0.0b9",
|
|
28
|
+
"click>=8",
|
|
29
|
+
"tomli>=1.1.0; python_version < '3.11'",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
bibdeskparser = "bibdeskparser.cli:main"
|
|
27
34
|
|
|
28
35
|
[project.optional-dependencies]
|
|
29
36
|
macos = ["pyobjc-framework-Cocoa; sys_platform == 'darwin'"]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Parser for [BibDesk](https://bibdesk.sourceforge.io) `.bib` files.
|
|
2
|
+
|
|
3
|
+
This package builds on [bibtexparser](
|
|
4
|
+
https://bibtexparser.readthedocs.io/en/main/) to read and write BibTeX
|
|
5
|
+
databases as maintained by the BibDesk application.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from importlib.metadata import version
|
|
9
|
+
|
|
10
|
+
from . import config as _config
|
|
11
|
+
from .entry import Entry
|
|
12
|
+
from .library import Library, StaleFileError
|
|
13
|
+
from .macros import MacroString, ValueString
|
|
14
|
+
|
|
15
|
+
__version__ = version("bibdeskparser")
|
|
16
|
+
|
|
17
|
+
# Load any bibdeskparser.toml from the current working directory or the
|
|
18
|
+
# XDG location once, at import. Wrapped so that a malformed config file
|
|
19
|
+
# can never prevent `import bibdeskparser`; it surfaces as a warning and
|
|
20
|
+
# the built-in defaults are used instead. A `Library` re-applies the
|
|
21
|
+
# configuration for its own directory when constructed.
|
|
22
|
+
try:
|
|
23
|
+
_config.active.load()
|
|
24
|
+
# pylint: disable-next=broad-except
|
|
25
|
+
except Exception as _exc: # pragma: no cover - config must not break import
|
|
26
|
+
import warnings as _warnings
|
|
27
|
+
|
|
28
|
+
_warnings.warn(f"failed to load bibdeskparser.toml: {_exc}", UserWarning)
|
|
29
|
+
del _warnings
|
|
30
|
+
|
|
31
|
+
# All members whose name does not start with an underscore must be listed
|
|
32
|
+
# either in __all__ or in __private__
|
|
33
|
+
__all__ = [
|
|
34
|
+
"Library",
|
|
35
|
+
"Entry",
|
|
36
|
+
"ValueString",
|
|
37
|
+
"MacroString",
|
|
38
|
+
"StaleFileError",
|
|
39
|
+
]
|
|
40
|
+
__private__ = []
|
|
@@ -52,7 +52,7 @@ class BibDeskFile:
|
|
|
52
52
|
relative to the current working directory); defaults to the
|
|
53
53
|
current working directory.
|
|
54
54
|
* `must_exist`: whether to require `path` to point to an existing
|
|
55
|
-
file (raising {
|
|
55
|
+
file (raising {exc}`FileNotFoundError` otherwise). With
|
|
56
56
|
`must_exist=False`, a nonexistent `path` yields a path-only
|
|
57
57
|
attachment, without a bookmark and without any warning.
|
|
58
58
|
|
|
@@ -60,10 +60,10 @@ class BibDeskFile:
|
|
|
60
60
|
`None` and the file exists, a bookmark is created automatically on
|
|
61
61
|
macOS (requires `pyobjc-framework-Cocoa`). Where a bookmark cannot
|
|
62
62
|
be created, the instance falls back to a path-only attachment with
|
|
63
|
-
a {
|
|
63
|
+
a {exc}`UserWarning` (BibDesk will generate a bookmark on its
|
|
64
64
|
next save).
|
|
65
65
|
|
|
66
|
-
Use {
|
|
66
|
+
Use {meth}`from_field_value` and {meth}`to_field_value` to
|
|
67
67
|
convert from and to the string value of a `bdsk-file-N` field:
|
|
68
68
|
|
|
69
69
|
```python
|
|
@@ -244,20 +244,20 @@ def bookmark_for_path(path: str) -> bytes:
|
|
|
244
244
|
includingResourceValuesForKeys:nil relativeToURL:nil error:NULL]`
|
|
245
245
|
via pyobjc, replicating exactly the Cocoa API BibDesk uses
|
|
246
246
|
(`BDSKBookmarkLinkedFile.initWithURL:delegate:`). The resulting
|
|
247
|
-
bytes go into {
|
|
247
|
+
bytes go into {attr}`BibDeskFile.bookmark`. The file must exist
|
|
248
248
|
on disk.
|
|
249
249
|
|
|
250
250
|
Requires macOS and `pyobjc-framework-Cocoa` (install
|
|
251
251
|
`bibdeskparser[macos]`). For cross-platform code, use
|
|
252
|
-
{
|
|
252
|
+
{class}`BibDeskFile` directly; it falls back to a path-only
|
|
253
253
|
entry where bookmarks are unavailable (BibDesk auto-creates the
|
|
254
254
|
bookmark on its next save).
|
|
255
255
|
|
|
256
256
|
Raises:
|
|
257
257
|
|
|
258
|
-
* {
|
|
259
|
-
* {
|
|
260
|
-
* {
|
|
258
|
+
* {exc}`NotImplementedError`: on platforms other than macOS.
|
|
259
|
+
* {exc}`ImportError`: if pyobjc is not installed.
|
|
260
|
+
* {exc}`OSError`: if Cocoa fails to create the bookmark
|
|
261
261
|
(e.g., because the file does not exist).
|
|
262
262
|
"""
|
|
263
263
|
if sys.platform != "darwin":
|