Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--interpreter option recompiles pyo3 on every build #2256

Open
2 tasks done
sentialx opened this issue Oct 16, 2024 · 3 comments
Open
2 tasks done

--interpreter option recompiles pyo3 on every build #2256

sentialx opened this issue Oct 16, 2024 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@sentialx
Copy link

sentialx commented Oct 16, 2024

Bug Description

Providing an --interpreter option causes recompilation of pyo3 on every build on Linux (Windows works fine).

Your maturin version (maturin --version)

1.7.4

Your Python version (python -V)

3.12

Your pip version (pip -V)

24.0

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

maturin build --release -o out --skip-auditwheel --interpreter python3.12

🔗 Found pyo3 bindings
⚠️  Warning: Failed to determine python platform
🐍 Found CPython 3.12
warning: unused manifest key: lib.version
   Compiling pyo3-build-config v0.22.5
   Compiling pyo3-ffi v0.22.5
   Compiling pyo3-macros-backend v0.22.5
   Compiling pyo3 v0.22.5
   Compiling pyo3-macros v0.22.5
   Compiling user_lib v0.0.1 (/usr/src/app)
    Finished `release` profile [optimized] target(s) in 3.54s
📦 Built wheel for CPython 3.12 to pace/builder/build_env/user_lib-0.0.1-cp312-cp312-linux_aarch64.whl
3
2024-10-16T12:53:38.985362Z DEBUG into_build_context: maturin::project_layout: Using cargo manifest path from working directory: "/usr/src/app/Cargo.toml"
2024-10-16T12:53:38.985435Z DEBUG into_build_context:resolve_cargo_metadata: maturin::project_layout: Resolving cargo metadata from "/usr/src/app/Cargo.toml"
🔗 Found pyo3 bindings
2024-10-16T12:53:39.013722Z  INFO into_build_context:resolve_cargo_metadata: maturin::project_layout: close time.busy=28.3ms time.idle=625ns
2024-10-16T12:53:39.013760Z DEBUG into_build_context: maturin::project_layout: Project layout resolved project_root=/usr/src/app python_dir=/usr/src/app rust_module=/usr/src/app/user_lib python_module=/usr/src/app/user_lib extension_name=user_lib module_name=user_lib
⚠️  Warning: Failed to determine python platform
🐍 Found CPython 3.12
2024-10-16T12:53:39.037871Z  INFO into_build_context:check_executable: maturin::python_interpreter: close time.busy=202µs time.idle=1.83µs executable=python3.12
2024-10-16T12:53:39.037895Z DEBUG into_build_context: maturin::build_options: Found CPython 3.12 in bundled sysconfig
2024-10-16T12:53:39.037908Z  INFO into_build_context: maturin::build_options: close time.busy=52.6ms time.idle=1.50µs
2024-10-16T12:53:39.037942Z DEBUG build_wheels: maturin::compile: Setting crate_type to cdylib for Rust >= 1.64.0
2024-10-16T12:53:39.038111Z DEBUG build_wheels: maturin::compile: Running env -u CARGO PYO3_CONFIG_FILE="/usr/src/app/target/maturin/pyo3-config-aarch64-unknown-linux-gnu-3.12.txt" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/usr/src/app/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"
warning: unused manifest key: lib.version
   Compiling pyo3-build-config v0.22.5
   Compiling pyo3-ffi v0.22.5
   Compiling pyo3-macros-backend v0.22.5
   Compiling pyo3 v0.22.5
   Compiling pyo3-macros v0.22.5
   Compiling user_lib v0.0.1 (/usr/src/app)
    Finished `release` profile [optimized] target(s) in 3.77s
2024-10-16T12:53:42.835314Z  INFO build_wheels:warn_missing_py_init: maturin::compile: close time.busy=410µs time.idle=1.42µs
2024-10-16T12:53:42.836781Z DEBUG build_wheels: maturin::module_writer: Adding user_lib-0.0.1.dist-info/METADATA
2024-10-16T12:53:42.836838Z DEBUG build_wheels: maturin::module_writer: Adding user_lib-0.0.1.dist-info/WHEEL
2024-10-16T12:53:42.836886Z DEBUG build_wheels:write_bindings_module: maturin::module_writer: Adding user_lib/__init__.py
2024-10-16T12:53:42.836934Z DEBUG build_wheels:write_bindings_module: maturin::module_writer: Adding user_lib/user_lib.cpython-312-aarch64-linux-gnu.so from /usr/src/app/target/release/libuser_lib.so
2024-10-16T12:53:42.852572Z  INFO build_wheels:write_bindings_module: maturin::module_writer: close time.busy=15.7ms time.idle=916ns
2024-10-16T12:53:42.852591Z DEBUG build_wheels: maturin::module_writer: Adding user_lib-0.0.1.dist-info/RECORD
2024-10-16T12:53:42.852821Z  INFO build_wheels: maturin::build_context: close time.busy=3.81s time.idle=750ns
@sentialx sentialx added the bug Something isn't working label Oct 16, 2024
@messense
Copy link
Member

This should be easy to fix, just need to skip writing the pyo3 config file if it's already up-to-date to avoid changing file modification time:

fs::write(&config_file, pyo3_config).with_context(|| {

Pull requests are welcome.

@kliwongan
Copy link

Can I try this one?

@konstin
Copy link
Member

konstin commented Oct 18, 2024

sure!

ringsaturn added a commit to ringsaturn/tzfpy that referenced this issue Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants