Skip to content

Commit 058ba4d

Browse files
snthCopilot
andcommitted
feat(cli)!: Extract CLI binary into separate prqlc-cli crate
Split the prqlc crate into a pure library (prqlc) and a CLI binary (prqlc-cli). This fixes the structural MSRV problem where CLI-only dependencies (clap, clio, notify, etc.) forced prqlc's MSRV higher than needed, blocking Dependabot PRs. Key changes: - prqlc: Remove `cli` feature, add `display` feature gating ariadne+anstream as optional deps. Library is now pure with no binary target. - prqlc-cli: New binary crate with all CLI code moved here. Binary name remains `prqlc` via [[bin]] config. Depends on prqlc with `display` and `serde_yaml` features. - error_message.rs: Split composed() — location always computed via new offset_to_line_col() helper (no ariadne needed), display rendering behind #[cfg(feature = "display")]. - semantic/reporting.rs: Remove dead label_references()/Labeler code. - utils/mod.rs: Gate color functions behind `display` feature with no-op fallback. - CI: Update build-prqlc action to build prqlc-cli package, upgrade cargo-msrv, update release features. - Install via: cargo install prqlc-cli Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8ec7935 commit 058ba4d

27 files changed

Lines changed: 278 additions & 232 deletions

.github/actions/build-prqlc/action.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ runs:
7676
# even at the cost of slighly less efficiency.)
7777
args:
7878
--profile=${{ inputs.profile }} --locked --target=${{ inputs.target }}
79-
--no-default-features --features=${{ inputs.features }} ${{
80-
contains(inputs.target, 'musl') && '--package=prqlc' ||
81-
'--all-targets' }}
79+
--package=prqlc-cli --no-default-features --features=${{
80+
inputs.features }}
8281

8382
- name: Create artifact for Linux and macOS
8483
shell: bash

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
with:
6969
target: ${{ matrix.target }}
7070
profile: release
71-
features: cli
71+
features: default
7272
- name: Upload release artifact
7373
if: github.event_name == 'release'
7474
uses: softprops/action-gh-release@v2

.github/workflows/tests.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,10 @@ jobs:
554554
- uses: baptiste0928/cargo-install@v3
555555
with:
556556
crate: cargo-msrv
557-
# TODO: remove this version pinning
558-
# The latest 0.16 supports workspace inheritance, so the check will fail
559-
version: "0.15"
560557
# Note this currently uses a manually maintained key in
561558
# `prqlc/prqlc/Cargo.toml`, because of
562559
# https://github.com/foresterre/cargo-msrv/issues/590
563-
- name: Verify minimum rust version — prqlc
560+
- name: Verify minimum rust version — prqlc library
564561
# Ideally we'd check all crates, ref https://github.com/foresterre/cargo-msrv/issues/295
565562
working-directory: prqlc/prqlc
566563
run: cargo msrv verify

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
**Internal changes**:
1818

19+
- Extract CLI binary into separate `prqlc-cli` crate. The `prqlc` crate is now a
20+
pure library; the `cli` feature has been removed and replaced by a `display`
21+
feature that gates ariadne/anstream. The CLI binary name remains `prqlc`.
22+
Install with `cargo install prqlc-cli`. (@snth)
23+
1924
**New Contributors**:
2025

2126
## 0.13.11 — 2026-03-19

Cargo.lock

Lines changed: 35 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ members = [
55
"prqlc/bindings/js",
66
"prqlc/bindings/prqlc-c",
77
"prqlc/bindings/prqlc-python",
8+
"prqlc/prqlc-cli",
89
"prqlc/prqlc-macros",
910
"prqlc/prqlc-parser",
1011
"prqlc/prqlc",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ To stay in touch with PRQL:
143143
This repo is composed of:
144144

145145
- **[prqlc](./prqlc/)** — the compiler, written in rust, whose main role is to
146-
compile PRQL into SQL. Also contains the CLI and bindings from various
147-
languages.
146+
compile PRQL into SQL. Also contains the [CLI](./prqlc/prqlc-cli/) and
147+
bindings from various languages.
148148
- **[web](./web/)** — our web content: the [Book][prql book],
149149
[Website][prql website], and [Playground][prql playground].
150150

prqlc/Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ includes:
1515
dir: ./bindings/prqlc-python
1616

1717
vars:
18-
packages_core: -p prqlc-parser -p prqlc
18+
packages_core: -p prqlc-parser -p prqlc -p prqlc-cli
1919
packages_addon: -p prqlc-macros -p compile-files
2020
packages_bindings: -p prql -p prql-java -p prqlc-js -p prqlc-c -p prqlc-python
2121

prqlc/prqlc-cli/Cargo.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[package]
2+
description = "CLI for the PRQL compiler — compiles PRQL to SQL."
3+
name = "prqlc-cli"
4+
5+
edition.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
8+
version.workspace = true
9+
10+
# No rust-version constraint — CLI can track latest deps freely.
11+
12+
build = "build.rs"
13+
14+
[features]
15+
default = ["lsp"]
16+
lsp = ["lsp-server", "lsp-types"]
17+
18+
[[bin]]
19+
name = "prqlc"
20+
path = "src/main.rs"
21+
22+
[dependencies]
23+
prqlc = { path = "../prqlc", features = ["display", "serde_yaml"] }
24+
25+
anyhow = { version = "1.0.102", features = ["backtrace"] }
26+
anstream = { version = "1.0.0", features = ["auto"] }
27+
ariadne = "0.5.1"
28+
clap = { version = "4.5.53", features = ["derive", "env", "wrap_help"] }
29+
clap_complete_command = "0.5.1"
30+
clio = { version = "0.3.3", features = ["clap-parse"] }
31+
color-eyre = "0.6.5"
32+
colorchoice-clap = "1.0.0"
33+
is-terminal = "0.4.17"
34+
itertools = { workspace = true }
35+
log = { workspace = true }
36+
minijinja = { version = "2.18.0", features = ["unstable_machinery"] }
37+
notify = "7.0.0"
38+
regex = "1.12.3"
39+
schemars = { workspace = true }
40+
serde = { workspace = true }
41+
serde_json = { workspace = true }
42+
serde_yaml = { workspace = true }
43+
walkdir = "2.5.0"
44+
45+
lsp-server = { version = "0.7.9", optional = true }
46+
lsp-types = { version = "0.97.0", optional = true }
47+
48+
[build-dependencies]
49+
vergen-gitcl = { version = "1.0.0", features = ["build"] }
50+
51+
[dev-dependencies]
52+
glob = "0.3.3"
53+
insta = { workspace = true }
54+
insta-cmd = { workspace = true }
55+
similar = { workspace = true }
56+
similar-asserts = { workspace = true }
57+
tempfile = "3.27.0"
58+
walkdir = "2.5.0"
59+
60+
[lints.rust]
61+
unsafe_code = "forbid"
62+
63+
[lints.clippy]
64+
result_large_err = "allow"

prqlc/prqlc-cli/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::error::Error;
2+
// gix failing on https://github.com/rustyhorde/vergen/issues/359, and `git2`
3+
// fails on `aarch64` so we're using `gitcl`. Switch to `gitx` when that bug is
4+
// fixed.
5+
use vergen_gitcl::{Emitter, GitclBuilder as GitBuilder};
6+
7+
pub fn main() -> Result<(), Box<dyn Error>> {
8+
let git = GitBuilder::default().describe(true, true, None).build()?;
9+
Emitter::default().add_instructions(&git)?.emit()?;
10+
Ok(())
11+
}

0 commit comments

Comments
 (0)