Cross-platform C++ library with Python bindings via pybind11
Project description
MyLib (pybind11 Version)
A cross-platform C++ library with a Python interface using pybind11.
Features
- C++ core logic
- Pythonic interface via
pybind11 - Builds on Windows, Linux, and macOS
- Packaged using
scikit-build-core - Visual Studio 2022 solution generation via CMake
- Includes C++ and Python tests
🛠 Build & Install Locally (Python)
Step 1: Install Build Requirements
pip install scikit-build-core pybind11[global] build
Step 2: Install the Package
pip install .
Or build a wheel:
python -m build
🧪 Python Usage
from mylib import MyLib
lib = MyLib()
lib.do_work()
print(lib.get_counter())
lib.reset_counter()
To run tests:
python tests/test_python.py
🧰 C++ Development & Testing (Visual Studio 2022)
Step 1: Open Visual Studio 2022 Developer Command Prompt
Launch "x64 Native Tools Command Prompt for VS 2022"
Step 2: Create Build Directory and Generate Solution
cd mylib
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64
This generates MyLib.sln which you can open with Visual Studio.
Step 3: Build in Release Mode
cmake --build . --config Release
Step 4: Run the C++ Test
./Release/test_mylib.exe
🚀 Publish to PyPI
Step 1: Create an Account
- Register at https://pypi.org/account/register/
- Generate an API token
Step 2: Install Twine
pip install twine
Step 3: Build the Package
python -m build
Step 4: Upload to PyPI
twine upload dist/*
Use __token__ as your username and paste the token when prompted.
🧱 Project Layout
mylib/
├── CMakeLists.txt
├── pyproject.toml
├── README.md
├── src/
│ ├── CMakeLists.txt
│ ├── mylib.cpp
│ └── test.cpp
├── tests/
│ └── test_python.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acube3_mylib-0.1.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: acube3_mylib-0.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 2.9 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd02a39d52da301b28ce37d6a4aa31dadd4d962900dd95ea21123ce0f0992795
|
|
| MD5 |
462fb5abd02b91754f57665a9bf757a0
|
|
| BLAKE2b-256 |
6e83c5d2055e08112b72a5b95ec772af92ee477d02fecc68bc6242a52939cb82
|