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

Standalone example? #16

Open
henryiii opened this issue May 29, 2024 · 2 comments
Open

Standalone example? #16

henryiii opened this issue May 29, 2024 · 2 comments

Comments

@henryiii
Copy link
Contributor

henryiii commented May 29, 2024

Would a small standalone example (or more) be a good idea? I just wrote one at https://github.com/scikit-build/scikit-build-sample-projects/pull/50/files, which does a simple pi calculation in pure Python and with a C extension (with a little C++ for the random number generator) and a scikit-build-core build. Doing so was a bit tricky, as docs are currently scattered or in PEPs (multiphase initialization seems to be mostly in it's PEP). I figured out some of it looking at the modules in CPython.

@ngoldbaum
Copy link
Collaborator

ngoldbaum commented May 29, 2024

@henryiii for multi-phase initialization I think the best place to add docs is in CPython itself, see e.g. https://discuss.python.org/t/converting-a-static-extension-type-to-a-heap-exension-type/26273 when I last tried to work on this. The C extension tutorial in the CPython docs should definitely be updated to create a heap type instead of a static type.

I also think now is likely the time to write an updated version of this tutorial. I found that document incredibly useful ramping up on C extensions last year, but it's getting to be somewhat dated and should be updated to discuss thread safety more and went over multi-phase initialization.

So all that said, maybe? But I'm not sure this repo is the correct spot for it. But this is definitely a spot to link to new tutorials and documentation that gets written about writing modern C extensions.

@lysnikolaou
Copy link
Member

Agreed. I'm not sure whether this is the correct place to host such tutorials/guides/articles, but we certainly should be linking to resources about all of this from our README, or even maybe a new resources doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants