MCPcopy Create free account
hub / github.com/PRQL/prql / compiler_version

Function compiler_version

prqlc/prqlc/src/lib.rs:142–169  ·  view source on GitHub ↗

Get the version of the compiler. This is determined by the first of: - An optional environment variable `PRQL_VERSION_OVERRIDE`; primarily useful for internal testing. - Note that this env var is checked on every call of this function. Without checking each read, we found some internal tests were flaky. If this caused any perf issues, we could adjust the tests that rely on versions to run in a mor

()

Source from the content-addressed store, hash-verified

140/// - The version returned by `git describe --tags`
141/// - The version in the cargo manifest
142pub fn compiler_version() -> Version {
143 if let Ok(prql_version_override) = std::env::var("PRQL_VERSION_OVERRIDE") {
144 return Version::parse(&prql_version_override).unwrap_or_else(|e| {
145 panic!("Could not parse PRQL version {prql_version_override}\n{e}")
146 });
147 };
148
149 static COMPILER_VERSION: OnceLock<Version> = OnceLock::new();
150 COMPILER_VERSION
151 .get_or_init(|| {
152 if let Ok(prql_version_override) = std::env::var("PRQL_VERSION_OVERRIDE") {
153 return Version::parse(&prql_version_override).unwrap_or_else(|e| {
154 panic!("Could not parse PRQL version {prql_version_override}\n{e}")
155 });
156 }
157 let git_version = env!("VERGEN_GIT_DESCRIBE");
158 let cargo_version = env!("CARGO_PKG_VERSION");
159 Version::parse(git_version)
160 .or_else(|e| {
161 log::info!("Could not parse git version number {git_version}\n{e}");
162 Version::parse(cargo_version)
163 })
164 .unwrap_or_else(|e| {
165 panic!("Could not parse prqlc version number {cargo_version}\n{e}")
166 })
167 })
168 .clone()
169}
170
171/// Compile a PRQL string into a SQL string.
172///

Callers 4

validate_query_defFunction · 0.85
resolve_special_funcMethod · 0.85
compiler_version_strFunction · 0.85
log_startFunction · 0.85

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected