summaryrefslogtreecommitdiff
path: root/docs/examples
Commit message (Collapse)AuthorAgeFilesLines
* Disallow @cfunc being applied to a @ufunc.Stefan Behnel2023-04-243-3/+3
| | | | Closes https://github.com/cython/cython/issues/5399
* docs: change "(...)" ctuple syntax to "tuple[...]" in Python annotations.Stefan Behnel2023-04-241-1/+1
|
* Doc: Migrate Numpy ufunc to pure python (#5281)Matus Valo2023-03-046-0/+44
|
* Show warning when annotation type is unknown (GH-5079)Matus Valo2023-02-251-2/+2
| | | Closes https://github.com/cython/cython/issues/5070
* [docs] Softdeprecated C style array declaration in favour of Java style ↵Matus Valo2023-02-184-7/+7
| | | | | declaration (#5248) Co-authored-by: GalaxySnail <me@glxys.nl>
* [docs] Parallelization tutorial (#5184)da-woods2023-02-0611-0/+236
| | | Parallelization tutorial to try to explain prange/parallel in a little more user-friendly way
* Docs: Migrate fused types userguide to pure python (#5119)Matus Valo2022-12-038-0/+164
|
* Fix linkage for `cdef public` functions in C++ mode (#5040)Maximilien Colange2022-11-081-0/+1
| | | | | | | | | | | | Fixes #1839 cdef public functions should be declared with the appropriate linkage: * in C mode, either extern or extern "C", depending on whether the header file is included in (resp. object code is linked against) a C or a C++ compilation unit. Choice is made at compile-time through #ifdef __cplusplus macros. NB: This is the current behavior. * in C++ mode, extern "C++" is the only option, as C code cannot call C++ code. Note that extern "C++" should be preferred over extern to allow users to #include the C++ header inside a extern "C" block (which is legal, although barely used). Note that the current behavior is OK for C mode, but is incorrect for the C++ mode. As described in #1839, this incorrect behavior is diagnosed by compilers emitting warnings when cdef public functions return a C++ type (e.g. std::vector). The test introduced in this PR checks that the current behavior for C mode (with both C and C++ compatibility) is preserved, and that the behavior for C++ mode is fixed.
* [Docs] Refactor and extend structs, unions, enums, function pointer ↵Matus Valo2022-10-228-15/+52
| | | | documentation in language basics userguide (#5082)
* [Doc] Improve documentation of disabling annotations in pure mode (#5080)Matus Valo2022-10-121-0/+33
|
* Docs: Migrate buffer userguide to pure python (#5069)Matus Valo2022-10-086-4/+100
|
* Docs: Fix example in buffer user guide (#5065)Matus Valo2022-10-061-1/+1
| | | To make sure it works right with Python 3 semantics.
* Docs: Migrate early binding for speed userguide to pure python (#5061)Matus Valo2022-10-056-1/+83
|
* [Doc] Add pure python mode to parallelism.rst (#4974)Matus Valo2022-08-1611-2/+128
|
* Use annotation for pointer in docs (#4942)Matus Valo2022-08-021-1/+1
| | | and remove note about bug
* [docs] Replace some cinit with init (#4642)Golden Rockefeller2022-08-016-7/+13
| | | | | | | * Replace unnecessary __cinit__ with __init__ in documentation examples * Use __cinit__ when necessary in the wrapping C++ examples * Modify existing Rectangle instead of creating a new Rectangle in the pointer to Rectangle example
* [docs] Fix typo in embedded.pyxda-woods2022-07-271-1/+1
|
* Fix annotation type analysis for Python "typing" types (GH-4606)scoder2022-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Check for "Optional[ctype]" earlier because we need to make sure that "Optional[int]" etc. interprets "int" as (valid) Python int type and not (invalid) C int type. See https://github.com/cython/cython/issues/3883 * Fix typing assumptions in PEP 526 variable annotations test: in a Python type annotation, "int" means Python int and "float" means Python float, not the C types. * Use a context manager to make it explicit in annotation type analysis when C types are allowed, and when Python types are required or expected. * Generalise the concept of equivalent Python and C types for more efficient type inference: PyFloat/double, PyBool/bint, PyComplex/double complex. * Refactor analyse_type_annotation() to prepare the extraction of type modifiers (as opposed to special types). See discussion in https://github.com/cython/cython/pull/4606#issuecomment-1026658869 * Refactor handling of "typing.Optional", "dataclasses.InitVar" etc. annotations to move them into the declared Entry during type analysis and keep only the bare type in the type system. * Force ClassVar[...] types to be object types. * Add a warning when users define a ClassVar[] with a non-Python type. See https://github.com/cython/cython/pull/4606#discussion_r805170982 * Provide a helpful warning when users write plain C types in a non-C annotation context. * Only consider Python object item types from list/tuple as self.type in IndexNode since that will be the result of the index access. Coercion needs to happen externally, then based on the type inference. * Ignore Python annotation type "long" since it almost certainly does not refer to PyLong but to C long. Issue a warning to make users aware of it. * Fix PEP-526 test by working around incomplete type inference, but leave FIXME comments.
* Docs: migrate extension_types.rst to pure python (GH-4516)Matus Valo2022-07-0726-5/+415
|
* Docs: Migrate sharing_declarations.rst to pure python mode (#4544)Matus Valo2022-06-2512-3/+56
| | | | | | | | | | | | | | | * Initial migration of examples * Migrate text in sharing_declarations.rst * Some fixes of examples and clarification * Fix capitalization * Apply suggestions from code review Co-authored-by: da-woods <dw-git@d-woods.co.uk> Co-authored-by: da-woods <dw-git@d-woods.co.uk>
* Docs: Migrate special_methods.rst to pure python (#4537)Matus Valo2022-06-252-0/+26
| | | | | * Migrate special_methods.rst to pure python * Fix missing import in examples
* Avoid an ambiguous function signature spelling in the documentation. ↵Stefan Behnel2022-05-021-1/+1
| | | | Signatures with unnamed (type-only) arguments are generally more difficult to read.
* docs: Add an example on how to use verbatim C code to work around version ↵Stefan Behnel2022-02-242-0/+44
| | | | | | specific struct fields. See https://github.com/cython/cython/issues/4310
* docs: pythonise "Working with Python arrays" (array.rst) (GH-4431)0dminnimda2022-02-026-0/+54
|
* Implement cdef dataclasses (GH-3400)da-woods2022-01-291-0/+20
| | | | | | | | | | | | New decorator/function "@cython.dataclasses.dataclass" and "cython.dataclasses.field()" to mark dataclasses and their fields. Tries to match the interface provided by a regular dataclass as much as possible. This means taking the types from the dataclasses module if available (so they match exactly) or a fallback Python version that just implements the core parts (executed with "PyRun_String()" in the C source). Use of placeholders in generated "__init__" code means the code in the C file isn't hugely readable. Probably not a huge issue, but don't really see a way round that. As part of this I've also also implemented a Cython version of "typing.ClassVar". Although really designed for use with dataclasses it behaves sensibly when used in types in a normal cdef class. This is worth documenting more thoroughly. Closes https://github.com/cython/cython/issues/2903
* Docs: Migrate profiling tutorial to pure Python (GH-4311)Matus Valo2021-12-1410-13/+56
|
* [DOC] Add doc for memory views with custom numpy dtype (GH-2813)Nicolas Hug2021-12-061-0/+26
| | | Closes https://github.com/cython/cython/issues/2760
* Add "import_array()" to the Numpy tutorial (GH-4403)da-woods2021-11-021-0/+6
| | | Arguably, it's unnecessary if the auto-call works correctly, but if we're still advising users to do it themselves then it probably should be in the docs.
* docs: Pythonise documentation on Memory Allocation (memory_allocation.rst) ↵0dminnimda2021-08-084-4/+58
| | | | (GH-4316)
* Docs: Introduce pure Python mode in "Using C libraries" tutorial (GH-4294)Matus Valo2021-07-227-8/+97
|
* Introduce pure Python mode in the "language basics" documentation (GH-4242)Matus Valo2021-07-2012-1/+139
| | | See https://github.com/cython/cython/issues/4187
* Fix missing images in quickstart (#4285)Matus Valo2021-07-152-0/+0
|
* docs: Add pure Python examples to "Getting started" guide (GH-4283)Matus Valo2021-07-156-1/+21
|
* docs: Use explicitely the "cython" module in examples (GH-4284)Matus Valo2021-07-142-4/+2
|
* docs: Pythonise the "Extension types (aka. cdef classes)" page ↵0dminnimda2021-07-1410-0/+88
| | | | (cdef_classes.rst) (GH-4232)
* docs: Add Pure Python mode to "Calling C functions" tutorial (GH-4247)Matus Valo2021-07-148-0/+28
|
* docs: Resolve several exception handling/propagation issues in the examples.Stefan Behnel2021-06-156-7/+8
|
* docs: Fix some warnings in the "external C code" examples about unraisable ↵Stefan Behnel2021-06-152-15/+16
| | | | | | exceptions. Also make a couple of improvements regarding clarity and text formatting.
* docs: Fix type used in C++ example.Stefan Behnel2021-06-151-1/+1
|
* Pythonise the documentation according to #4187: Basic Tutorial ↵0dminnimda2021-06-156-12/+60
| | | | | | | | | | | (cython_tutorial.rst) (GH-4226) See https://github.com/cython/cython/issues/4187 * .gitignore: add directory for docs build and cython_debug * doc-requirements.txt: add sphinx-tabs * conf.py: add and setup sphinx-tabs extension * Create _static\css\tabs.css for customisation * add "two-syntax-variants-used" file as a preface about the different typing variants
* Automatically add stubs for "cython.cimports.*" in the test runner to make ↵Stefan Behnel2021-06-141-0/+5
| | | | them importable in Python (although not necessarily runnable).
* Fix "platform_adaptation" documentation test on windows (GH-4126)da-woods2021-04-181-3/+2
| | | For reasons I don't full understand, including "windows.h" seems to break everything. There's an alternative sleep function in stdlib.h so I've used that instead since it makes the point just as well.
* DOC: make some github issues into links, doc fixes (GH-4060)Matti Picus2021-04-021-0/+2
| | | | | * DOC: make some github issues into links, doc fixes * add a doc-requirements.txt for building docs * use ':issue:' domains for github issues
* docs: use https links (GH-4067)谭九鼎2021-03-291-1/+1
|
* Try to fix platform_adaptation test on Windows, again.Stefan Behnel2020-11-081-0/+1
|
* Try to fix platform specific test once more.Stefan Behnel2020-10-041-2/+2
| | | | | "synchapi.h" is not supposed to be included directly, and "windows.h" can break ... other stuff. Let's see what we can do.
* Fix test compile failure in MSVC.Stefan Behnel2020-10-041-1/+1
|
* Fix test compile failure in MSVC.Stefan Behnel2020-10-031-1/+1
|
* Add a more common and more versatile example to the Verbatim C-Code ↵Stefan Behnel2020-10-032-0/+14
| | | | documentation.
* Beautify example output.Stefan Behnel2020-07-091-1/+1
|