-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING] Move and update many component implementations to support litgen-based pybind11 generation to overhaul python library #291
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d start fleshing out the espp library
…added color and event manager
✅Static analysis result - no issues found! ✅ |
…se them effectively
…tead of having getter/setter functions for them with the same name
…task, timer, socket, tcpsocket, udpsocket and fixed autogenerated bindings. trying to get autogeneration to work for template classes
…cilitate proper binding generation; remove TcpTransmitConfig from detail namespace and update it to be TcpSocket::TransmitConfig with alternate workaround for gcc bug; updated ftp and rtsp accordingly
…t of manual editing of the generated bindings file, but it is way better than having to write the whole thing from scratch
…::filesystem or espp::FileSystem
… shit to the beginning of every file which includes one of the socket files... -.-
…before configuring socket. updated error logging to work across platforms
SquaredPotato
pushed a commit
to smartknob-ha/espp
that referenced
this pull request
Jan 27, 2025
…litgen-based pybind11 generation to overhaul python library (esp-cpp#291) * Update file system and cli to have guards around ESP-specific code and start fleshing out the espp library * fleshing out library and updating how external libraries are copied; added color and event manager * add simple cli test * WIP trying to use litgen to automatically generate the python bindings 🚀 * WIP move implementation from header to source files so litgen can parse them effectively * WIP update cmakelists * WIP continuing to flesh out automatic binding support * fix: move task auto to header * update color, add missing pragma to fomatters files * fixed unmatched suppression * add missing task scope * working on configuring binding generator * update math components to better support autogenerating bindings * WIP trying to get more of the bindings working... * having to manually modify generated bindings... -.- * generated python docs * add requirements and gitignore * wip trying to get binding to work better * update gaussian so that alpha/beta/gamma class members are public instead of having getter/setter functions for them with the same name * WIP removed autogenerated default constructors for bezier, gaussian, task, timer, socket, tcpsocket, udpsocket and fixed autogenerated bindings. trying to get autogeneration to work for template classes * update python tests; ensure complete scoping for config members to facilitate proper binding generation; remove TcpTransmitConfig from detail namespace and update it to be TcpSocket::TransmitConfig with alternate workaround for gcc bug; updated ftp and rtsp accordingly * WIP trying to flesh out the bindings some more. still have to do a lot of manual editing of the generated bindings file, but it is way better than having to write the whole thing from scratch * revert back to implementation in main header even though it breaks litgen * minor update * move run_on_core out of espp::Task class and into espp::task namespace * update bindings * fix i2c * remove accidentally added i2c files * add missing param doc * add more explicit scoping * minor updates * update cmakelists to install magic enum headers correctly * minor update to support running examples on qtpy s3 * add some notes to the binding generator * update to generate into espp instead of espp_lib * add build library workflow * move sys/stdio.h to stdio.h for linux compat * update github action to support windows * update build to use cmake completely for better x-plat compat * WIP windows library * add simple readme * minor update * starting work on porting socket to windows * fix cmake * WIP windows support * comment out windows build for now * update bindings * feat(math): update gaussian to have getter/setter methods instead of public members * update bindings * update to use pybind11_add_module to simplify cmake lists, add windows build script, and update to build for release * update ci library build * ensure return code * update python bindings * use direct commands to get proper error status * update file system to use std::filesystem when not on esp-idf * clean up file system includes * update ftp to remove use of posix functions and replace with only std::filesystem or espp::FileSystem * explicit scoping * some more explicit scoping * more explicit * try to undefine logger verbosity enums since windows is complaining about them... * WIP trying to make socket a little more x-plat friendly * fix sa * include winsock in "C" linkage * WIP msvc is kinda stupid about include headers so we have to add some shit to the beginning of every file which includes one of the socket files... -.- * WIP getting windows build working * WIP added support for tabulate on msvc * updated to get closer to working compilation on windows * add note * test uplaoding output folder * update to v4 * disable reuseaddr on windows * update how msc_ver is checked * update install and ensure that pc can work * fix(socket): update to properly initialize socket library on windows before configuring socket. updated error logging to work across platforms * add pc tests for udp client/server and update build scripts accordingly * minor update * minor update * update readmes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lib
library for use with other systems / languages
litgen
python
xplat
cross platform support
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
T(0)
if ()
conditionals since that seems to break litgen parsing[BREAKING CHANGES]
espp::Gaussian
was updated to removefloat gamma() const
andvoid gamma(float)
in favor of makinggamma
public (same for beta and alpha). This was done because the existing interface was not supported by litgen since it involved overloads of the same function name, so a breaking API change was necessary, and making them public seemed to be better than changing the methods toget_*
andset_*
.espp::Task::run_on_core
has been moved outside theTask
class and into its own headerrun_on_core.hpp
, since it must be implemented in a header file, but cannot be parsed by litgen. It is now within theespp::task
namespace asespp::task::run_on_core
.espp::detail::TcpTransmitConfig
was moved into theespp::TcpSocket
class to becomeespp::TcpSocket::TransmitConfig
. This was to simplify use of litgen to not have to expose theespp::detail
namespace and to simplify the code, using an alternate workaround for the gcc bug that originally required the use of thedetail
namespace - instead we now have aDefaults()
method that we use for function default arguments.NOTE:
Right now the autogenerated bindings have to be modified since:
template <typename T> espp::RangeMapper
'sespp::RangeMapper::Config
are not handled generated by litgen properly, they result in:See:
Motivation and Context
Supporting an interface via python currently requires a lot of manual binding writing, but there are some newer tools which can help offload some or all of this work by parsing the headers and generating the bindings.
We also would like to automatically build the library in CI to ensure it is kept up to date.
How has this been tested?
Generating the python bindings and building the c++ / python libraries
From within
lib
:python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
python autogenerate_bindings.py
pre-commit run --all-files
python_bindings/pybind_espp.cpp
./build.sh
Building and running all the affected examples:
Testing python udp_client and c++ udp_server on windows (in parallels VM on MacOS):
Building and running all the c++ tests inside
pc
Running all the python tests inside
python
Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
PC Tests:
Python Tests:
Testing python using Windows library built in CI and running in a parallels windows VM:
Types of changes
Checklist:
Software
.github/workflows/build.yml
file to add my new test to the automated cloud build github action.