3 ms·
Great recommendations all around. It'd be nice if they went into how they handle dealing with C extensions, as that adds a large amount of complexity to a Pytho
by WillDaSilva 5y ago
Great recommendations all around. It'd be nice if they went into how they handle dealing with C extensions, as that adds a large amount of complexity to a Python project, and most of the published advice on the topic is quite old.
EDIT: Mentioning `pyproject.toml` and the relevant PEPs would also be great (i.e. PEP 621, PEP 517, etc.). Fortunately Poetry is compliant with these PEPs.
- gww 5y agoI really struggle with this part of Python package development. I have a rather complex C++ library I have been calling with Cython but I am struggling to find the best practices for either compiling the library with setup tools or calling cmake and copying the library into the package etc.
- thundergolfer 5y agoLook into Bazel. Bazel particularly suited to building Python+{C/C++/Rust} codebases. It's still early days in the Bazel ecosystem, so you won't find a ready-made solution, but the fundamentals are solid.
- gww 5y agoOh cool thanks, I will check it out!
- paulross 5y agoThis might help: https://pythonextensionpatterns.readthedocs.io/en/latest/index.html https://pythonextensionpatterns.readthedocs.io/en/latest/ind...
- WillDaSilva 5y agoThat's a great resource in general for Python extensions, but doesn't have much to say about packaging and distributing them. For that the best resources I've found have been to look at what large/complex projects that use them do, as they've often had to deal with many of the odd cases that often come up. Using Cython adds another layer of complexity to the packaging/distribution that that link does not address. Fortunately now that you can specify build requirements in `pyproject.toml` Cython has become significantly easier to use on that front, but there are still some less than obvious bits to say the least. Maybe I should publish an overview of Python best practices for publishing C extensions (with or without Cython).
- gww 5y agoThat would be a great resource. Most of the information I have found ends up being outdated.