litdb 2.1.1__tar.gz → 2.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: litdb
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "litdb"
10
- version = "2.1.1"
10
+ version = "2.1.2"
11
11
  authors = [
12
12
  {name = "John Kitchin", email = "jkitchin@andrew.cmu.edu"},
13
13
  ]
@@ -61,7 +61,7 @@ dependencies = [
61
61
  "webvtt-py",
62
62
 
63
63
  # the streamlit app
64
- "streamlit"
64
+ "streamlit"
65
65
  ]
66
66
 
67
67
  [project.scripts]
@@ -1203,10 +1203,13 @@ def bibtex(sources):
1203
1203
  sources = sys.stdin.read().strip().split()
1204
1204
 
1205
1205
  for source in sources:
1206
- (work,) = db.execute(
1206
+ work = db.execute(
1207
1207
  """select extra from sources where source = ?""", (source,)
1208
1208
  ).fetchone()
1209
- richprint(dump_bibtex(json.loads(work)))
1209
+ if work:
1210
+ richprint(dump_bibtex(json.loads(work[0])))
1211
+ else:
1212
+ print(f"No entry found for {source}")
1210
1213
 
1211
1214
 
1212
1215
  @cli.command()
@@ -1483,5 +1486,14 @@ def app():
1483
1486
  os.system(f"streamlit run {app}")
1484
1487
 
1485
1488
 
1489
+ @cli.command()
1490
+ def version():
1491
+ """Print the version of litdb."""
1492
+ import pkg_resources
1493
+
1494
+ version = pkg_resources.get_distribution("litdb").version
1495
+ print(f"Litdb: version {version}")
1496
+
1497
+
1486
1498
  if __name__ == "__main__":
1487
1499
  cli()
@@ -1,3 +1,5 @@
1
+ """Utility functions used in litdb."""
2
+
1
3
  import os
2
4
  from pathlib import Path
3
5
  import sys
@@ -7,7 +9,9 @@ import tomlkit
7
9
 
8
10
  def find_root_directory(rootfile="litdb.toml"):
9
11
  """Search upwards for rootfile.
10
- Returns the root directory, or the current directory if one is not found."""
12
+
13
+ Returns the root directory, or the current directory if one is not found.
14
+ """
11
15
  wd = Path.cwd()
12
16
  while wd != Path("/"):
13
17
  if (wd / rootfile).exists():
@@ -19,7 +23,9 @@ def find_root_directory(rootfile="litdb.toml"):
19
23
 
20
24
  def init_litdb():
21
25
  """Initialize litdb in the current directory.
22
- This just creates the config."""
26
+
27
+ This just creates the config.
28
+ """
23
29
  email = input("Email address: ")
24
30
  api_key = input("OpenAlex API key (Enter if None): ")
25
31
 
@@ -48,7 +54,6 @@ def get_config():
48
54
  1. There is a root / litdb.toml
49
55
  2. There is a LITDB_ROOT/litdb.toml
50
56
  """
51
-
52
57
  CONFIG = "litdb.toml"
53
58
  root = find_root_directory()
54
59
  if (root / CONFIG).exists():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: litdb
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes