dirsql 0.0.14__tar.gz → 0.0.16__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.
Files changed (30) hide show
  1. {dirsql-0.0.14 → dirsql-0.0.16}/.claude/CLAUDE.md +10 -0
  2. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/minor-release.yml +4 -0
  3. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/patch-release.yml +4 -0
  4. {dirsql-0.0.14 → dirsql-0.0.16}/PKG-INFO +1 -1
  5. {dirsql-0.0.14 → dirsql-0.0.16}/pyproject.toml +3 -1
  6. dirsql-0.0.16/python/dirsql/__init__.py +6 -0
  7. dirsql-0.0.16/python/dirsql/_async.py +63 -0
  8. dirsql-0.0.16/src/lib.rs +645 -0
  9. dirsql-0.0.16/tests/integration/test_async_dirsql.py +346 -0
  10. dirsql-0.0.14/src/lib.rs +0 -291
  11. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/pr-monitor.yml +0 -0
  12. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/publish.yml +0 -0
  13. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/python-lint.yml +0 -0
  14. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/python-test.yml +0 -0
  15. {dirsql-0.0.14 → dirsql-0.0.16}/.github/workflows/rust-test.yml +0 -0
  16. {dirsql-0.0.14 → dirsql-0.0.16}/.gitignore +0 -0
  17. {dirsql-0.0.14 → dirsql-0.0.16}/.npmignore +0 -0
  18. {dirsql-0.0.14 → dirsql-0.0.16}/Cargo.lock +0 -0
  19. {dirsql-0.0.14 → dirsql-0.0.16}/Cargo.toml +0 -0
  20. {dirsql-0.0.14 → dirsql-0.0.16}/LICENSE +0 -0
  21. {dirsql-0.0.14 → dirsql-0.0.16}/SUMMARY.md +0 -0
  22. {dirsql-0.0.14 → dirsql-0.0.16}/src/db.rs +0 -0
  23. {dirsql-0.0.14 → dirsql-0.0.16}/src/differ.rs +0 -0
  24. {dirsql-0.0.14 → dirsql-0.0.16}/src/matcher.rs +0 -0
  25. {dirsql-0.0.14 → dirsql-0.0.16}/src/scanner.rs +0 -0
  26. {dirsql-0.0.14 → dirsql-0.0.16}/src/watcher.rs +0 -0
  27. {dirsql-0.0.14 → dirsql-0.0.16}/tests/__init__.py +0 -0
  28. {dirsql-0.0.14 → dirsql-0.0.16}/tests/conftest.py +0 -0
  29. {dirsql-0.0.14 → dirsql-0.0.16}/tests/integration/__init__.py +0 -0
  30. {dirsql-0.0.14 → dirsql-0.0.16}/tests/integration/test_dirsql.py +0 -0
@@ -1,5 +1,15 @@
1
1
  # dirsql Development
2
2
 
3
+ ## Cross-Language Parity
4
+
5
+ dirsql ships SDKs in Rust, Python, and TypeScript. Aim for **complete API parity across all three languages**: same concepts, same capabilities, same naming where possible. Exceptions are allowed for language-idiomatic patterns:
6
+
7
+ - **Python**: `await db.ready()` (method call, not awaitable property). snake_case. Async iterators for event streams.
8
+ - **TypeScript**: `await db.ready` (awaitable property is idiomatic). camelCase. AsyncIterables for event streams.
9
+ - **Rust**: Builder pattern or `db.ready().await`. snake_case. Stream trait for event streams.
10
+
11
+ When adding a feature to one SDK, create beads for the other two. Don't let them drift apart.
12
+
3
13
  ## Scratch Files
4
14
 
5
15
  Write scratch/temporary files to `/tmp` instead of asking permission. Use unique filenames to avoid collisions with other sessions.
@@ -3,6 +3,10 @@ name: Minor Release
3
3
  on:
4
4
  workflow_dispatch:
5
5
 
6
+ permissions:
7
+ contents: write
8
+ id-token: write
9
+
6
10
  jobs:
7
11
  detect-changes:
8
12
  runs-on: ubuntu-latest
@@ -8,6 +8,10 @@ on:
8
8
  branches: [main]
9
9
  workflow_dispatch:
10
10
 
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
11
15
  jobs:
12
16
  check:
13
17
  runs-on: ubuntu-latest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirsql
3
- Version: 0.0.14
3
+ Version: 0.0.16
4
4
  Requires-Dist: pytest>=8 ; extra == 'dev'
5
5
  Requires-Dist: pytest-describe>=2 ; extra == 'dev'
6
6
  Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "dirsql"
7
- version = "0.0.14"
7
+ version = "0.0.16"
8
8
  description = "Ephemeral SQL index over a local directory"
9
9
  license = "MIT"
10
10
  requires-python = ">=3.12"
@@ -36,3 +36,5 @@ exclude = [
36
36
  "AGENTS.md",
37
37
  "justfile",
38
38
  ]
39
+ python-source = "python"
40
+ module-name = "dirsql._dirsql"
@@ -0,0 +1,6 @@
1
+ """dirsql - Ephemeral SQL index over a local directory."""
2
+
3
+ from dirsql._dirsql import DirSQL, Table, RowEvent, __version__
4
+ from dirsql._async import AsyncDirSQL
5
+
6
+ __all__ = ["DirSQL", "Table", "RowEvent", "AsyncDirSQL", "__version__"]
@@ -0,0 +1,63 @@
1
+ """Async wrapper for DirSQL."""
2
+
3
+ import asyncio
4
+
5
+ from dirsql._dirsql import DirSQL
6
+
7
+
8
+ class _WatchStream:
9
+ """Async iterator that polls for file events."""
10
+
11
+ def __init__(self, db):
12
+ self._db = db
13
+ self._started = False
14
+ self._buffer = []
15
+
16
+ def __aiter__(self):
17
+ return self
18
+
19
+ async def __anext__(self):
20
+ if not self._started:
21
+ await asyncio.to_thread(self._db._start_watcher)
22
+ self._started = True
23
+
24
+ while True:
25
+ if self._buffer:
26
+ return self._buffer.pop(0)
27
+ events = await asyncio.to_thread(self._db._poll_events, 200)
28
+ if events:
29
+ self._buffer.extend(events)
30
+
31
+
32
+ class AsyncDirSQL:
33
+ """Async wrapper around DirSQL.
34
+
35
+ Usage:
36
+ db = await AsyncDirSQL(root, tables=[...])
37
+ results = await db.query("SELECT ...")
38
+ async for event in db.watch():
39
+ ...
40
+ """
41
+
42
+ def __init__(self, root, *, tables, ignore=None):
43
+ self._root = root
44
+ self._tables = tables
45
+ self._ignore = ignore
46
+ self._db = None
47
+
48
+ def __await__(self):
49
+ return self._init().__await__()
50
+
51
+ async def _init(self):
52
+ self._db = await asyncio.to_thread(
53
+ DirSQL, self._root, tables=self._tables, ignore=self._ignore
54
+ )
55
+ return self
56
+
57
+ async def query(self, sql):
58
+ """Execute a SQL query asynchronously."""
59
+ return await asyncio.to_thread(self._db.query, sql)
60
+
61
+ def watch(self):
62
+ """Start watching for file changes. Returns an async iterable of RowEvent."""
63
+ return _WatchStream(self._db)