Commit 048ad79
Migrate tooling to ruff, ty, and uv (#173)
* Migrate tooling to ruff, ty, and uv
Mirrors the migration done in ord-schema (#780, #783): replaces black /
isort / pylint / pytype with ruff + ty, switches dependency management
to uv, consolidates setup.py into pyproject.toml, and adds pre-commit.
Tooling
- pyproject.toml: full [project] block + [dependency-groups] dev;
[tool.uv] package = false; [tool.ruff] / [tool.ty.src] config matching
ord-schema. Drop [tool.black]/[tool.isort]/[tool.pytype]. Drop setup.py
and format.sh.
- Add .pre-commit-config.yaml (addlicense + ruff-check + ruff-format + ty).
- Generate uv.lock; bump numpy<2 -> numpy>=1.26.4 to enable cp313/cp314.
CI
- New checks.yml replaces cleanup.yml: ruff check + ruff format --check +
ty + addlicense + clang-format.
- run_tests.yml uses astral-sh/setup-uv@v5 + uv sync --frozen; matrix
bumped from 3.10-3.12 to 3.11-3.14 (matches ord-schema).
Source
- Strip 8 # pylint: disable and 1 # pytype: disable comments from
non-editor files.
- Exclude ord_interface/editor/ and ord_interface/interface.py from
ruff/ty (slated for removal in #N).
- Fix all 19 ty diagnostics:
* Type psycopg connection/cursor as dict[str, Any] rows (introduces
DictCursor alias in queries.py).
* Fix QueryResult.__eq__ Liskov violation (other: object + isinstance).
* Annotate kwargs: dict[str, Any] in queries_test.test_similarity_query.
* Generalize _pbtxt to accept any protobuf Message (callers pass both
Reaction and ProductCompound).
* cast(Chem.Mol, ...) around mol_from_compound (return type widens to
a tuple when return_identifier=True).
* Annotate yielding fixture as Iterator[Reaction].
* One # ty: ignore[invalid-await] on redis.asyncio client.ping()
(stub returns Awaitable[bool] | bool).
Dockerfile
- Replace setup.py egg_info + pip install dance with
uv sync --frozen --no-dev; drop the final pip install . (package=false).
* Clean up tests workflow
Rename run_tests.yml to tests.yml, restrict push trigger to main, and
drop the unused CACHE_TARGET env var.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Fix CI failures on modernize-tooling
- Bump protobuf cap from <5 to <6 so resolution picks 5.29.6, which
ships cp38-abi3 wheels and runs on Python 3.14. The 4.x series has no
3.14 wheels, so import fails with "Metaclasses with custom tp_new are
not supported." Matches ord-schema's constraint.
- test_app: invoke run_tests.sh via "uv run" so the venv's python and
pytest are on PATH. The script's bare "python client/build_database.py"
was hitting the system interpreter, which doesn't have ord_interface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test_app: set PYTHONPATH so bare python finds ord_interface
The pyproject sets [tool.uv] package = false and has no [build-system],
so uv sync only installs dependencies, not the ord_interface package
itself. Pytest's rootdir handling masked this in test_ord_interface,
but the test_app job runs build_test_database.sh which calls
"python client/build_database.py" directly and hits ModuleNotFoundError.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: pass as_utf8=True to text_format.MessageToBytes
protobuf 5.x's MessageToBytes encodes the string form as ASCII by
default and raises UnicodeEncodeError when the message contains
non-ASCII content. as_utf8=True keeps non-ASCII bytes through to the
output, matching the prior 4.x behavior in practice.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Make ord-interface installable; align codecov with ord-schema
- Add [build-system] (setuptools+wheel) and [tool.setuptools.packages.find]
scoped to ord_interface*; drop [tool.uv] package = false. uv sync now
installs ord-interface as an editable wheel into the venv, so
"import ord_interface" works from anywhere instead of requiring the
repo root on sys.path.
- tests.yml: drop the test_app PYTHONPATH workaround that compensated
for the project not being installed.
- tests.yml: add fail_ci_if_error to codecov-action so fork PRs and
dependabot/* branches don't fail the job on tokenless uploads.
Mirrors ord-schema's run_tests.yml.
- Dockerfile: split uv sync into a deps-only pass before COPYing
sources (--no-install-project) and a final sync after to install the
project itself, preserving layer caching for deps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Tighten ty annotations; move testing-postgresql to dev group
Apply review feedback:
- filters.py: cast(Chem.Mol | None, ...) instead of cast(Chem.Mol, ...)
to preserve the meaning of the subsequent `if mol:` null-check.
- search.py: replace `# ty: ignore[invalid-await]` on
`redis.asyncio.Redis.ping()` with `cast(Awaitable[bool], ...)`,
scoping the workaround to the actual problem (stub union return type).
- pyproject.toml/uv.lock: move `testing-postgresql` from runtime
dependencies to the `dev` group; lazy-import `Postgresql` in
`api/main.py` inside the `ORD_INTERFACE_TESTING=TRUE` branch since
that's the only path that instantiates it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8731895 commit 048ad79
19 files changed
Lines changed: 2580 additions & 245 deletions
File tree
- .github/workflows
- ord_interface
- api
- editor/py
- visualization
Lines changed: 23 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | | - | |
24 | | - | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | | - | |
36 | | - | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
56 | 52 | | |
57 | 53 | | |
58 | 54 | | |
59 | 55 | | |
60 | | - | |
| 56 | + | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
Lines changed: 28 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 15 | + | |
22 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | | - | |
| 43 | + | |
45 | 44 | | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
71 | | - | |
| 75 | + | |
72 | 76 | | |
| 77 | + | |
73 | 78 | | |
74 | | - | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
93 | | - | |
| 92 | + | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
0 commit comments