-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from steve-s/ss/small-docs-improvs
Small documentation improvements & quickstart guide
- Loading branch information
Showing
18 changed files
with
211 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// quickstart.c | ||
|
||
// This header file is the entrypoint to the HPy API: | ||
#include "hpy.h" | ||
|
||
// HPy method: the HPyDef_METH macro generates some boilerplate code, | ||
// the same code can be also written manually if desired | ||
HPyDef_METH(say_hello, "say_hello", HPyFunc_NOARGS) | ||
static HPy say_hello_impl(HPyContext *ctx, HPy self) | ||
{ | ||
// Methods take HPyContext, which must be passed as the first argument to | ||
// all HPy API functions. Other than that HPyUnicode_FromString does the | ||
// same thing as PyUnicode_FromString. | ||
// | ||
// HPy type represents a "handle" to a Python object, but may not be | ||
// a pointer to the object itself. It should be fully "opaque" to the | ||
// users. Try uncommenting the following two lines to see the difference | ||
// from PyObject*: | ||
// | ||
// if (self == self) | ||
// HPyUnicode_FromString(ctx, "Surprise? Try HPy_Is(ctx, self, self)"); | ||
|
||
return HPyUnicode_FromString(ctx, "Hello world"); | ||
} | ||
|
||
static HPyDef *QuickstartMethods[] = { | ||
&say_hello, // 'say_hello' generated for us by the HPyDef_METH macro | ||
NULL, | ||
}; | ||
|
||
static HPyModuleDef quickstart_def = { | ||
.doc = "HPy Quickstart Example", | ||
.defines = QuickstartMethods, | ||
}; | ||
|
||
// The Python interpreter will create the module for us from the | ||
// HPyModuleDef specification. Additional initialization can be | ||
// done in the HPy_mod_execute slot | ||
HPy_MODINIT(quickstart, quickstart_def) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# setup.py | ||
|
||
from setuptools import setup, Extension | ||
from os import path | ||
|
||
DIR = path.dirname(__file__) | ||
setup( | ||
name="hpy-quickstart", | ||
hpy_ext_modules=[ | ||
Extension('quickstart', sources=[path.join(DIR, 'quickstart.c')]), | ||
], | ||
setup_requires=['hpy'], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ Misc notes | |
========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:maxdepth: 1 | ||
|
||
str-builder-api | ||
embedding | ||
protocols |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.