From 4cee2e80c05ee660f935445e2e2aa13674d3fad5 Mon Sep 17 00:00:00 2001 From: ritchie Date: Tue, 1 Oct 2024 14:13:30 +0200 Subject: [PATCH] chore(python): Remove built info --- Cargo.lock | 193 ++++-------------------- py-polars/Cargo.toml | 5 - py-polars/build.rs | 24 +-- py-polars/src/lib.rs | 60 +------- py-polars/tests/unit/conftest.py | 2 +- py-polars/tests/unit/meta/test_build.py | 20 --- 6 files changed, 36 insertions(+), 268 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c448d1676ec3..e53f8c1b8fc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -817,17 +817,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "built" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" -dependencies = [ - "cargo-lock", - "chrono", - "git2", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -876,18 +865,6 @@ dependencies = [ "either", ] -[[package]] -name = "cargo-lock" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72" -dependencies = [ - "semver", - "serde", - "toml", - "url", -] - [[package]] name = "casey" version = "0.4.0" @@ -914,9 +891,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.22" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "jobserver", "libc", @@ -1645,19 +1622,6 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" -[[package]] -name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" -dependencies = [ - "bitflags", - "libc", - "libgit2-sys", - "log", - "url", -] - [[package]] name = "glob" version = "0.3.1" @@ -1858,9 +1822,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2179,18 +2143,6 @@ dependencies = [ "rle-decode-fast", ] -[[package]] -name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - [[package]] name = "libloading" version = "0.8.5" @@ -2227,18 +2179,6 @@ dependencies = [ "libc", ] -[[package]] -name = "libz-sys" -version = "1.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2655,7 +2595,7 @@ dependencies = [ "rand", "reqwest", "ring", - "rustls-pemfile 2.1.3", + "rustls-pemfile 2.2.0", "serde", "serde_json", "snafu", @@ -2667,9 +2607,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "oorandom" @@ -2923,7 +2866,7 @@ dependencies = [ "proptest", "rand", "regex", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "ryu", "sample-arrow2", "sample-std", @@ -3485,7 +3428,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "unarray", ] @@ -3525,7 +3468,6 @@ dependencies = [ name = "py-polars" version = "1.8.2" dependencies = [ - "built", "jemallocator", "libc", "mimalloc", @@ -3799,9 +3741,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags", ] @@ -3828,25 +3770,25 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -3863,15 +3805,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64 0.22.1", "bytes", @@ -3894,8 +3836,8 @@ dependencies = [ "pin-project-lite", "quinn", "rustls 0.23.13", - "rustls-native-certs 0.7.3", - "rustls-pemfile 2.1.3", + "rustls-native-certs 0.8.0", + "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", @@ -4023,19 +3965,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-native-certs" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" -dependencies = [ - "openssl-probe", - "rustls-pemfile 2.1.3", - "rustls-pki-types", - "schannel", - "security-framework", -] - [[package]] name = "rustls-native-certs" version = "0.8.0" @@ -4043,7 +3972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.3", + "rustls-pemfile 2.2.0", "rustls-pki-types", "schannel", "security-framework", @@ -4060,11 +3989,10 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] @@ -4229,9 +4157,6 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] [[package]] name = "serde" @@ -4275,15 +4200,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4740,40 +4656,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.3" @@ -4952,12 +4834,6 @@ dependencies = [ "ryu", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -5347,15 +5223,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "x11rb" version = "0.13.1" diff --git a/py-polars/Cargo.toml b/py-polars/Cargo.toml index 7a783d9e7481..5eb44d8f41b4 100644 --- a/py-polars/Cargo.toml +++ b/py-polars/Cargo.toml @@ -14,9 +14,6 @@ polars = { workspace = true } polars-python = { workspace = true, features = ["pymethods", "iejoin"] } pyo3 = { workspace = true, features = ["abi3-py39", "chrono", "extension-module", "multiple-pymethods"] } -[build-dependencies] -built = { version = "0.7", features = ["chrono", "git2", "cargo-lock"], optional = true } - [target.'cfg(all(any(not(target_family = "unix"), allocator = "mimalloc"), not(allocator = "default")))'.dependencies] mimalloc = { version = "0.1", default-features = false } @@ -29,7 +26,6 @@ jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] } [features] # Features used in this crate -build_info = ["dep:built"] ffi_plugin = ["polars-python/ffi_plugin"] csv = ["polars-python/csv"] polars_cloud = ["polars-python/polars_cloud"] @@ -98,7 +94,6 @@ io = ["polars-python/io"] optimizations = ["polars-python/optimizations"] all = [ - "build_info", "ffi_plugin", "csv", "polars_cloud", diff --git a/py-polars/build.rs b/py-polars/build.rs index 30306b33c706..5024e53b6889 100644 --- a/py-polars/build.rs +++ b/py-polars/build.rs @@ -1,23 +1,7 @@ -//! Build script using 'built' crate to generate build info. - fn main() { println!("cargo::rustc-check-cfg=cfg(allocator, values(\"default\", \"mimalloc\"))"); - - #[cfg(feature = "build_info")] - { - println!("cargo:rerun-if-changed=build.rs"); - extern crate built; - use std::env; - use std::path::Path; - - // We must specify the workspace root as the source - let py_polars_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let src = Path::new(&py_polars_dir).parent().unwrap(); - - let out_dir = &env::var("OUT_DIR").unwrap(); - let dst = Path::new(&out_dir).join("built.rs"); - - built::write_built_file_with_opts(Some(src), &dst) - .expect("Failed to acquire build-time information"); - } + println!( + "cargo:rustc-env=TARGET={}", + std::env::var("TARGET").unwrap() + ); } diff --git a/py-polars/src/lib.rs b/py-polars/src/lib.rs index 484583f85150..1c645738102a 100644 --- a/py-polars/src/lib.rs +++ b/py-polars/src/lib.rs @@ -3,12 +3,6 @@ #![allow(non_local_definitions)] #![allow(clippy::too_many_arguments)] // Python functions can have many arguments due to default arguments -#[cfg(feature = "build_info")] -#[allow(dead_code)] -mod build { - include!(concat!(env!("OUT_DIR"), "/built.rs")); -} - mod allocator; #[cfg(debug_assertions)] mod memory; @@ -386,8 +380,6 @@ fn polars(py: Python, m: &Bound) -> PyResult<()> { // Build info m.add("__version__", env!("CARGO_PKG_VERSION"))?; - #[cfg(feature = "build_info")] - add_build_info(py, m)?; // Plugins #[cfg(feature = "ffi_plugin")] @@ -397,57 +389,7 @@ fn polars(py: Python, m: &Bound) -> PyResult<()> { // Capsules m.add("_allocator", create_allocator_capsule(py)?)?; - Ok(()) -} - -#[cfg(feature = "build_info")] -fn add_build_info(py: Python, m: &Bound) -> PyResult<()> { - use pyo3::types::{PyDict, PyString}; - let info = PyDict::new_bound(py); - - let build = PyDict::new_bound(py); - build.set_item("rustc", build::RUSTC)?; - build.set_item("rustc-version", build::RUSTC_VERSION)?; - build.set_item("opt-level", build::OPT_LEVEL)?; - build.set_item("debug", build::DEBUG)?; - build.set_item("jobs", build::NUM_JOBS)?; - info.set_item("compiler", build)?; - - info.set_item("time", build::BUILT_TIME_UTC)?; - - let deps = PyDict::new_bound(py); - for (name, version) in build::DEPENDENCIES.iter() { - deps.set_item(name, version)?; - } - info.set_item("dependencies", deps)?; - - let features = build::FEATURES - .iter() - .map(|feat| PyString::new_bound(py, feat)) - .collect::>(); - info.set_item("features", features)?; - - let host = PyDict::new_bound(py); - host.set_item("triple", build::HOST)?; - info.set_item("host", host)?; - - let target = PyDict::new_bound(py); - target.set_item("arch", build::CFG_TARGET_ARCH)?; - target.set_item("os", build::CFG_OS)?; - target.set_item("family", build::CFG_FAMILY)?; - target.set_item("env", build::CFG_ENV)?; - target.set_item("triple", build::TARGET)?; - target.set_item("endianness", build::CFG_ENDIAN)?; - target.set_item("pointer-width", build::CFG_POINTER_WIDTH)?; - target.set_item("profile", build::PROFILE)?; - info.set_item("target", target)?; + m.add("_debug", cfg!(debug_assertions))?; - let git = PyDict::new_bound(py); - git.set_item("version", build::GIT_VERSION)?; - git.set_item("dirty", build::GIT_DIRTY)?; - git.set_item("hash", build::GIT_COMMIT_HASH)?; - git.set_item("head", build::GIT_HEAD_REF)?; - info.set_item("git", git)?; - m.add("__build__", info)?; Ok(()) } diff --git a/py-polars/tests/unit/conftest.py b/py-polars/tests/unit/conftest.py index ead5bee2c265..23e3016fa000 100644 --- a/py-polars/tests/unit/conftest.py +++ b/py-polars/tests/unit/conftest.py @@ -212,7 +212,7 @@ def memory_usage_without_pyarrow() -> Generator[MemoryUsage, Any, Any]: Memory usage from PyArrow is not tracked. """ - if not pl.build_info()["compiler"]["debug"]: + if not pl.polars._debug: # type: ignore[attr-defined] pytest.skip("Memory usage only available in debug/dev builds.") if os.getenv("POLARS_FORCE_ASYNC", "0") == "1": diff --git a/py-polars/tests/unit/meta/test_build.py b/py-polars/tests/unit/meta/test_build.py index 18f9c5a53e58..d6b711ef4ee2 100644 --- a/py-polars/tests/unit/meta/test_build.py +++ b/py-polars/tests/unit/meta/test_build.py @@ -4,23 +4,3 @@ def test_build_info_version() -> None: build_info = pl.build_info() assert build_info["version"] == pl.__version__ - - -def test_build_info_keys() -> None: - build_info = pl.build_info() - expected_keys = [ - "compiler", - "time", - "dependencies", - "features", - "host", - "target", - "git", - "version", - ] - assert sorted(build_info.keys()) == sorted(expected_keys) - - -def test_build_info_features() -> None: - build_info = pl.build_info() - assert "BUILD_INFO" in build_info["features"]