directory structure for a project that mixes C++ and Python

前端 未结 1 628
一个人的身影
一个人的身影 2020-12-30 09:53

Say you want want to create a programming project that mixes C++ and Python. The Foo C++ project structure uses CMake, a

相关标签:
1条回答
  • 2020-12-30 10:36

    If the C++ application has no use outside the Python package that will contain it:

    You can pretty safely place the C++ code within the python package that owns it. Have the "foo" directory within the "bar" directory within your example. This will make packaging the final Python module a bit easier.

    If the C++ application is reusable:

    I would definitely try to think of things in terms of "packages", where independent parts are self-contained. All independent parts live on the same level. If one part depends on another, you import from its corresponding "package" from the same level. This is how dependencies typically work.

    I would NOT include one within the other, because one does not strictly belong to the other. What if you started a third project that needed "foo", but did not need "bar"?

    I would place both "foo" and "bar" packages into the same "project" directory (and I would probably give each package it's own code repository so each package can be easily maintained and installed).

    0 讨论(0)
提交回复
热议问题