Skip to content

Commit b948e76

Browse files
General: Prepare for 2.0.0 release (#70)
- Marks the version as "final" in the version markers and changelog. - Updates the README a little bit.
1 parent 8c017d3 commit b948e76

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## [2.0.0] - 2025-03-30
44

55
- Moved away from function pointer tables for loading PyAwaitable--everything is now vendored upon installation.
66
- Improved performance with compiler optimizations.

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
## What is it?
1313

14-
PyAwaitable is the _only_ library to support writing and calling asynchronous Python functions from pure C code (with the exception of manually implementing an awaitable class from scratch, which is essentially what PyAwaitable does).
14+
PyAwaitable is the _only_ library to support defining and calling asynchronous Python functions from pure C code.
1515

16-
It was originally designed to be directly part of CPython--you can read the [scrapped PEP](https://gist.github.com/ZeroIntensity/8d32e94b243529c7e1c27349e972d926) about it. Since this library only uses the public ABI, it's better fit outside of CPython, as a library.
16+
It was originally designed to be directly part of CPython; you can read the [scrapped PEP](https://gist.github.com/ZeroIntensity/8d32e94b243529c7e1c27349e972d926) about it. But, since this library only uses the public ABI, it's better fit outside of CPython, as a library.
1717

1818
## Installation
1919

@@ -42,18 +42,29 @@ if __name__ == "__main__":
4242
## Example
4343

4444
```c
45-
#include <pyawaitable.h>
45+
/*
46+
Equivalent to the following Python function:
4647
47-
/* Usage from Python: await my_async_function(coro()) */
48+
async def async_function(coro: collections.abc.Awaitable) -> None:
49+
await coro
50+
51+
*/
4852
static PyObject *
49-
my_async_function(PyObject *self, PyObject *coro) {
50-
/* Make our awaitable object */
53+
async_function(PyObject *self, PyObject *coro)
54+
{
55+
// Create our transport between the C world and the asynchronous world.
5156
PyObject *awaitable = PyAwaitable_New();
57+
if (awaitable == NULL) {
58+
return NULL;
59+
}
5260

53-
/* Mark the coroutine for being awaited */
54-
PyAwaitable_AddAwait(awaitable, coro, NULL, NULL);
61+
// Mark our Python coroutine, *coro*, for being executed by the event loop.
62+
if (PyAwaitable_AddAwait(awaitable, coro, NULL, NULL) < 0) {
63+
Py_DECREF(awaitable);
64+
return NULL;
65+
}
5566

56-
/* Return the awaitable object to yield to the event loop */
67+
// Return our transport, allowing *coro* to be eventually executed.
5768
return awaitable;
5869
}
5970
```

netlify.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[build]
22
command = "mkdocs build"
3-
publish = "site"
4-
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF docs/"
3+
publish = "site"

src/pyawaitable/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
__all__ = ("include",)
12-
__version__ = "2.0.0-dev0"
12+
__version__ = "2.0.0"
1313
__author__ = "Peter Bierma"
1414

1515

0 commit comments

Comments
 (0)