Best Toolchain for Developing a Python Package with C++ Core?

0
8
Asked By CuriousDeveloper42 On

I'm trying to set up a streamlined development environment for creating an application that has a C++ core and a Python interface. My focus is on using Python 3.13 and C++23, ideally for high-performance computing (HPC) applications. Here's what I've tried so far:

- **Project environment and dependencies**: Pixi
- **Development environment**: WSL2 with VS Code Remote window
- **Build system**: scikit-build using CMake and Ninja
- **Binding library**: Nanobind

I've set up various configuration files including pixi.toml, pyproject.toml, CMakeLists.txt, and CMakePresets.json.

For my Python toolchain, I'm currently using:
- UV
- Ruff
- Mypy (and I'm trying ty)
- pytest
- pre-commit

What are your thoughts on this setup? Would you recommend a toolchain like this, and could you suggest any learning resources? I'm particularly interested in how to effectively develop Python applications with a C++ core.

4 Answers

Answered By RustyLearner404 On

If C++ isn't a strict requirement, you might check out Maturin for Rust bindings; it's gaining popularity. But I should mention that Rust is still catching up in certain HPC areas like CUDA, PETSc, BLAS, and LAPACK. Are you familiar with how Rust handles these?

Answered By SkepticalCoder88 On

Honestly, it sounds like a lot of work to maintain both languages. Have you considered sticking to just one unless it's absolutely necessary?

Answered By TechExplorer101 On

You're on the right track! One key point to consider is whether you're using Pybind11 or Nanobind for your bindings, as that can significantly affect your development experience and build complexity. What did you decide on?

Answered By CodeCraftsman99 On

Your stack looks solid for modern C++/Python integration. If build times become an issue, especially with C++23's heavy template usage, consider looking into Incredibuild. It helps speed up CMake/Ninja builds by distributing compilation across multiple CPUs without altering your current setup.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.