summaryrefslogtreecommitdiff
path: root/docs/examples/userguide
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-183-6/+6
| | | | | declaration (#5248) Co-authored-by: GalaxySnail <me@glxys.nl>
* Docs: Migrate fused types userguide to pure python (#5119)Matus Valo2022-12-038-0/+164
|
* [Docs] Refactor and extend structs, unions, enums, function pointer ↵Matus Valo2022-10-228-15/+52
| | | | documentation in language basics userguide (#5082)
* 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
|
* [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
* 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
* 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
* [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
* 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
* docs: Resolve several exception handling/propagation issues in the examples.Stefan Behnel2021-06-153-3/+3
|
* 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.
* 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.
* 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
|
* Document C inline properties.Stefan Behnel2020-07-091-0/+20
|
* In the documentation, update references to point at `setuptools`. (GH-3456)Diego Elio Pettenò2020-03-243-4/+3
| | | | | | While the directives in the source files are still called `distutils`, the [Python upstream documentation](https://docs.python.org/3/library/distutils.html) does not recommend using distutils anymore, and rather points at setuptools, so avoid confusing new users by providing confusing legacy usage examples. Also, this corrects one example in which Extension is imported too late, and would cause annoying errors when running `setup.py`.
* Describe refcount behaviour of object vs PyObject* (GH-3013)Alex Willmer2019-07-081-0/+20
|
* Minor typo of the word "declare"Sean Enck2019-04-151-1/+1
|
* Fix line endings.Stefan Behnel2019-02-1561-951/+951
|
* Fix early binding example (#2847)Federico Stra2019-02-152-3/+3
| | | | Fix early binding example. Closes GH-2848.
* Avoid signed vs. unsigned comparison warning for loop variables in ↵Stefan Behnel2019-02-091-52/+52
| | | | memoryview tutorial.
* fix typo in rectangle_cpdef.pyx exampleptype2018-11-071-1/+1
|
* Skip an openmp documentation test on MacOS.Stefan Behnel2018-08-241-0/+5
|
* Corrected the URL of the notebook, removed the output of the cells andgabrieldemarmiesse2018-08-211-3797/+10
| | | | ignored the build of the docs in git.
* Merge pull request #2465 from gabrieldemarmiesse/simplifying_memoryview_numpyscoder2018-08-1912-222/+4870
|\ | | | | Changed the numpy tutorial to make is faster to understand.
| * Made arrays bigger for profiling and corrected some sentences.gabrieldemarmiesse2018-08-193-125/+820
| |
| * Merge branch 'master' into simplifying_memoryview_numpyGabriel de Marmiesse2018-07-2345-6/+414
| |\
| * | docs: Emphasized the speedups of Cython vs NumPy in both the notebook and ↵gabrieldemarmiesse2018-07-051-125/+118
| | | | | | | | | | | | the docs.
| * | Changed the numpy tutorial to make is faster to understand. Added prange ↵gabrieldemarmiesse2018-07-0312-222/+4182
| | | | | | | | | | | | example.
* | | Fix "casting_python" test on old MSVC versions.Stefan Behnel2018-08-111-3/+5
| |/ |/| | | | | Closes #2489.
* | Merge pull request #2427 from gabrieldemarmiesse/test_fused_types_2scoder2018-07-071-5/+4
|\ \ | | | | | | Simplified the first example of fused types.
| * | Simplified the first example of fused types.gabrieldemarmiesse2018-06-261-5/+4
| |/
* | Add comment in doc example to explain that two ways to compare pointers are ↵Stefan Behnel2018-07-071-1/+1
| | | | | | | | equivalent
* | Merge pull request #2415 from gabrieldemarmiesse/test_language_basics_5scoder2018-07-071-0/+18
|\ \ | | | | | | Added tests for "language basics" part 5