@@ -49,8 +49,8 @@ pixi shell --environment=dev
4949
5050- [ Open an issue] ( https://github.com/data-apis/array-api-extra/issues/new ) to
5151 propose the new function. You may want to wait for initial feedback on the
52- issue before diving into an implementation. Feel free to skip this step if
53- there is already an open issue for the function.
52+ issue before diving into an implementation.
53+ Skip this step if there is already an open issue for the function.
5454- Add the implementation of your function to
5555 ` src/array_api_extra/_lib/_funcs.py ` .
5656 - Ensure that your function includes type annotations and a
@@ -62,31 +62,27 @@ pixi shell --environment=dev
6262 - Ensure that ` lazy_xp_function ` is called on the function if lazy backends
6363 are supposed to be tested.
6464- Add your function to ` docs/api-reference.md ` .
65- - [ Make a PR! ] ( https://github.com/data-apis/array-api-extra/pulls )
66-
67- ## How to add delegation to a function
65+ - Don't worry if you are not sure how to do some of the above steps or think you
66+ might have done something wrong -
67+ [ make a PR! ] ( https://github.com/data-apis/array-api-extra/pulls )
6868
69- See [ the tracker for adding delegation ] [ delegation-tracker ] .
69+ ### Delegation
7070
71- [ delegation-tracker ] : https://github.com/data-apis/array-api-extra/issues/100
71+ Many new functions should also have 'delegation' to existing implementations in
72+ known array libraries added. This can happen in the same PR which adds the function,
73+ or in a follow-up PR.
7274
73- - If you would like to discuss the task before diving into the implementation,
74- click on the three dots next to the function on the tracker issue, and choose
75- "Convert to sub-issue".
7675- Create a function in ` src/array_api_extra/_delegation.py ` with a signature
7776 matching the function in ` src/array_api_extra/_lib/_funcs.py ` , and move the
7877 docstring to the new function. Leave a one-line docstring in ` _funcs.py ` ,
7978 pointing to ` _delegation.py ` to see the full docstring.
8079- Also move the initial ` array_namespace ` call and any input validation over to
8180 the new function.
82- - Add delegation to backends using the ` if _delegate ` pattern . See
81+ - Add delegation to backends using the ` if_*_namespace ` functions . See
8382 ` src/array_api_extra/_lib/_backends.py ` for the full list of backends we have
8483 worked with so far.
8584- After all delegation layers, return the result from the implementation in
8685 ` _funcs ` .
8786- Simplify the signature in ` _funcs.py ` to remove impossible arguments now that
8887 it is only called internally via ` _delegation ` . For example, the ` xp `
8988 parameter can be changed from type ` ArrayNamespace | None ` to ` ArrayNamespace ` .
90- - Don't worry if you are not sure how to do some of the above steps or think you
91- might have done something wrong -
92- [ make a PR!] ( https://github.com/data-apis/array-api-extra/pulls )
0 commit comments