Skip to content

Commit 45e33b1

Browse files
authored
Merge pull request #252 from robotpy/semiwrap
rename project to semiwrap
2 parents 0d74e04 + e11c7a3 commit 45e33b1

File tree

323 files changed

+4611
-4664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+4611
-4664
lines changed

.github/workflows/dist.yml

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
with:
5151
submodules: true
5252

53-
- uses: actions/setup-python@v4
53+
- uses: actions/setup-python@v5
5454
with:
5555
python-version: 3.8
5656
- name: Sphinx
@@ -67,7 +67,7 @@ jobs:
6767
submodules: recursive
6868
fetch-depth: 0
6969

70-
- uses: actions/setup-python@v4
70+
- uses: actions/setup-python@v5
7171
with:
7272
python-version: 3.8
7373

@@ -97,12 +97,12 @@ jobs:
9797
- '3.11'
9898
- '3.12'
9999
- '3.13'
100-
architecture: [x86, x64]
101-
exclude:
102-
- os: macos-13
103-
architecture: x86
104-
- os: ubuntu-22.04
105-
architecture: x86
100+
architecture: [x64]
101+
# exclude:
102+
# - os: macos-13
103+
# architecture: x86
104+
# - os: ubuntu-22.04
105+
# architecture: x86
106106
include:
107107
- os: macos-14
108108
python_version: 3.9
@@ -116,7 +116,7 @@ jobs:
116116
with:
117117
submodules: true
118118

119-
- uses: actions/setup-python@v4
119+
- uses: actions/setup-python@v5
120120
with:
121121
python-version: ${{ matrix.python_version }}
122122
architecture: ${{ matrix.architecture }}
@@ -133,25 +133,32 @@ jobs:
133133
key: ${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.python_version }}
134134
variant: ccache
135135

136+
- name: Setup MSVC
137+
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
138+
with:
139+
architecture: x64
140+
if: runner.os == 'Windows'
141+
142+
- name: Configure ccache for MSVC
143+
shell: bash
144+
# https://github.com/mesonbuild/meson/issues/10423
145+
run: |
146+
echo "CC=ccache.exe cl" >> $GITHUB_ENV
147+
echo "CXX=ccache.exe cl" >> $GITHUB_ENV
148+
if: runner.os == 'Windows'
149+
136150
- name: Install
137151
shell: bash
138152
working-directory: dist
139153
run: python -m pip --disable-pip-version-check install *.whl
140154

141155
- name: Install test dependencies
142-
shell: bash
143156
working-directory: tests
144157
run: python -m pip --disable-pip-version-check install -r requirements.txt
145158

146159
- name: Test wheel
147-
shell: bash
148-
env:
149-
RPYBUILD_PARALLEL: 1
150-
RPYBUILD_STRIP_LIBPYTHON: 1
151-
RPYBUILD_CC_LAUNCHER: ccache
152160
working-directory: tests
153-
run: |
154-
python run_tests.py
161+
run: python run_tests.py
155162

156163
cross-build:
157164
runs-on: ubuntu-latest
@@ -160,8 +167,8 @@ jobs:
160167
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
161168
matrix:
162169
container:
163-
- wpilib/roborio-cross-ubuntu:2024-22.04-py312
164-
- wpilib/raspbian-cross-ubuntu:bullseye-22.04-py312
170+
- wpilib/roborio-cross-ubuntu:2025-22.04-py313
171+
- wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py313
165172

166173
container:
167174
image: "${{ matrix.container }}"
@@ -183,33 +190,23 @@ jobs:
183190
name: dist
184191
path: dist
185192

186-
- name: Install setuptools
187-
run: |
188-
/build/venv/bin/build-pip --disable-pip-version-check install setuptools
189-
/build/venv/bin/cross-pip --disable-pip-version-check install setuptools
193+
- name: Setup cross environment
194+
uses: robotpy/build-actions/setup-cross-meson@semiwrap
190195

191196
- name: Install
192197
working-directory: dist
193198
run: |
194-
# install to both cross and build in case things get mixed up
195199
/build/venv/bin/build-pip --disable-pip-version-check install *.whl
196-
/build/venv/bin/cross-pip --disable-pip-version-check install *.whl
197200
198201
- name: Install test dependencies
199202
shell: bash
200203
working-directory: tests
201204
run: |
202-
# install to both cross and build in case things get mixed up
203205
/build/venv/bin/build-pip --disable-pip-version-check install -r requirements.txt
204-
/build/venv/bin/cross-pip --disable-pip-version-check install -r requirements.txt
205206
206207
- name: Build cross wheel
207-
env:
208-
RPYBUILD_PARALLEL: 1
209-
RPYBUILD_STRIP_LIBPYTHON: 1
210-
RPYBUILD_CC_LAUNCHER: ccache
211208
working-directory: tests/cpp
212-
run: /build/venv/bin/cross-python run_install.py wheel
209+
run: /build/venv/bin/cross-python run_install.py --config-settings=setup-args=--cross-file=cross.txt
213210

214211
publish:
215212
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ __pycache__
77
/dist
88
/build
99

10-
/robotpy_build/version.py
10+
/src/semiwrap/version.py

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "robotpy_build/pybind11"]
2-
path = robotpy_build/pybind11
1+
[submodule "src/semiwrap/pybind11"]
2+
path = src/semiwrap/pybind11
33
url = https://github.com/pybind/pybind11.git

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020 Dustin Spicuzza <[email protected]>, All rights reserved.
1+
Copyright (c) 2020-2025 Dustin Spicuzza <[email protected]>, All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions are met:

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
robotpy-build
2-
=============
1+
semiwrap
2+
========
33

4-
This is a build tool intended to be generally useful for any python project
5-
that has binary dependencies. It is especially designed to meet the needs
6-
of RobotPy's various wrapper libraries, chiefly around:
4+
semiwrap is a build tool that makes it simpler to wrap C/C++ libraries with
5+
pybind11 by automating large portions of the wrapping process and handling some
6+
of the more complex aspects of creating pybind11 based wrappers (especially with
7+
trampolines to allow inheriting from C++ classes from Python).
78

8-
* Managing upstream binary dependencies
9-
* Autogenerating pybind11 wrappers around those dependencies
10-
* Building wheels from those generated wrappers
9+
semiwrap includes a hatchling plugin that autogenerates `meson.build` files that
10+
can be built using meson, and those build files parse your wrapped headers and
11+
generate/compile pybind11 based wrappers into python extension modules.
1112

1213
Requires Python 3.8+
1314

1415
Documentation
1516
-------------
1617

17-
Documentation can be found at https://robotpy-build.readthedocs.io/
18+
Documentation can be found at https://semiwrap.readthedocs.io/
1819

1920
Author
2021
------
2122

22-
Dustin Spicuzza is the primary author of robotpy-build, but it is the
23-
culmination of many years of experimentation with automated wrapper
24-
generation by members of the RobotPy community.
23+
Dustin Spicuzza is the primary author of semiwrap.
2524

26-
robotpy-build is available under the BSD 3-clause license.
25+
Semiwrap is a direct decendant of the robotpy-build project, and is culmination
26+
of many years of experimentation with automated wrapper generation by members of
27+
the RobotPy community.
28+
29+
semiwrap is available under the BSD 3-clause license.

docs/autowrap.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Automated C++ header wrapping
55
=============================
66

7-
robotpy-build can be told to parse C/C++ headers and automatically generate
7+
semiwrap can be told to parse C/C++ headers and automatically generate
88
:std:doc:`pybind11 <pybind11:basics>` wrappers around the functions
99
and objects found in that header.
1010

@@ -15,9 +15,9 @@ and objects found in that header.
1515
C++ Features
1616
------------
1717

18-
robotpy-build uses a pure python C++ parser and macro processor to attempt to
18+
semiwrap uses a pure python C++ parser and macro processor to attempt to
1919
parse header files. As a result, a full AST of the header files is not created.
20-
This means particularly opaque code might confuse the parser, as robotpy-build
20+
This means particularly opaque code might confuse the parser, as semiwrap
2121
only receives the names, not the actual type information.
2222

2323
However, most basic features typically work without needing to coerce the
@@ -34,6 +34,7 @@ generator into working correctly, including:
3434
* final classes/methods - cannot be overridden from Python code
3535
* Enumerations
3636
* Global variables
37+
* Many many more weird edge cases too
3738

3839
Additionally, the following features are supported, but require some manual
3940
intervention:
@@ -46,22 +47,22 @@ to your package in ``pyproject.toml``:
4647

4748
.. code-block:: toml
4849
49-
[tool.robotpy-build.wrappers."MYPACKAGE".autogen_headers]
50+
[tool.semiwrap.extension_modules."PACKAGE.NAME".headers]
5051
demo = "demo.h"
5152
5253
That causes ``demo.h`` to be parsed and wrapped.
5354

5455
.. note:: If you're importing a large number of headers, the
55-
``robotpy-build scan-headers`` tool can generate this for you
56+
``semiwrap scan-headers`` tool can generate this list for you
5657
automatically.
5758

5859
Documentation
5960
-------------
6061

61-
robotpy-build will find doxygen documentation comments on many types of elements
62-
and use sphinxify to translate them into python docstrings. All elements that
63-
support documentation strings can have their docstrings set explicitly using
64-
a ``doc`` value in the YAML file.
62+
semiwrap will find doxygen documentation comments on many types of elements
63+
and use sphinxify to translate them into python docstrings. If this is not
64+
sufficient, all elements that support documentation strings can have their
65+
docstrings set explicitly using a ``doc`` value in the YAML file.
6566

6667
.. code-block:: yaml
6768

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
os.environ["GENERATING_DOCUMENTATION"] = "True"
1717

18-
__version__ = pkg_resources.get_distribution("robotpy-build").version
18+
__version__ = pkg_resources.get_distribution("semiwrap").version
1919

2020

2121
# -- RTD configuration ------------------------------------------------
@@ -25,8 +25,8 @@
2525

2626
# -- Project information -----------------------------------------------------
2727

28-
project = "robotpy-build"
29-
copyright = "2020, RobotPy Development Team"
28+
project = "semiwrap"
29+
copyright = "2025, RobotPy Development Team"
3030
author = "RobotPy Development Team"
3131

3232
# The full version, including alpha/beta/rc tags

docs/config/autowrap.rst

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,68 @@
44
Generator Customization
55
=======================
66

7-
Because robotpy-build's code generation is intended to be a semi-automated
7+
Because semiwrap's code generation is intended to be a semi-automated
88
process (except for simple C++ code), a rich set of per-{class/function/parameter}
99
configuration options can be specified in per-file YAML configurations.
1010

1111
Additionally, some headers are too complex for the autogenerator to
1212
completely process, so when this occurs you must manually specify required
1313
information in the YAML file.
1414

15-
Most files generated by robotpy-build are customizable.
15+
Most files generated by semiwrap are customizable.
1616

17-
.. note:: robotpy-build is designed for the RobotPy project and may contain
17+
.. note:: semiwrap is designed for the RobotPy project and may contain
1818
defaults that aren't appropriate for all projects. If you find that
1919
you need more customization, file an issue on github and let's talk
2020
about it!
2121

2222
Location of customization file
2323
------------------------------
2424

25-
In your ``pyproject.toml``, you can specify either a single YAML file with
26-
customizations, or you can specify a directory that robotpy-build will search
27-
for YAML files.
28-
29-
Single file:
30-
31-
.. code-block:: toml
32-
33-
[tool.robotpy-build.wrappers."PACKAGENAME"]
34-
generation_data = "gen/data.yml"
35-
36-
Multiple files:
25+
By default customization files are located in the ``semiwrap`` directory. The name
26+
of the YAML file is the ``key`` in the extension module headers table:
3727

3828
.. code-block:: toml
3929
40-
[tool.robotpy-build.wrappers."PACKAGENAME"]
41-
generation_data = "gen"
42-
43-
When a directory is specified, pybind11 will search for YAML files in the
44-
directory based on the header filename. In the above example, customization
45-
data for ``header.h`` could be specified in ``gen/header.yml``.
30+
[tool.semiwrap.extension_modules."PACKAGE.NAME".headers]
31+
# yaml file is `semiwrap/demo.yml`
32+
demo = "include/demo.h"
4633
4734
4835
Autogeneration
4936
--------------
5037

51-
The default values for these YAML files can be generated via the robotpy-build
52-
command line tool:
38+
The default values for these YAML files should be generated via the semiwrap command
39+
line tool:
5340

5441
.. code-block:: sh
5542
56-
robotpy-build create-gen --write
43+
semiwrap create-yaml --write
5744
5845
This can be a good way to get the boilerplate out of the way when you need to
5946
provide customizations.
6047

48+
Manual pybind11 APIs
49+
--------------------
50+
51+
You can write your own custom .cpp files and add them to the python extensions
52+
generated by semiwrap. In your ``meson.build`` after you include the generated
53+
``semiwrap`` subdir, add files to ``NAME_sources``.
54+
55+
.. code-block:: meson
56+
57+
subdir('semiwrap')
58+
59+
my_module_sources += files(
60+
'src/my_module/main.cpp',
61+
)
62+
63+
6164
Reference
6265
---------
6366

6467
The following strctures describe the dictionaries that are read from the YAML
65-
file. The toplevel structure is :class:`.AutowrapConfigYaml`.
68+
files. The toplevel structure is :class:`.AutowrapConfigYaml`.
6669

67-
.. automodule:: robotpy_build.config.autowrap_yml
70+
.. automodule:: semiwrap.config.autowrap_yml
6871
:members:
69-
:undoc-members:

0 commit comments

Comments
 (0)