-
Notifications
You must be signed in to change notification settings - Fork 10
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
Hello, HPy | HPy #6
Comments
Can't wait to hear more. |
This is great. Looking forward to a more compatible PyPy due to this work, so we can actually start using it :) . Keep it up! |
Is this going to cover embedding scenarios as well as extension development? CPython API does that. |
@lostmsu From the API point of view, there is nothing in HPy which would prevent to use it for embedding, so eventually we will also support that. |
@antocuni embedding into non-C languages precludes using C macros to define new objects. I think if API is not designed with that in mind, it will have the same problems as CPython has for embedding. |
@lostmsu macros are not required to write HPy extensions. Unfortunately HPy is a bit under-documented now and it's not easy to find info about this, but the various macros like This is an example taken from // ujson.c does something a bit weird: it defines two Python-level methods
// ("encode" and "dumps") for the same C-level function
// ("objToJSON_impl"). HPyDef_METH does not support this use case, but we can
// define our HPyDef by hand: HPyDef_METH is just a convenience macro and the
// structure and fields of HPyDef is part of the publich API
HPyDef objToJSON_encode = {
.kind = HPyDef_Kind_Meth,
.meth = {
.name = "encode",
.impl = objToJSON_impl,
.cpy_trampoline = objToJSON_trampoline,
.signature = HPyFunc_KEYWORDS,
.doc = ("Converts arbitrary object recursively into JSON. "
ENCODER_HELP_TEXT),
}
}; |
Great article! Minor note: should |
@aneeshdurg you are correct, thanks for reporting. Fixed by 935e8f6, should appear online soon |
Very interesting. When do you expect the first official release? |
@PimvanderEijk it depends on how you define "official". We recently agreed that it's a good idea to start tagging some git versions with release numbers: this will simplify the interactions with hpy, pypy and grallpython. Once we do that, we might or might not decide to also publish the releases on PyPI, but this should be a minor thing as anyone who is brave enough to try hpy at this stage should not have problems at installing it from git. However, note that even if we start to roll out releases, we are not making any commitment of compatibility between them at this stage. The API is still subject to change completely between one release and the next, see e.g. hpyproject/hpy#182. If the question is "when do we expect to roll out a release on which people can rely to write and distribute their own extensions", I think it will be several months from now. |
Hello, HPy | HPy
https://hpyproject.org/blog/posts/2021/03/hello-hpy/
The text was updated successfully, but these errors were encountered: