cppdantic 0.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ # sdist + manylinux_2_28 x86_64 wheels (cibuildwheel), upload to PyPI on tag v*.
2
+ # Requires repository secret: PYPI_API_TOKEN
3
+
4
+ name: Publish to PyPI
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - "v*"
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ # Independent package: install easybind from PyPI, then poll until pins resolve.
27
+ - name: Wait for pinned easybind on PyPI
28
+ run: |
29
+ python -m pip install "easybind~=0.2.14"
30
+ easybind-wait-pypi
31
+
32
+ - name: Install build tools
33
+ run: pip install --upgrade build twine
34
+
35
+ - name: Build sdist
36
+ run: python -m build --sdist
37
+
38
+ - name: Build manylinux wheels
39
+ uses: pypa/cibuildwheel@v3.4.0
40
+
41
+ - name: Stage wheels next to sdist
42
+ run: cp wheelhouse/*.whl dist/
43
+
44
+ - name: Check distributions
45
+ run: twine check dist/*
46
+
47
+ - name: Publish to PyPI
48
+ uses: pypa/gh-action-pypi-publish@release/v1
49
+ with:
50
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,212 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ uv.lock
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # nanobind stubgen (regenerated by CMake `nanobind_add_stub`)
12
+ src/cppdantic/__init__.pyi
13
+
14
+ # setuptools-scm (see RELEASING.md)
15
+ src/cppdantic/_version.py
16
+
17
+ # Distribution / packaging
18
+ .Python
19
+ build/
20
+ develop-eggs/
21
+ dist/
22
+ downloads/
23
+ eggs/
24
+ .eggs/
25
+ lib/
26
+ lib64/
27
+ parts/
28
+ sdist/
29
+ var/
30
+ wheels/
31
+ share/python-wheels/
32
+ *.egg-info/
33
+ .installed.cfg
34
+ *.egg
35
+ MANIFEST
36
+
37
+ # PyInstaller
38
+ # Usually these files are written by a python script from a template
39
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40
+ *.manifest
41
+ *.spec
42
+
43
+ # Installer logs
44
+ pip-log.txt
45
+ pip-delete-this-directory.txt
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+ .coverage
52
+ .coverage.*
53
+ .cache
54
+ nosetests.xml
55
+ coverage.xml
56
+ *.cover
57
+ *.py.cover
58
+ .hypothesis/
59
+ .pytest_cache/
60
+ cover/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+ db.sqlite3
70
+ db.sqlite3-journal
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+
82
+ # PyBuilder
83
+ .pybuilder/
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # IPython
90
+ profile_default/
91
+ ipython_config.py
92
+
93
+ # pyenv
94
+ # For a library or package, you might want to ignore these files since the code is
95
+ # intended to run in multiple environments; otherwise, check them in:
96
+ # .python-version
97
+
98
+ # pipenv
99
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
101
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
102
+ # install all needed dependencies.
103
+ #Pipfile.lock
104
+
105
+ # UV — not committing the lockfile for this project
106
+ uv.lock
107
+
108
+ # poetry
109
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113
+ #poetry.lock
114
+ #poetry.toml
115
+
116
+ # pdm
117
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
118
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
119
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
120
+ #pdm.lock
121
+ #pdm.toml
122
+ .pdm-python
123
+ .pdm-build/
124
+
125
+ # pixi
126
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
127
+ #pixi.lock
128
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
129
+ # in the .venv directory. It is recommended not to include this directory in version control.
130
+ .pixi
131
+
132
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
133
+ __pypackages__/
134
+
135
+ # Celery stuff
136
+ celerybeat-schedule
137
+ celerybeat.pid
138
+
139
+ # SageMath parsed files
140
+ *.sage.py
141
+
142
+ # Environments
143
+ .env
144
+ .envrc
145
+ .venv
146
+ env/
147
+ venv/
148
+ ENV/
149
+ env.bak/
150
+ venv.bak/
151
+
152
+ # Spyder project settings
153
+ .spyderproject
154
+ .spyproject
155
+
156
+ # Rope project settings
157
+ .ropeproject
158
+
159
+ # mkdocs documentation
160
+ /site
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+
170
+ # pytype static type analyzer
171
+ .pytype/
172
+
173
+ # Cython debug symbols
174
+ cython_debug/
175
+
176
+ # PyCharm
177
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
178
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
179
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
180
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
181
+ #.idea/
182
+
183
+ # Abstra
184
+ # Abstra is an AI-powered process automation framework.
185
+ # Ignore directories containing user credentials, local state, and settings.
186
+ # Learn more at https://abstra.io/docs
187
+ .abstra/
188
+
189
+ # Visual Studio Code
190
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
191
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
192
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
193
+ # you could uncomment the following to ignore the entire vscode folder
194
+ # .vscode/
195
+
196
+ # Ruff stuff:
197
+ .ruff_cache/
198
+
199
+ # PyPI configuration file
200
+ .pypirc
201
+
202
+ # Cursor
203
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
204
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
205
+ # refer to https://docs.cursor.com/context/ignore-files
206
+ .cursorignore
207
+ .cursorindexingignore
208
+
209
+ # Marimo
210
+ marimo/_static/
211
+ marimo/_lsp/
212
+ __marimo__/
@@ -0,0 +1,3 @@
1
+ [submodule "external/easybind"]
2
+ path = external/easybind
3
+ url = https://github.com/pymergetic/easybind
@@ -0,0 +1,47 @@
1
+ cmake_minimum_required(VERSION 3.25)
2
+
3
+ project(cppdantic LANGUAGES CXX)
4
+
5
+ set(CMAKE_CXX_STANDARD 20)
6
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
7
+
8
+ include(GNUInstallDirs)
9
+
10
+ find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
11
+ execute_process(
12
+ COMMAND "${Python_EXECUTABLE}" -c
13
+ "import pathlib, easybind; print(pathlib.Path(easybind.__file__).resolve().parent / 'cmake' / 'easybind_pip.cmake')"
14
+ OUTPUT_STRIP_TRAILING_WHITESPACE
15
+ OUTPUT_VARIABLE _eb_pip
16
+ COMMAND_ERROR_IS_FATAL ANY
17
+ )
18
+ include("${_eb_pip}")
19
+ easybind_pip_setup()
20
+ easybind_fetch_magic_enum()
21
+
22
+ nanobind_add_module(cppdantic__init__ NB_SHARED src/cppdantic/hello.cpp)
23
+ target_include_directories(cppdantic__init__ PRIVATE "${EASYBIND_INCLUDE_ROOT}")
24
+ target_link_libraries(cppdantic__init__ PRIVATE "${EASYBIND_CORE_LIB}")
25
+ easybind_pip_link_magic_enum(cppdantic__init__)
26
+
27
+ set_target_properties(cppdantic__init__ PROPERTIES
28
+ OUTPUT_NAME "__init__"
29
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cppdantic"
30
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cppdantic"
31
+ )
32
+
33
+ easybind_pip_set_rpath_next_to_easybind(cppdantic__init__ "${EASYBIND_PKG_DIR}")
34
+
35
+ # Typings for editors / type checkers (same mechanism as easybind: nanobind_add_stub).
36
+ set(_cppdantic_pyi "${CMAKE_CURRENT_SOURCE_DIR}/src/cppdantic/__init__.pyi")
37
+ get_filename_component(_cppdantic_pyi_dir "${_cppdantic_pyi}" DIRECTORY)
38
+ file(MAKE_DIRECTORY "${_cppdantic_pyi_dir}")
39
+ nanobind_add_stub(cppdantic_stub
40
+ MODULE cppdantic
41
+ OUTPUT ${_cppdantic_pyi}
42
+ PYTHON_PATH $<TARGET_FILE_DIR:cppdantic__init__>
43
+ DEPENDS cppdantic__init__
44
+ )
45
+
46
+ install(TARGETS cppdantic__init__ LIBRARY DESTINATION cppdantic)
47
+ install(FILES ${_cppdantic_pyi} DESTINATION cppdantic)
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: cppdantic
3
+ Version: 0.0.7
4
+ Summary: Hello-world nanobind extension built against the easybind package (demo / CI smoke test)
5
+ Keywords: cppdantic,nanobind,easybind,bindings,pymergetic
6
+ Author-Email: PymergeticOS Maintainers <raudzus@pymergetic.com>
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: C++
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Typing :: Typed
18
+ Project-URL: Homepage, https://github.com/pymergetic/cppdantic
19
+ Project-URL: Repository, https://github.com/pymergetic/cppdantic
20
+ Project-URL: Issues, https://github.com/pymergetic/cppdantic/issues
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: easybind~=0.2.15
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=7.0.0; extra == "test"
25
+ Requires-Dist: scikit-build-core>=0.10; extra == "test"
26
+ Requires-Dist: setuptools-scm>=8; extra == "test"
27
+ Description-Content-Type: text/markdown
28
+
29
+ # cppdantic
30
+
31
+ Small demo that **builds against the `easybind` package from PyPI**. **cppdantic** and **easybind** are **independent** projects (separate repos, separate PyPI names). This repo may include **`external/easybind`** as an **optional git submodule** only so you can browse both trees in one checkout — it is **not** wired into `pyproject.toml` as a path dependency.
32
+
33
+ **PyPI:** [`cppdantic`](https://pypi.org/project/cppdantic/) (when published). Versioning and tags: **`RELEASING.md`**.
34
+
35
+ **Bumping `easybind~=…`:** **`easybind-pin-pyproject`** (from **easybind**). Default = latest **`v*`** tag on **GitHub** (repo URL from that package’s PyPI metadata). Use **`--from-pypi`** for PyPI’s published latest instead — see **`RELEASING.md`**.
36
+
37
+ ## Build / test
38
+
39
+ You need **`easybind`** installed from **PyPI** (matching the pin in **`pyproject.toml`**), plus CMake ≥ 3.25, Ninja, and a C++20 compiler on `PATH`:
40
+
41
+ ```bash
42
+ python -m pip install -U pip
43
+ python -m pip install "easybind~=0.2.14" # align with pyproject.toml
44
+ python -m pip install -e '.[test]'
45
+ python -m pytest tests -q
46
+ ```
47
+
48
+ `CMake` loads **`easybind/cmake/easybind_pip.cmake`** from the **installed** **`easybind`** package. PyPI must ship the **`cmake/`** tree for the version you pin.
49
+
50
+ **Optional submodule:** if you use **`git submodule update --init external/easybind`**, you can also **`pip install -e /path/to/easybind`** from that checkout — it is the same **easybind** project, not a special cppdantic path override.
51
+
52
+ ### uv
53
+
54
+ From the **cppdantic repo root**:
55
+
56
+ ```bash
57
+ uv pip install "easybind~=0.2.14"
58
+ uv pip install -e ".[test]"
59
+ ```
60
+
61
+ (`pyproject.toml` sets **`[tool.uv] no-build-isolation-package = ["cppdantic"]`** so editable builds use your venv; the **`[test]`** extra pulls in **`setuptools-scm`** and **`scikit-build-core`** for that mode.)
62
+
63
+ If **`uv pip install`** fails with **`Metadata mismatch in METADATA`** (setuptools-scm version differs between build phases), clear stale artifacts and install **easybind first**, then **cppdantic**:
64
+
65
+ ```bash
66
+ rm -rf build dist *.egg-info src/cppdantic/*.egg-info
67
+ uv pip install -e external/easybind/
68
+ uv pip install -e ".[test]"
69
+ ```
70
+
71
+ Ensure **`src/cppdantic/_version.py`** is not tracked by git (it is gitignored). If it was ever committed, run **`git rm --cached src/cppdantic/_version.py`**.
72
+
73
+ ## Tagging
74
+
75
+ Create an annotated **`v*`** tag on **`main`** after your pins commit (see **`RELEASING.md`**).
@@ -0,0 +1,47 @@
1
+ # cppdantic
2
+
3
+ Small demo that **builds against the `easybind` package from PyPI**. **cppdantic** and **easybind** are **independent** projects (separate repos, separate PyPI names). This repo may include **`external/easybind`** as an **optional git submodule** only so you can browse both trees in one checkout — it is **not** wired into `pyproject.toml` as a path dependency.
4
+
5
+ **PyPI:** [`cppdantic`](https://pypi.org/project/cppdantic/) (when published). Versioning and tags: **`RELEASING.md`**.
6
+
7
+ **Bumping `easybind~=…`:** **`easybind-pin-pyproject`** (from **easybind**). Default = latest **`v*`** tag on **GitHub** (repo URL from that package’s PyPI metadata). Use **`--from-pypi`** for PyPI’s published latest instead — see **`RELEASING.md`**.
8
+
9
+ ## Build / test
10
+
11
+ You need **`easybind`** installed from **PyPI** (matching the pin in **`pyproject.toml`**), plus CMake ≥ 3.25, Ninja, and a C++20 compiler on `PATH`:
12
+
13
+ ```bash
14
+ python -m pip install -U pip
15
+ python -m pip install "easybind~=0.2.14" # align with pyproject.toml
16
+ python -m pip install -e '.[test]'
17
+ python -m pytest tests -q
18
+ ```
19
+
20
+ `CMake` loads **`easybind/cmake/easybind_pip.cmake`** from the **installed** **`easybind`** package. PyPI must ship the **`cmake/`** tree for the version you pin.
21
+
22
+ **Optional submodule:** if you use **`git submodule update --init external/easybind`**, you can also **`pip install -e /path/to/easybind`** from that checkout — it is the same **easybind** project, not a special cppdantic path override.
23
+
24
+ ### uv
25
+
26
+ From the **cppdantic repo root**:
27
+
28
+ ```bash
29
+ uv pip install "easybind~=0.2.14"
30
+ uv pip install -e ".[test]"
31
+ ```
32
+
33
+ (`pyproject.toml` sets **`[tool.uv] no-build-isolation-package = ["cppdantic"]`** so editable builds use your venv; the **`[test]`** extra pulls in **`setuptools-scm`** and **`scikit-build-core`** for that mode.)
34
+
35
+ If **`uv pip install`** fails with **`Metadata mismatch in METADATA`** (setuptools-scm version differs between build phases), clear stale artifacts and install **easybind first**, then **cppdantic**:
36
+
37
+ ```bash
38
+ rm -rf build dist *.egg-info src/cppdantic/*.egg-info
39
+ uv pip install -e external/easybind/
40
+ uv pip install -e ".[test]"
41
+ ```
42
+
43
+ Ensure **`src/cppdantic/_version.py`** is not tracked by git (it is gitignored). If it was ever committed, run **`git rm --cached src/cppdantic/_version.py`**.
44
+
45
+ ## Tagging
46
+
47
+ Create an annotated **`v*`** tag on **`main`** after your pins commit (see **`RELEASING.md`**).
@@ -0,0 +1,117 @@
1
+ # Releasing cppdantic to PyPI
2
+
3
+ **Pins vs installs:** **`easybind-pin-pyproject`** (default) sets pins from the **latest `v*`** tag on **GitHub**. **cppdantic** still **builds and ships wheels that `pip install easybind`** — that means **PyPI**. Wait until the pinned **`easybind==A.B.C`** exists on PyPI before you rely on isolated installs or CI (see **`easybind-wait-pypi`** in cppdantic’s publish workflow).
4
+
5
+ ## End-to-end workflow (easybind → PyPI → bump cppdantic → tag)
6
+
7
+ Do this in order.
8
+
9
+ ### 1) Release **easybind** (separate repo; submodule path shown for this monorepo)
10
+
11
+ ```bash
12
+ cd /path/to/easybind # e.g. ~/Devel/cppdantic/external/easybind
13
+
14
+ git fetch origin && git checkout main && git pull origin main
15
+ # commit anything not on main, then:
16
+
17
+ export EB_TAG=v0.2.4 # choose the new version
18
+ git tag -a "$EB_TAG" -m "easybind ${EB_TAG#v}"
19
+ git push origin main
20
+ git push origin "$EB_TAG"
21
+ ```
22
+
23
+ - Wait until GitHub **Publish to PyPI** on **easybind** finishes.
24
+ - Check PyPI: **https://pypi.org/project/easybind/** shows **`easybind==`** that version (or `pip install 'easybind==…'` in a clean venv).
25
+
26
+ ### 2) Bump **cppdantic** `pyproject.toml` pins (manual; not CI)
27
+
28
+ ```bash
29
+ cd /path/to/cppdantic
30
+ python -m pip install -U "easybind" # refresh devtools / metadata helpers
31
+
32
+ easybind-pin-pyproject --dry-run
33
+ easybind-pin-pyproject # sets all easybind~= lines to latest GitHub v* tag (or: --version A.B.C)
34
+
35
+ git add pyproject.toml
36
+ git commit -m "Bump easybind pins"
37
+ git push origin main
38
+ ```
39
+
40
+ ### 3) Tag **cppdantic**
41
+
42
+ Bump the next **`vMAJOR.MINOR.PATCH`** from the latest **`v*`** tag (usually **patch**). Example:
43
+
44
+ ```bash
45
+ cd /path/to/cppdantic
46
+ git fetch --tags
47
+ export TAG=v0.1.1 # choose the next version
48
+ git tag -a "$TAG" -m "cppdantic ${TAG#v}"
49
+ git push origin main
50
+ git push origin "$TAG"
51
+ ```
52
+
53
+ **GitHub vs PyPI:** the cppdantic tag can exist while the publish workflow fails; **`PYPI_API_TOKEN`** must be set on the **cppdantic** repo. Do not tag **cppdantic** for a pin you cannot **`pip install`** yet — CI uses **`easybind-wait-pypi`** so the workflow waits for PyPI.
54
+
55
+ **CI wait:** the **Publish to PyPI** workflow installs **easybind** from PyPI and runs **`easybind-wait-pypi`** (same behavior as easybind’s wait script): it polls until **`easybind==X.Y.Z`** from your pins exists (default timeout 30 minutes, 30 s interval). Keep the **`pip install "easybind~=…"`** line in **`.github/workflows/publish.yml`** in sync with **`pyproject.toml`** when you bump pins. **No git submodule** is required for cppdantic CI.
56
+
57
+ ---
58
+
59
+ ## Order: easybind first, then bump pins
60
+
61
+ **cppdantic** builds against whatever **`easybind`** you install; CI and wheels must see a matching release on PyPI.
62
+
63
+ 1. **easybind** (separate repo): merge your changes, tag **`vA.B.C`**, **`git push origin vA.B.C`**, and wait until the **Publish to PyPI** workflow finishes and **`easybind==A.B.C`** is installable from PyPI.
64
+ 2. **cppdantic**: bump **every** `easybind~=…` in **`pyproject.toml`** (same `A.B.C` in all three places: **`[build-system] requires`**, **`dependencies`**, **`[tool.cibuildwheel.linux] test-requires`**). Automate with **easybind**’s helper (after `pip install easybind` in your venv):
65
+
66
+ ```bash
67
+ cd /path/to/cppdantic
68
+ easybind-pin-pyproject --dry-run # preview (default: latest v* tag on GitHub)
69
+ easybind-pin-pyproject # pins follow GitHub tags (PyPI metadata supplies github.com/…)
70
+ ```
71
+
72
+ **`--from-pypi`:** use this if you want pins to match PyPI’s **published** latest (`info.version`) instead of the highest **`v*`** tag on GitHub (e.g. conservative bumps, or no GitHub URL in metadata — then set **`--from-github YOUR_ORG/easybind`** or fix PyPI project URLs).
73
+
74
+ Set **`GITHUB_TOKEN`** if the repo is private or you hit rate limits. Pin manually when needed: **`--version 0.2.6`**. **`--installed`** only helps after **`pip install`** has that version in the venv.
75
+
76
+ Before tagging **cppdantic**, ensure the pinned **`easybind==A.B.C`** is on **PyPI** if you expect **`pip install`** / CI to succeed.
77
+
78
+ Or import **`easybind.devtools`** — see **easybind**’s README.
79
+
80
+ **This is not run by CI or by `pip install`.** It only changes files when **you** run it and **commit** the diff. Builds always use whatever **`easybind~=…`** is already in **`pyproject.toml`** on that commit.
81
+
82
+ 3. **Commit that bump on `main` before you create the cppdantic tag.** The tag must point at a commit that already contains the updated **`pyproject.toml`**.
83
+
84
+ If you tag cppdantic before the matching easybind wheel exists, isolated builds and cibuildwheel tests can fail.
85
+
86
+ ## Version
87
+
88
+ Setuptools-scm reads **cppdantic**’s version from **`TAG`** only. **`easybind~=…`** must already be committed and resolvable on PyPI.
89
+
90
+ Versions come from **Git tags** via **setuptools-scm** (same idea as easybind):
91
+
92
+ - Tag **`vMAJOR.MINOR.PATCH`** (e.g. `v0.1.0`) on the commit you want to release.
93
+ - On that exact tag, the sdist/wheel version is **`MAJOR.MINOR.PATCH`** (`no-guess-dev` + `no-local-version`).
94
+ - Untagged trees get a dev version (fine for local installs; for PyPI, tag cleanly).
95
+
96
+ The wheel metadata version comes from setuptools-scm (no checked-in **`_version.py`** — avoids editable-install metadata mismatches; use **`importlib.metadata.version("cppdantic")`** at runtime).
97
+
98
+ ## CI publish
99
+
100
+ Pushing a tag **`v*`** runs **`.github/workflows/publish.yml`**: sdist, **cibuildwheel** (manylinux\_2\_28 x86\_64), **twine check**, upload to PyPI.
101
+
102
+ Set the **`PYPI_API_TOKEN`** repository secret (scoped to this project).
103
+
104
+ ## Manual dry run
105
+
106
+ ```bash
107
+ python -m pip install build twine
108
+ git fetch --tags
109
+ python -m build
110
+ twine check dist/*
111
+ # twine upload dist/*
112
+ ```
113
+
114
+ ## Notes
115
+
116
+ - **Runtime:** the extension expects **`easybind`** installed at the version pinned in **`pyproject.toml`** (e.g. `easybind~=0.2.14`) so **`libeasybind.so`** and headers resolve next to **`site-packages/easybind`** (RPATH **`$ORIGIN/../easybind`**).
117
+ - **Wheels** are Linux x86\_64 manylinux for now; extend the workflow if you need macOS/Windows.
@@ -0,0 +1,92 @@
1
+ [build-system]
2
+ requires = ["scikit-build-core>=0.10", "setuptools-scm>=8", "easybind~=0.2.15"]
3
+ build-backend = "scikit_build_core.build"
4
+
5
+ # uv: build cppdantic in the project venv so `import easybind` matches your editable easybind (see README).
6
+ # With no-build-isolation, [build-system] deps are not installed into the venv automatically — install them
7
+ # (e.g. via optional-deps below) before `uv pip install -e .`.
8
+ [tool.uv]
9
+ no-build-isolation-package = ["cppdantic"]
10
+
11
+ [project]
12
+ name = "cppdantic"
13
+ dynamic = ["version"]
14
+ description = "Hello-world nanobind extension built against the easybind package (demo / CI smoke test)"
15
+ readme = "README.md"
16
+ requires-python = ">=3.11"
17
+ license = "Apache-2.0"
18
+ license-files = ["LICENSE"]
19
+ authors = [
20
+ { name = "PymergeticOS Maintainers", email = "raudzus@pymergetic.com" }
21
+ ]
22
+ keywords = ["cppdantic", "nanobind", "easybind", "bindings", "pymergetic"]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Programming Language :: Python :: 3.13",
29
+ "Programming Language :: Python :: 3.14",
30
+ "Programming Language :: C++",
31
+ "Operating System :: POSIX :: Linux",
32
+ "Typing :: Typed",
33
+ ]
34
+
35
+ dependencies = ["easybind~=0.2.15"]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/pymergetic/cppdantic"
39
+ Repository = "https://github.com/pymergetic/cppdantic"
40
+ Issues = "https://github.com/pymergetic/cppdantic/issues"
41
+
42
+ [project.optional-dependencies]
43
+ # scikit-build-core + setuptools-scm: required in the venv for editable builds when using no-build-isolation.
44
+ test = [
45
+ "pytest>=7.0.0",
46
+ "scikit-build-core>=0.10",
47
+ "setuptools-scm>=8",
48
+ ]
49
+
50
+ [tool.pytest.ini_options]
51
+ testpaths = ["tests"]
52
+
53
+ # Linux wheels: see .github/workflows/publish.yml
54
+ [tool.cibuildwheel]
55
+ build = "cp311-* cp312-* cp313-* cp314-*"
56
+ skip = "*musllinux*"
57
+ manylinux-x86_64-image = "manylinux_2_28"
58
+ build-verbosity = 1
59
+
60
+ [tool.cibuildwheel.linux]
61
+ # Install easybind into the container Python so libeasybind.so / libnanobind.so exist on disk.
62
+ # auditwheel repair cannot see libs that only existed in PEP517 build isolation; it needs paths
63
+ # like site-packages/easybind/ on LD_LIBRARY_PATH.
64
+ before-build = [
65
+ "python -m pip install --upgrade pip",
66
+ "python -m pip install 'cmake>=3.25' ninja 'easybind~=0.2.15'",
67
+ ]
68
+ repair-wheel-command = "python -m pip install -q --upgrade 'easybind~=0.2.15' 'auditwheel>=6.4' && EB=$(python -c 'import pathlib, easybind; print(pathlib.Path(easybind.__file__).resolve().parent)') && LD_LIBRARY_PATH=\"$EB:${LD_LIBRARY_PATH:-}\" python -m auditwheel -v repair --plat manylinux_2_28_x86_64 -w {dest_dir} {wheel}"
69
+ test-requires = ["pytest>=7.0.0", "easybind~=0.2.15"]
70
+ test-command = "python -m pytest {project}/tests -q"
71
+
72
+ [tool.scikit-build]
73
+ cmake.version = ">=3.25"
74
+ logging.level = "INFO"
75
+ minimum-version = "0.10"
76
+ metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
77
+ build-dir = "build"
78
+
79
+ [tool.scikit-build.cmake.define]
80
+ CMAKE_EXPORT_COMPILE_COMMANDS = "ON"
81
+
82
+ [tool.scikit-build.wheel]
83
+ packages = { "cppdantic" = "src/cppdantic" }
84
+
85
+ [tool.setuptools_scm]
86
+ version_scheme = "no-guess-dev"
87
+ local_scheme = "no-local-version"
88
+ fallback_version = "0.0.0"
89
+ root = "."
90
+ # Do not set version_file/write_to here: scikit-build-core calls setuptools-scm twice for editable
91
+ # installs (metadata + wheel). Writing _version.py between calls can change git/dirty state and
92
+ # trigger "Metadata mismatch" (e.g. devN vs devN+1). Use importlib.metadata.version("cppdantic") at runtime.
@@ -0,0 +1,6 @@
1
+ #include <easybind/bind.hpp>
2
+
3
+ EASYBIND_NS_MODULE_SHARED_OBJECT(cppdantic, cppdantic, m, true, {
4
+ m.doc() = "cppdantic hello-world (built against PyPI easybind)";
5
+ m.def("hello", []() { return std::string("hello from cppdantic"); });
6
+ });
@@ -0,0 +1,4 @@
1
+ def test_hello():
2
+ import cppdantic
3
+
4
+ assert cppdantic.hello() == "hello from cppdantic"