(mostly) automated C++ wrapping for Python

robotpy, updated 🕥 2023-03-16 16:40:42

robotpy-build

This is a build tool designed to meet the needs of RobotPy's various wrapper libraries build needs, chiefly around:

  • Managing upstream binary dependencies
  • Autogenerating pybind11 wrappers around those dependencies
  • Building wheels from those generated wrappers

robotpy-build is intended to be a generally useful build tool for any python project that has binary dependencies. If you find that isn't the case, please report a bug on github.

Requires Python 3.6+

Documentation

Documentation can be found at https://robotpy-build.readthedocs.io/

Author

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

robotpy-build is available under the BSD 3-clause license.

Issues

extra_includes for templates

opened on 2023-03-02 10:09:53 by auscompgeek

Since each template instantiation is built in its own translation unit, being able to have different includes for each template instantiation would be beneficial.

Using return_value_policy::copy for non-copyable type

opened on 2023-01-29 20:55:31 by virtuald

InitSendable (see https://github.com/robotpy/robotpy-commands-v2/pull/22 for example) takes a non-copyable type as an argument. Since the smart-holder branch of pybind11 can invalidate objects, we might be able to automatically detect and fix this case at compile time. Would need some thought.

Automatically Detect Template Types

opened on 2023-01-01 19:58:00 by TheTripleV

When headers are scanned, the types used in a template should be cached. This can be used automatically fill in the template_params in create-gen.

For example (ctre pro), CoreTalonFX.hpp has a function StatusSignalValue<units::angle::turn_t> &GetPosition(); From this, we know that StatusSignalValue needs a units::angle::turn_t template param. Then, SignalStatusValue.hpp has a function SignalMeasurement<T> GetDataCopy() const {...} From this, we can propogate all of SignalStatusValue's template_params including units::angle::turn_t to SignalMeasurement.

This would require all headers to be scanned before yaml files are written.

Add return_override for functions

opened on 2023-01-01 01:52:29 by TheTripleV None

Add typealias support for namespaces and typedefs

opened on 2022-12-30 23:37:22 by TheTripleV

This doesn't fix what I'm working on but /shrug I wrote the code.

Make it easier to have a lot of libraries

opened on 2022-12-18 04:54:23 by virtuald

CTRE in particular has a lot of libraries, and right now each one needs its own subpackage. Would be nice if we could just put everything in a single directory. Lots of changes needed to make this doable however.

FWIW, numpy is now doing this sort of thing:

``site-packages/numpy.libs/`` (linux), or ``site-packages/numpy/.dylibs/`` (macOS), or ``site-packages/numpy/.libs/`` (windows).

Python 3 for the FIRST Robotics Competition (FRC)
GitHub Repository

robotpy pybind11 first-robotics-competition python