litdb 2.0.0__tar.gz → 2.0.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.1
2
2
  Name: litdb
3
- Version: 2.0.0
3
+ Version: 2.0.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>
@@ -57,7 +57,14 @@ The idea is you add papers to your database, and then you can search it with nat
57
57
 
58
58
  ** installation
59
59
 
60
- Eventually there will be a package on pypi. Until then, you should be able to install litdb with this command.
60
+ litdb is on PyPi.
61
+
62
+ #+BEGIN_SRC sh
63
+ pip install litdb
64
+ #+END_SRC
65
+
66
+
67
+ To get the cutting edge package, you can install it directly from GitHUB.
61
68
 
62
69
  #+BEGIN_SRC sh
63
70
  pip install git+https://github.com/jkitchin/litdb
@@ -20,7 +20,14 @@ The idea is you add papers to your database, and then you can search it with nat
20
20
 
21
21
  ** installation
22
22
 
23
- Eventually there will be a package on pypi. Until then, you should be able to install litdb with this command.
23
+ litdb is on PyPi.
24
+
25
+ #+BEGIN_SRC sh
26
+ pip install litdb
27
+ #+END_SRC
28
+
29
+
30
+ To get the cutting edge package, you can install it directly from GitHUB.
24
31
 
25
32
  #+BEGIN_SRC sh
26
33
  pip install git+https://github.com/jkitchin/litdb
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "litdb"
10
- version = "2.0.0"
10
+ version = "2.0.2"
11
11
  authors = [
12
12
  {name = "John Kitchin", email = "jkitchin@andrew.cmu.edu"},
13
13
  ]
@@ -58,3 +58,6 @@ litdb = "litdb.cli:cli"
58
58
 
59
59
  [project.urls]
60
60
  Homepage = "https://github.com/jkitchin/litdb"
61
+
62
+
63
+ # (shell-command "uv build & uv publish")
@@ -54,7 +54,12 @@ def cli():
54
54
  def init():
55
55
  """Initialize a litdb directory in the current working directory."""
56
56
  init_litdb()
57
- print(f"Initialized in {os.getcwd()}")
57
+ db = get_db()
58
+
59
+ with click.Context(about) as ctx:
60
+ ctx.invoke(about)
61
+
62
+ return db
58
63
 
59
64
 
60
65
  #################
@@ -23,7 +23,6 @@ from litdb.bibtex import dump_bibtex
23
23
 
24
24
  def get_db():
25
25
  """Get or create the database."""
26
-
27
26
  config = get_config()
28
27
 
29
28
  root = Path(config["root"])
@@ -4,6 +4,8 @@ import os
4
4
  import readline
5
5
  import subprocess
6
6
 
7
+ from IPython import embed
8
+ from traitlets.config import Config
7
9
  import numpy as np
8
10
  import ollama
9
11
  from rich import print as richprint
@@ -71,7 +73,7 @@ The following subcommands can be used:
71
73
  os.system(prompt[1:].strip())
72
74
  continue
73
75
 
74
- # a little sub-language of commands
76
+ # a little sub-language of commands
75
77
  elif prompt == "!save":
76
78
  with open(input("Filename (chat.txt): ") or "chat.txt", "w") as f:
77
79
  for message in messages:
@@ -102,7 +104,8 @@ The following subcommands can be used:
102
104
  # RAG by vector search
103
105
  emb = model.encode([prompt]).astype(np.float32).tobytes()
104
106
  data = db.execute(
105
- """select sources.text, json_extract(sources.extra, '$.citation')
107
+ """\
108
+ select sources.text, json_extract(sources.extra, '$.citation')
106
109
  from vector_top_k('embedding_idx', ?, 3)
107
110
  join sources on sources.rowid = id""",
108
111
  (emb,),
@@ -18,6 +18,8 @@ def find_root_directory(rootfile="litdb.toml"):
18
18
 
19
19
 
20
20
  def init_litdb():
21
+ """Initialize litdb in the current directory.
22
+ This just creates the config."""
21
23
  email = input("Email address: ")
22
24
  api_key = input("OpenAlex API key (Enter if None): ")
23
25
 
@@ -40,18 +42,26 @@ def init_litdb():
40
42
 
41
43
 
42
44
  def get_config():
43
- "Return the config dictionary."
45
+ """Return the config dictionary.
44
46
 
45
- root = os.environ.get("LITDB_ROOT")
46
- if root:
47
- root = Path(root)
48
- else:
49
- root = find_root_directory()
47
+ Priority:
48
+ 1. There is a root / litdb.toml
49
+ 2. There is a LITDB_ROOT/litdb.toml
50
+ """
50
51
 
51
52
  CONFIG = "litdb.toml"
52
-
53
- # if you don't find a litdb.toml you might not be in a litdb root. We check for
54
- # an env var next so that litdb works everywhere.
53
+ root = find_root_directory()
54
+ if (root / CONFIG).exists():
55
+ pass
56
+ else:
57
+ root = os.environ.get("LITDB_ROOT")
58
+ if root:
59
+ root = Path(root)
60
+ if (root / CONFIG).exists():
61
+ pass
62
+
63
+ # if you don't find a litdb.toml you might not be in a litdb root. We check
64
+ # for an env var next so that litdb works everywhere.
55
65
  if not (root / CONFIG).exists():
56
66
  print('No config found. You need to run "litdb init"')
57
67
  sys.exit()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: litdb
3
- Version: 2.0.0
3
+ Version: 2.0.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>
@@ -57,7 +57,14 @@ The idea is you add papers to your database, and then you can search it with nat
57
57
 
58
58
  ** installation
59
59
 
60
- Eventually there will be a package on pypi. Until then, you should be able to install litdb with this command.
60
+ litdb is on PyPi.
61
+
62
+ #+BEGIN_SRC sh
63
+ pip install litdb
64
+ #+END_SRC
65
+
66
+
67
+ To get the cutting edge package, you can install it directly from GitHUB.
61
68
 
62
69
  #+BEGIN_SRC sh
63
70
  pip install git+https://github.com/jkitchin/litdb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes