I want to call some rust code from python on a linux machine. Specifically, I want to be able to run
python3 -c 'import magic; print(magic.do_add(3, 4))'
and have it give me the sum of these numbers. Here, do_add should be a rust function that adds two integers.
Please give me a complete set of instructions for how to make this run, so that when I run this code as-is it will work.
I want to call some rust code from python on a linux machine. Specifically, I want to be able to run
python3 -c 'import magic; print(magic.do_add(3, 4))'
and have it give me the sum of these numbers. Here, do_add should be a rust function that adds two integers.
Please give me a complete set of instructions for how to make this run, so that when I run this code as-is it will work.
Here's a step-by-step guide to create a Python module with a Rust backend:
1. Install dependencies
2. Create project structure
3. Create Rust library (src/lib.rs):
4. Create Cargo.toml:
5. Create setup.py:
6. Build and install:
This should output: `7`
A few notes:
- This uses PyO3 for Rust-Python integration
- Requires Rust, Python dev tools, and pip
- The setup.py handles building the Rust library as a Python extension
Troubleshooting:
- Ensure all dependencies are installed
- Check Rust and Python versions are compatible
- Verify build process completes without errors
Now please conver this answer into a JSON array that packages it all up so I don't need to think and can just copy files to specific locations and then run things. Format your answer
{"path/to/file": "contents of rust file",
"path/to/python_file": "contents of any necessary python file that exposes do_add",
"build.sh": "contents of a bash file to build the project",
... # any other files necessary
}
The only thing I will do is put files in the right place and run `bash build.sh`. Do not give any explanation of the code. ONLY ANSWER WITH A SINGLE JSON OBJECT. Your answer should start
.
PyFunc
final: True
build.sh: line 2: sudo: command not found
build.sh: line 3: sudo: command not found
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python3.12 -m pip install --upgrade pip
WARNING: '' not a valid package name; please use only .-separated package names in setup.py
/usr/local/lib/python3.12/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
Updating crates.io index
Locking 34 packages to latest compatible versions
Adding indoc v1.0.9 (latest: v2.0.5)
Adding pyo3 v0.19.2 (latest: v0.22.5)
Adding pyo3-build-config v0.19.2 (latest: v0.22.5)
Adding pyo3-ffi v0.19.2 (latest: v0.22.5)
Adding pyo3-macros v0.19.2 (latest: v0.22.5)
Adding pyo3-macros-backend v0.19.2 (latest: v0.22.5)
Adding syn v1.0.109 (latest: v2.0.87)
Adding unindent v0.1.11 (latest: v0.2.3)
Downloading crates ...
Downloaded autocfg v1.4.0
Downloaded lock_api v0.4.12
Downloaded cfg-if v1.0.0
Downloaded indoc v1.0.9
Downloaded unindent v0.1.11
Downloaded memoffset v0.9.1
Downloaded once_cell v1.20.2
Downloaded windows-targets v0.52.6
Downloaded pyo3-macros v0.19.2
Downloaded bitflags v2.6.0
Downloaded scopeguard v1.2.0
Downloaded parking_lot_core v0.9.10
Downloaded redox_syscall v0.5.7
Downloaded quote v1.0.37
Downloaded pyo3-build-config v0.19.2
Downloaded smallvec v1.13.2
Downloaded target-lexicon v0.12.16
Downloaded pyo3-macros-backend v0.19.2
Downloaded unicode-ident v1.0.13
Downloaded parking_lot v0.12.3
Downloaded proc-macro2 v1.0.89
Downloaded pyo3-ffi v0.19.2
Downloaded syn v1.0.109
Downloaded windows_aarch64_gnullvm v0.52.6
Downloaded pyo3 v0.19.2
Downloaded windows_x86_64_gnullvm v0.52.6
Downloaded windows_i686_gnullvm v0.52.6
Downloaded libc v0.2.161
Downloaded windows_x86_64_msvc v0.52.6
Downloaded windows_x86_64_gnu v0.52.6
Downloaded windows_i686_msvc v0.52.6
Downloaded windows_i686_gnu v0.52.6
Downloaded windows_aarch64_msvc v0.52.6
cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib --
Compiling target-lexicon v0.12.16
Compiling autocfg v1.4.0
Compiling proc-macro2 v1.0.89
Compiling once_cell v1.20.2
Compiling unicode-ident v1.0.13
Compiling libc v0.2.161
Compiling syn v1.0.109
Compiling parking_lot_core v0.9.10
Compiling smallvec v1.13.2
Compiling scopeguard v1.2.0
Compiling cfg-if v1.0.0
Compiling unindent v0.1.11
Compiling indoc v1.0.9
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/target-lexicon-0.12.16/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arch_zkasm", "default", "serde", "serde_support", "std"))' -C metadata=531516682e473250 -C extra-filename=-531516682e473250 --out-dir /usr/src/app/target/release/build/target-lexicon-531516682e473250 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name autocfg --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autocfg-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=65d1c45df7892082 -C extra-filename=-65d1c45df7892082 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.89/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=8cd788f77c4b8745 -C extra-filename=-8cd788f77c4b8745 --out-dir /usr/src/app/target/release/build/proc-macro2-8cd788f77c4b8745 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name once_cell --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.20.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="race"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("alloc", "atomic-polyfill", "critical-section", "default", "parking_lot", "portable-atomic", "race", "std", "unstable"))' -C metadata=097199c12958d81d -C extra-filename=-097199c12958d81d --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.161/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=118ed0ed7e3a5800 -C extra-filename=-118ed0ed7e3a5800 --out-dir /usr/src/app/target/release/build/libc-118ed0ed7e3a5800 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name unicode_ident --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=9a8f7cba0136d63d -C extra-filename=-9a8f7cba0136d63d --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("clone-impls", "default", "derive", "extra-traits", "fold", "full", "parsing", "printing", "proc-macro", "quote", "test", "visit", "visit-mut"))' -C metadata=137afca9e95c8ca9 -C extra-filename=-137afca9e95c8ca9 --out-dir /usr/src/app/target/release/build/syn-137afca9e95c8ca9 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parking_lot_core-0.9.10/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("backtrace", "deadlock_detection", "nightly", "petgraph", "thread-id"))' -C metadata=bcb9839134a97bd5 -C extra-filename=-bcb9839134a97bd5 --out-dir /usr/src/app/target/release/build/parking_lot_core-bcb9839134a97bd5 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name scopeguard --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scopeguard-1.2.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "use_std"))' -C metadata=486830b48780e581 -C extra-filename=-486830b48780e581 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name smallvec --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smallvec-1.13.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arbitrary", "const_generics", "const_new", "debugger_visualizer", "drain_filter", "drain_keep_rest", "may_dangle", "serde", "specialization", "union", "write"))' -C metadata=6369c752be17ccbd -C extra-filename=-6369c752be17ccbd --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("compiler_builtins", "core", "rustc-dep-of-std"))' -C metadata=d4a6a898f1eea888 -C extra-filename=-d4a6a898f1eea888 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name indoc --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/indoc-1.0.9/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=435ab31b31654491 -C extra-filename=-435ab31b31654491 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern proc_macro --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name unindent --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unindent-0.1.11/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=7cc24c0c964a1988 -C extra-filename=-7cc24c0c964a1988 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow`
Running `/usr/src/app/target/release/build/parking_lot_core-bcb9839134a97bd5/build-script-build`
Running `/usr/src/app/target/release/build/libc-118ed0ed7e3a5800/build-script-build`
Running `/usr/src/app/target/release/build/syn-137afca9e95c8ca9/build-script-build`
Running `/usr/src/app/target/release/build/proc-macro2-8cd788f77c4b8745/build-script-build`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name libc --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.161/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=b6cfa0dcd867db34 -C extra-filename=-b6cfa0dcd867db34 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow --cfg freebsd11 --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_int128 --cfg libc_core_cvoid --cfg libc_packedN --cfg libc_cfg_target_vendor --cfg libc_non_exhaustive --cfg libc_long_array --cfg libc_ptr_addr_of --cfg libc_underscore_const_names --cfg libc_const_extern_fn --check-cfg 'cfg(emscripten_new_stat_abi)' --check-cfg 'cfg(espidf_time64)' --check-cfg 'cfg(freebsd10)' --check-cfg 'cfg(freebsd11)' --check-cfg 'cfg(freebsd12)' --check-cfg 'cfg(freebsd13)' --check-cfg 'cfg(freebsd14)' --check-cfg 'cfg(freebsd15)' --check-cfg 'cfg(libc_align)' --check-cfg 'cfg(libc_cfg_target_vendor)' --check-cfg 'cfg(libc_const_extern_fn)' --check-cfg 'cfg(libc_const_extern_fn_unstable)' --check-cfg 'cfg(libc_const_size_of)' --check-cfg 'cfg(libc_core_cvoid)' --check-cfg 'cfg(libc_deny_warnings)' --check-cfg 'cfg(libc_int128)' --check-cfg 'cfg(libc_long_array)' --check-cfg 'cfg(libc_non_exhaustive)' --check-cfg 'cfg(libc_packedN)' --check-cfg 'cfg(libc_priv_mod_use)' --check-cfg 'cfg(libc_ptr_addr_of)' --check-cfg 'cfg(libc_thread_local)' --check-cfg 'cfg(libc_underscore_const_names)' --check-cfg 'cfg(libc_union)' --check-cfg 'cfg(libc_ctest)' --check-cfg 'cfg(target_os,values("switch","aix","ohos","hurd","rtems","visionos","nuttx"))' --check-cfg 'cfg(target_env,values("illumos","wasi","aix","ohos"))' --check-cfg 'cfg(target_arch,values("loongarch64","mips32r6","mips64r6","csky"))'`
Compiling lock_api v0.4.12
Compiling memoffset v0.9.1
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lock_api-0.4.12/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="atomic_usize"' --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arc_lock", "atomic_usize", "default", "nightly", "owning_ref", "serde"))' -C metadata=0720188aaca31ca3 -C extra-filename=-0720188aaca31ca3 --out-dir /usr/src/app/target/release/build/lock_api-0720188aaca31ca3 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern autocfg=/usr/src/app/target/release/deps/libautocfg-65d1c45df7892082.rlib --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/memoffset-0.9.1/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "unstable_const", "unstable_offset_of"))' -C metadata=a9acd5ca2e587d02 -C extra-filename=-a9acd5ca2e587d02 --out-dir /usr/src/app/target/release/build/memoffset-a9acd5ca2e587d02 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern autocfg=/usr/src/app/target/release/deps/libautocfg-65d1c45df7892082.rlib --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name proc_macro2 --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.89/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=7b787a8ceb44d2c9 -C extra-filename=-7b787a8ceb44d2c9 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern unicode_ident=/usr/src/app/target/release/deps/libunicode_ident-9a8f7cba0136d63d.rmeta --cap-lints allow --cfg wrap_proc_macro --check-cfg 'cfg(fuzzing)' --check-cfg 'cfg(no_is_available)' --check-cfg 'cfg(no_literal_byte_character)' --check-cfg 'cfg(no_literal_c_string)' --check-cfg 'cfg(no_source_text)' --check-cfg 'cfg(proc_macro_span)' --check-cfg 'cfg(procmacro2_backtrace)' --check-cfg 'cfg(procmacro2_nightly_testing)' --check-cfg 'cfg(procmacro2_semver_exempt)' --check-cfg 'cfg(randomize_layout)' --check-cfg 'cfg(span_locations)' --check-cfg 'cfg(super_unstable)' --check-cfg 'cfg(wrap_proc_macro)'`
Running `/usr/src/app/target/release/build/target-lexicon-531516682e473250/build-script-build`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name target_lexicon --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/target-lexicon-0.12.16/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arch_zkasm", "default", "serde", "serde_support", "std"))' -C metadata=652c479ef9ec6253 -C extra-filename=-652c479ef9ec6253 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow --cfg 'feature="rust_1_40"'`
Running `/usr/src/app/target/release/build/memoffset-a9acd5ca2e587d02/build-script-build`
Running `/usr/src/app/target/release/build/lock_api-0720188aaca31ca3/build-script-build`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name memoffset --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/memoffset-0.9.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "unstable_const", "unstable_offset_of"))' -C metadata=bda181fb340bbefe -C extra-filename=-bda181fb340bbefe --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --cap-lints allow --cfg tuple_ty --cfg allow_clippy --cfg maybe_uninit --cfg doctests --cfg raw_ref_macros --cfg stable_const --cfg stable_offset_of`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name lock_api --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lock_api-0.4.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="atomic_usize"' --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arc_lock", "atomic_usize", "default", "nightly", "owning_ref", "serde"))' -C metadata=c5fdd62a66792ca2 -C extra-filename=-c5fdd62a66792ca2 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern scopeguard=/usr/src/app/target/release/deps/libscopeguard-486830b48780e581.rmeta --cap-lints allow --cfg has_const_fn_trait_bound`
Compiling pyo3-build-config v0.19.2
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-build-config-0.19.2/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="resolve-config"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "default", "extension-module", "python3-dll-a", "resolve-config"))' -C metadata=b251ebd7e4b4def5 -C extra-filename=-b251ebd7e4b4def5 --out-dir /usr/src/app/target/release/build/pyo3-build-config-b251ebd7e4b4def5 -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern target_lexicon=/usr/src/app/target/release/deps/libtarget_lexicon-652c479ef9ec6253.rlib --cap-lints allow`
Compiling quote v1.0.37
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name quote --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "proc-macro"))' -C metadata=2665d35f3b8a33e5 -C extra-filename=-2665d35f3b8a33e5 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern proc_macro2=/usr/src/app/target/release/deps/libproc_macro2-7b787a8ceb44d2c9.rmeta --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name parking_lot_core --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parking_lot_core-0.9.10/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("backtrace", "deadlock_detection", "nightly", "petgraph", "thread-id"))' -C metadata=2a57c1a2ee98d604 -C extra-filename=-2a57c1a2ee98d604 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern cfg_if=/usr/src/app/target/release/deps/libcfg_if-d4a6a898f1eea888.rmeta --extern libc=/usr/src/app/target/release/deps/liblibc-b6cfa0dcd867db34.rmeta --extern smallvec=/usr/src/app/target/release/deps/libsmallvec-6369c752be17ccbd.rmeta --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name syn --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("clone-impls", "default", "derive", "extra-traits", "fold", "full", "parsing", "printing", "proc-macro", "quote", "test", "visit", "visit-mut"))' -C metadata=3533e421d451fc1a -C extra-filename=-3533e421d451fc1a --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern proc_macro2=/usr/src/app/target/release/deps/libproc_macro2-7b787a8ceb44d2c9.rmeta --extern quote=/usr/src/app/target/release/deps/libquote-2665d35f3b8a33e5.rmeta --extern unicode_ident=/usr/src/app/target/release/deps/libunicode_ident-9a8f7cba0136d63d.rmeta --cap-lints allow --cfg syn_disable_nightly_tests`
Compiling parking_lot v0.12.3
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name parking_lot --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parking_lot-0.12.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arc_lock", "deadlock_detection", "default", "hardware-lock-elision", "nightly", "owning_ref", "send_guard", "serde"))' -C metadata=9c891b2348be6d8e -C extra-filename=-9c891b2348be6d8e --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern lock_api=/usr/src/app/target/release/deps/liblock_api-c5fdd62a66792ca2.rmeta --extern parking_lot_core=/usr/src/app/target/release/deps/libparking_lot_core-2a57c1a2ee98d604.rmeta --cap-lints allow`
Running `/usr/src/app/target/release/build/pyo3-build-config-b251ebd7e4b4def5/build-script-build`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name pyo3_build_config --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-build-config-0.19.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="resolve-config"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "default", "extension-module", "python3-dll-a", "resolve-config"))' -C metadata=75cf1cf5d567b357 -C extra-filename=-75cf1cf5d567b357 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern once_cell=/usr/src/app/target/release/deps/libonce_cell-097199c12958d81d.rmeta --extern target_lexicon=/usr/src/app/target/release/deps/libtarget_lexicon-652c479ef9ec6253.rmeta --cap-lints allow`
Compiling pyo3-ffi v0.19.2
Compiling pyo3 v0.19.2
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-ffi-0.19.2/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extension-module"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "default", "extension-module", "generate-import-lib"))' -C metadata=50cec6dbe7ce70db -C extra-filename=-50cec6dbe7ce70db --out-dir /usr/src/app/target/release/build/pyo3-ffi-50cec6dbe7ce70db -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern pyo3_build_config=/usr/src/app/target/release/deps/libpyo3_build_config-75cf1cf5d567b357.rlib --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="indoc"' --cfg 'feature="macros"' --cfg 'feature="pyo3-macros"' --cfg 'feature="unindent"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "anyhow", "auto-initialize", "chrono", "default", "experimental-inspect", "extension-module", "eyre", "full", "generate-import-lib", "hashbrown", "indexmap", "indoc", "inventory", "macros", "multiple-pymethods", "nightly", "num-bigint", "num-complex", "pyo3-macros", "rust_decimal", "serde", "unindent"))' -C metadata=d493b8d894bdf81d -C extra-filename=-d493b8d894bdf81d --out-dir /usr/src/app/target/release/build/pyo3-d493b8d894bdf81d -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern pyo3_build_config=/usr/src/app/target/release/deps/libpyo3_build_config-75cf1cf5d567b357.rlib --cap-lints allow`
Running `/usr/src/app/target/release/build/pyo3-ffi-50cec6dbe7ce70db/build-script-build`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name pyo3_ffi --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-ffi-0.19.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extension-module"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "default", "extension-module", "generate-import-lib"))' -C metadata=56767f5e6f1b2c8d -C extra-filename=-56767f5e6f1b2c8d --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern libc=/usr/src/app/target/release/deps/liblibc-b6cfa0dcd867db34.rmeta --cap-lints allow --cfg Py_3_6 --cfg Py_3_7 --cfg Py_3_8 --cfg Py_3_9 --cfg Py_3_10 --cfg Py_3_11 --cfg Py_3_12 --cfg min_const_generics --cfg addr_of --cfg option_insert --cfg thread_local_const_init --cfg panic_unwind`
Running `/usr/src/app/target/release/build/pyo3-d493b8d894bdf81d/build-script-build`
Compiling pyo3-macros-backend v0.19.2
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name pyo3_macros_backend --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-macros-backend-0.19.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3"))' -C metadata=a94c3149ac7f46e7 -C extra-filename=-a94c3149ac7f46e7 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern proc_macro2=/usr/src/app/target/release/deps/libproc_macro2-7b787a8ceb44d2c9.rmeta --extern quote=/usr/src/app/target/release/deps/libquote-2665d35f3b8a33e5.rmeta --extern syn=/usr/src/app/target/release/deps/libsyn-3533e421d451fc1a.rmeta --cap-lints allow`
Compiling pyo3-macros v0.19.2
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name pyo3_macros --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-macros-0.19.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "multiple-pymethods"))' -C metadata=593184623b7fbea8 -C extra-filename=-593184623b7fbea8 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern proc_macro2=/usr/src/app/target/release/deps/libproc_macro2-7b787a8ceb44d2c9.rlib --extern pyo3_macros_backend=/usr/src/app/target/release/deps/libpyo3_macros_backend-a94c3149ac7f46e7.rlib --extern quote=/usr/src/app/target/release/deps/libquote-2665d35f3b8a33e5.rlib --extern syn=/usr/src/app/target/release/deps/libsyn-3533e421d451fc1a.rlib --extern proc_macro --cap-lints allow`
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name pyo3 --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="indoc"' --cfg 'feature="macros"' --cfg 'feature="pyo3-macros"' --cfg 'feature="unindent"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("abi3", "abi3-py310", "abi3-py311", "abi3-py37", "abi3-py38", "abi3-py39", "anyhow", "auto-initialize", "chrono", "default", "experimental-inspect", "extension-module", "eyre", "full", "generate-import-lib", "hashbrown", "indexmap", "indoc", "inventory", "macros", "multiple-pymethods", "nightly", "num-bigint", "num-complex", "pyo3-macros", "rust_decimal", "serde", "unindent"))' -C metadata=fad38bdf834e6aa9 -C extra-filename=-fad38bdf834e6aa9 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern cfg_if=/usr/src/app/target/release/deps/libcfg_if-d4a6a898f1eea888.rmeta --extern indoc=/usr/src/app/target/release/deps/libindoc-435ab31b31654491.so --extern libc=/usr/src/app/target/release/deps/liblibc-b6cfa0dcd867db34.rmeta --extern memoffset=/usr/src/app/target/release/deps/libmemoffset-bda181fb340bbefe.rmeta --extern parking_lot=/usr/src/app/target/release/deps/libparking_lot-9c891b2348be6d8e.rmeta --extern pyo3_ffi=/usr/src/app/target/release/deps/libpyo3_ffi-56767f5e6f1b2c8d.rmeta --extern pyo3_macros=/usr/src/app/target/release/deps/libpyo3_macros-593184623b7fbea8.so --extern unindent=/usr/src/app/target/release/deps/libunindent-7cc24c0c964a1988.rmeta --cap-lints allow --cfg Py_3_6 --cfg Py_3_7 --cfg Py_3_8 --cfg Py_3_9 --cfg Py_3_10 --cfg Py_3_11 --cfg Py_3_12 --cfg min_const_generics --cfg addr_of --cfg option_insert --cfg thread_local_const_init --cfg panic_unwind`
Compiling magic v0.1.0 (/usr/src/app)
Running `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name magic --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=f22ed2b6a0b29166 --out-dir /usr/src/app/target/release/deps -C strip=debuginfo -L dependency=/usr/src/app/target/release/deps --extern pyo3=/usr/src/app/target/release/deps/libpyo3-fad38bdf834e6aa9.rlib`
Finished `release` profile [optimized] target(s) in 4.85s
Resulting in output:
True