Skip to content

Commit 3e1f6a0

Browse files
authored
Move meta to the top-level (#195)
* Move meta to the top-level * Update README.md * Move pretty snapshots to tests/pretty * Adopt uv + ruff * Regenerate SDKs
1 parent e4408f7 commit 3e1f6a0

110 files changed

Lines changed: 6166 additions & 3259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ jobs:
2828
uv run ruff check
2929
uv run ruff format --check
3030
31+
- name: Lint meta
32+
run: |
33+
cd meta
34+
uv run ruff check
35+
uv run ruff format --check
36+
37+
- name: Test meta with pytest
38+
run: |
39+
cd meta
40+
uv run python -m pytest
41+
42+
- name: Type check meta
43+
run: |
44+
cd meta
45+
uv run pyrefly check
46+
3147
- name: Run tests
3248
run: |
3349
cd python-tools

.gitignore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# Python
1+
# Code generators
2+
meta/build/
3+
meta/src/*.egg-info/
4+
5+
# Proto generated files
6+
/gen
7+
8+
# Python SDK
29
.venv
310
.pytest_cache
411
__pycache__/
@@ -9,15 +16,11 @@ python-tools/out/
916
python-tools/.lsp/.cache
1017
python-tools/.clj-kondo
1118

12-
# Proto generated files
13-
/gen
14-
15-
# Julia
19+
# Julia SDK
1620
julia/LogicalQueryProtocol/Manifest.toml
1721

1822
# Other
1923
.DS_Store
2024
.envrc
2125
.lsp
2226
.clj-kondo
23-

Makefile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PROTO_FILES := \
2626
$(PROTO_DIR)/relationalai/lqp/v1/fragments.proto \
2727
$(PROTO_DIR)/relationalai/lqp/v1/transactions.proto
2828

29-
GRAMMAR := python-tools/src/meta/grammar.y
29+
GRAMMAR := meta/src/meta/grammar.y
3030

3131
# Generated protobuf outputs
3232
PY_PROTO_DIR := python-tools/src/lqp/proto/v1
@@ -42,14 +42,14 @@ GO_PARSER := go/src/parser.go
4242
PY_PRINTER := python-tools/src/lqp/gen/pretty.py
4343

4444
# Parser templates
45-
PY_TEMPLATE := python-tools/src/meta/templates/parser.py.template
46-
JL_TEMPLATE := python-tools/src/meta/templates/parser.jl.template
47-
GO_TEMPLATE := python-tools/src/meta/templates/parser.go.template
45+
PY_TEMPLATE := meta/src/meta/templates/parser.py.template
46+
JL_TEMPLATE := meta/src/meta/templates/parser.jl.template
47+
GO_TEMPLATE := meta/src/meta/templates/parser.go.template
4848

4949
# Printer templates
50-
PY_PRINTER_TEMPLATE := python-tools/src/meta/templates/pretty_printer.py.template
50+
PY_PRINTER_TEMPLATE := meta/src/meta/templates/pretty_printer.py.template
5151

52-
META_CLI := cd python-tools && PYTHONPATH=src uv run python -m meta.cli
52+
META_CLI := cd meta && uv run python -m meta.cli
5353
META_PROTO_ARGS := \
5454
../$(PROTO_DIR)/relationalai/lqp/v1/fragments.proto \
5555
../$(PROTO_DIR)/relationalai/lqp/v1/logic.proto \
@@ -73,7 +73,8 @@ JL_PROTO_GENERATED := \
7373
.PHONY: all protobuf parsers parser-python parser-julia parser-go \
7474
force-parsers force-parser-python force-parser-julia force-parser-go \
7575
printers printer-python force-printers force-printer-python \
76-
test test-python test-python-update-snapshots test-julia test-go check-python \
76+
test test-python test-python-update-snapshots test-julia test-go \
77+
test-meta check-python check-meta lint-meta format-meta \
7778
lint-python format-python clean
7879

7980
all: protobuf parsers printers
@@ -113,7 +114,7 @@ parsers: parser-python parser-julia parser-go
113114

114115
parser-python: $(PY_PARSER)
115116
$(PY_PARSER): $(PROTO_FILES) $(GRAMMAR) $(PY_TEMPLATE)
116-
$(META_CLI) $(META_PROTO_ARGS) --parser python -o src/lqp/gen/parser.py
117+
$(META_CLI) $(META_PROTO_ARGS) --parser python -o ../python-tools/src/lqp/gen/parser.py
117118

118119
parser-julia: $(JL_PARSER)
119120
$(JL_PARSER): $(PROTO_FILES) $(GRAMMAR) $(JL_TEMPLATE)
@@ -126,7 +127,7 @@ $(GO_PARSER): $(PROTO_FILES) $(GRAMMAR) $(GO_TEMPLATE)
126127
force-parsers: force-parser-python force-parser-julia force-parser-go
127128

128129
force-parser-python:
129-
$(META_CLI) $(META_PROTO_ARGS) --parser python -o src/lqp/gen/parser.py
130+
$(META_CLI) $(META_PROTO_ARGS) --parser python -o ../python-tools/src/lqp/gen/parser.py
130131

131132
force-parser-julia:
132133
$(META_CLI) $(META_PROTO_ARGS) --parser julia -o ../julia/LogicalQueryProtocol/src/parser.jl
@@ -140,16 +141,16 @@ printers: printer-python
140141

141142
printer-python: $(PY_PRINTER)
142143
$(PY_PRINTER): $(PROTO_FILES) $(GRAMMAR) $(PY_PRINTER_TEMPLATE)
143-
$(META_CLI) $(META_PROTO_ARGS) --printer python -o src/lqp/gen/pretty.py
144+
$(META_CLI) $(META_PROTO_ARGS) --printer python -o ../python-tools/src/lqp/gen/pretty.py
144145

145146
force-printers: force-printer-python
146147

147148
force-printer-python:
148-
$(META_CLI) $(META_PROTO_ARGS) --printer python -o src/lqp/gen/pretty.py
149+
$(META_CLI) $(META_PROTO_ARGS) --printer python -o ../python-tools/src/lqp/gen/pretty.py
149150

150151
# ---------- testing ----------
151152

152-
test: test-python test-julia test-go
153+
test: test-meta test-python test-julia test-go
153154

154155
test-python: $(PY_PARSER) $(PY_PROTO_GENERATED) check-python
155156
cd python-tools && uv run python -m pytest
@@ -173,6 +174,19 @@ lint-python:
173174
format-python:
174175
cd python-tools && uv run ruff format
175176

177+
test-meta: check-meta
178+
cd meta && uv run python -m pytest
179+
180+
check-meta: lint-meta
181+
cd meta && uv run pyrefly check
182+
183+
lint-meta:
184+
cd meta && uv run ruff check
185+
cd meta && uv run ruff format --check
186+
187+
format-meta:
188+
cd meta && uv run ruff format
189+
176190
# ---------- cleanup ----------
177191

178192
clean:

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ make test
6262
### Updating the SDKs
6363

6464
Changes to the ProtoBuf specification need to be reflected in the language-independent
65-
grammar in `meta/grammar.y`. From the grammar we can automatically derive parsers and pretty
66-
printers for the S-expression representation of LQP, which is used for testing and
67-
debugging.
65+
grammar in `meta/src/meta/grammar.y`. From the grammar we can automatically derive parsers
66+
and pretty printers for the S-expression representation of LQP, which is used for testing
67+
and debugging.
6868

6969
When you have updated the grammar, you can regenerate the parsers and verify that they match
7070
by running
@@ -74,6 +74,8 @@ make parsers
7474
make test
7575
```
7676

77+
The code generators are implemented in `meta/`.
78+
7779
### Release (for Maintainers)
7880

7981
Releasing a new version of the LQP is done by releasing new versions of each of the SDKs.

0 commit comments

Comments
 (0)