Skip to content
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

Python bindings #1

Merged
merged 44 commits into from
May 23, 2019
Merged

Python bindings #1

merged 44 commits into from
May 23, 2019

Conversation

mosra
Copy link
Owner

@mosra mosra commented May 1, 2019

Split from mosra/magnum#228. Things to do:

  • everything reasonable base from the Math lib
    • testing basic functionality from python
    • setting up Travis build
    • setting up coverage for both C++ and Python
    • GL testing on the CI
    • think about the underscore policy (xaxis() might be okay but shearxz() definitely isn't) -- went back to all underscores, everything else is inconsistent
    • convince Python that it can have a single method that's both static and instance (Matrix3.scaling() vs mat.scaling())
    • convince Python that it can have a property and static method of the same name (Matrix3.translation() vs mat.translation) -- postponed
  • basic stuff from Platform
    • solve protected destructors and such -- my own deleter
    • how to support overriding virtual functions to subclass Platform::Application classes? -- pybind is nice
  • ffs, $<TARGET_EXISTS> doesn't exist until CMake 3.12, need other solution
  • basic stuff from GL (render a cube) in progress
    • how to support variadic templates (in particular Mesh::addVertexBuffer())? *args? postponed
  • basic stuff from Shaders in progress
  • basic stuff from SceneGraph (render a cube using scenegraph)
  • solve inter-module dependencies (currently it's implicit and doesn't really work) it "just works" now
  • how to document this? Python doc generator m.css#98
  • solve compile times (I barely started and this adds 20 seconds to compile times...) -- split into some files, would need to rewrite pybind from scratch to fix this properly
  • how to pass big chunks of binary data through fast? --- buffer protocol, need to rewrite pybind to do this properly

@codecov-io
Copy link

codecov-io commented May 1, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@f7d5d91). Click here to learn what that means.
The diff coverage is 93.18%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #1   +/-   ##
=========================================
  Coverage          ?   93.18%           
=========================================
  Files             ?       26           
  Lines             ?     1805           
  Branches          ?        0           
=========================================
  Hits              ?     1682           
  Misses            ?      123           
  Partials          ?        0
Impacted Files Coverage Δ
src/python/corrade/PybindExtras.h 100% <100%> (ø)
src/python/magnum/__init__.py 100% <100%> (ø)
src/python/magnum/NonDestructible.h 100% <100%> (ø)
src/python/magnum/platform/windowlessapplication.h 100% <100%> (ø)
src/python/magnum/trade.cpp 100% <100%> (ø)
src/python/magnum/math.h 100% <100%> (ø)
src/python/magnum/math.matrixfloat.cpp 100% <100%> (ø)
src/python/magnum/PyMesh.h 100% <100%> (ø)
src/python/corrade/EnumOperators.h 100% <100%> (ø)
src/python/corrade/__init__.py 100% <100%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7d5d91...7777943. Read the comment docs.

@mosra mosra added this to the 2019.0b milestone May 1, 2019
@mosra mosra self-assigned this May 1, 2019
@mosra mosra mentioned this pull request May 1, 2019
3 tasks
@mosra mosra force-pushed the python branch 2 times, most recently from 1eadca7 to e88148a Compare May 2, 2019 18:10
@mosra mosra mentioned this pull request May 21, 2019
60 tasks
mosra added 2 commits May 21, 2019 22:37
Only the double ones, exposed as floats, because the extra ALU required
by doubles is negligible to function call overhead. It'll be different
for non-scalar types, but here I use this.
@mosra mosra force-pushed the python branch 5 times, most recently from 2924454 to 9cf3b76 Compare May 21, 2019 21:48
@mosra mosra force-pushed the python branch 4 times, most recently from e88dc97 to 9be4d5e Compare May 23, 2019 00:36
mosra added 23 commits May 23, 2019 14:39
Similarly to the windowless ones, one of them gets picked up to be
platform.Application.
Just stuff I consider important at the moment scattered across numerous
files.
By including pybind11 and Python headers as SYSTEM. Possible in pybind11
master, but not yet part of any release so I'm patching it manually.
Generating both C++ and Python coverage.
Mainly for RGB -> RGBA shortcuts. Need to invent some nice decoding from
a string.
Similarly for Matrix3. Also make it implicitly convertible from the base
type.
This took a while because I wasn't able to convince pybind to do what I
want.
Such a tiny feature and such a pain when it's not there.
@mosra mosra marked this pull request as ready for review May 23, 2019 12:52
@mosra
Copy link
Owner Author

mosra commented May 23, 2019

Eh, I would say this is enough for the initial MVP.

@mosra mosra merged commit 7777943 into master May 23, 2019
@mosra mosra deleted the python branch May 23, 2019 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants