@@ -54,6 +54,7 @@ This project serves as both a learning resource and a reference implementation f
54
54
- [ Build the project] ( #build-the-project )
55
55
- [ Run individual examples] ( #run-individual-examples )
56
56
- [ Run tests] ( #run-tests )
57
+ - [ Build Python bindings (optional)] ( #build-python-bindings-optional )
57
58
- [ CMake Presets] ( #cmake-presets )
58
59
- [ Configure Presets] ( #configure-presets )
59
60
- [ Build \& Test Presets] ( #build--test-presets )
@@ -66,11 +67,16 @@ This project serves as both a learning resource and a reference implementation f
66
67
- [ Run on all files (optional)] ( #run-on-all-files-optional )
67
68
- [ What the hooks do] ( #what-the-hooks-do )
68
69
- [ 🎯 Usage] ( #-usage )
70
+ - [ Python Usage] ( #python-usage )
69
71
- [ 📁 Project Structure] ( #-project-structure )
70
72
- [ 🔧 Components Overview] ( #-components-overview )
71
73
- [ 💻 Development Notes] ( #-development-notes )
72
74
- [ Code Style] ( #code-style )
73
75
- [ Pre-commit Configuration] ( #pre-commit-configuration )
76
+ - [ Python Development] ( #python-development )
77
+ - [ Testing] ( #testing )
78
+ - [ Examples and Documentation] ( #examples-and-documentation )
79
+ - [ Code Quality] ( #code-quality )
74
80
- [ 📄 License] ( #-license )
75
81
76
82
## 🎓 What You'll Learn
@@ -141,6 +147,14 @@ ctest --preset release
141
147
``` bash
142
148
cmake --preset release -DBUILD_PYTHON_BINDINGS=ON
143
149
cmake --build --preset release
150
+
151
+ # Test Python bindings (optional)
152
+ cd python_tests
153
+ python -m pytest --verbose
154
+
155
+ # Run Python examples (optional)
156
+ python python_examples/basic_usage.py
157
+ python python_examples/advanced_usage.py
144
158
```
145
159
146
160
### CMake Presets
@@ -351,8 +365,29 @@ cpp-demo-project/
351
365
├── src/ # Source implementation files
352
366
│ ├── CMakeLists.txt # Components configuration
353
367
│ └── [mirrors include structure]
354
- ├── examples/ # Usage examples and demonstrations
355
- ├── tests/ # Test suite using Catch2 v3
368
+ ├── binding/ # pybind11 C++ binding files
369
+ │ ├── CMakeLists.txt # Python bindings configuration
370
+ │ ├── cpp_features.cpp # Main pybind11 module
371
+ │ └── [module]_binding.cpp # Individual module bindings
372
+ ├── python/ # Python wrapper modules
373
+ │ ├── __init__.py # Package initialization
374
+ │ ├── shapes.py # Enhanced shape functionality
375
+ │ ├── containers.py # Pythonic container wrappers
376
+ │ ├── algorithms.py # Functional programming utilities
377
+ │ ├── exceptions.py # Result types and error handling
378
+ │ ├── memory.py # RAII and resource management
379
+ │ ├── timing.py # High-resolution timing utilities
380
+ │ └── random.py # Enhanced random number generation
381
+ ├── python_tests/ # Python test suite using pytest
382
+ │ ├── __init__.py # Test package initialization
383
+ │ ├── conftest.py # pytest configuration and fixtures
384
+ │ └── test_[module].py # Comprehensive module tests
385
+ ├── python_examples/ # Python usage examples
386
+ │ ├── README.md # Examples documentation
387
+ │ ├── basic_usage.py # Fundamental usage patterns
388
+ │ └── advanced_usage.py # Advanced and real-world examples
389
+ ├── examples/ # C++ usage examples and demonstrations
390
+ ├── tests/ # C++ test suite using Catch2 v3
356
391
├── .clang-format # clang-format configuration (for C++ code formatting)
357
392
├── .clang-tidy # clang-tidy configuration (for static analysis)
358
393
├── .clangd # clangd configuration (for code completion)
@@ -433,6 +468,31 @@ repos:
433
468
- Enforced coding standards for all contributors
434
469
- Integration with modern formatting tools
435
470
471
+ ### Python Development
472
+
473
+ The project includes comprehensive Python bindings and tooling:
474
+
475
+ #### Testing
476
+
477
+ - **pytest-based test suite**: Located in ` python_tests/` with comprehensive coverage
478
+ - **C++ test pattern adoption**: Python tests mirror C++ test structure and patterns
479
+ - **Fixtures and configuration**: Shared test utilities in `conftest.py`
480
+ - **Type safety testing**: Verifies type annotations and generic behavior
481
+
482
+ # ### Examples and Documentation
483
+
484
+ - **Basic examples**: `python_examples/basic_usage.py` demonstrates fundamental usage
485
+ - **Advanced examples**: `python_examples/advanced_usage.py` shows real-world patterns
486
+ - **Comprehensive documentation**: Numpy-style docstrings throughout
487
+ - **Modern Python features**: Extensive use of Python 3.13 features like pattern matching
488
+
489
+ # ### Code Quality
490
+
491
+ - **Black formatting**: Consistent Python code style
492
+ - **Type annotations**: Full type hint coverage with modern typing
493
+ - **Error handling**: Result types for functional error management
494
+ - **Performance integration**: Built-in timing and benchmarking utilities
495
+
436
496
# # 📄 License
437
497
438
498
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
0 commit comments