|
1 | 1 | # Contributing |
2 | 2 |
|
3 | | -Contributions are welcome from any "array-consuming" library contributors who |
4 | | -have found themselves writing private array-agnostic functions in the process of |
5 | | -converting code to consume the standard. |
6 | | - |
7 | 3 | Thanks to [all contributors](contributors.md) so far! |
8 | 4 |
|
| 5 | +## Development workflow |
| 6 | + |
| 7 | +Development of array-api-extra is made easy with [Pixi](https://pixi.sh/latest/): |
| 8 | + |
| 9 | +- [Clone the repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) |
| 10 | + at <https://github.com/data-apis/array-api-extra>. |
| 11 | +- `cd array-api-extra`. |
| 12 | +- [Install Pixi](https://pixi.sh/latest/#installation). |
| 13 | + |
| 14 | +All development tasks are then available via `pixi run`: |
| 15 | + |
| 16 | +```bash |
| 17 | +pixi run tests # run the tests |
| 18 | +pixi run open-docs # build and preview the docs |
| 19 | +pixi run lint # run the full lint suite |
| 20 | +pixi run ipython # spawn an ipython prompt with array-api-extra installed |
| 21 | +pixi run hooks # install pre-commit hooks |
| 22 | +``` |
| 23 | + |
| 24 | +```{tip} |
| 25 | +Run `pixi task list` for a full list of available tasks. |
| 26 | +``` |
| 27 | + |
| 28 | +Alternative environments are available for the test tasks: |
| 29 | + |
| 30 | +```bash |
| 31 | +pixi run --environment=tests-numpy1 tests # test with numpy<2 installed |
| 32 | +pixi run --environment=tests-backends tests # test with additional CPU array backends |
| 33 | +pixi run --environment=tests-cuda tests # test with CUDA array backends |
| 34 | +``` |
| 35 | + |
| 36 | +```{tip} |
| 37 | +Run `pixi info` for a full list of environments and their tasks. |
| 38 | +``` |
| 39 | + |
| 40 | +````{note} |
| 41 | +You may also enter an activated developer environment shell, |
| 42 | +if you prefer this to the `pixi run` task workflow: |
| 43 | +
|
| 44 | +```bash |
| 45 | +pixi shell --environment=dev |
| 46 | +```` |
| 47 | + |
9 | 48 | ## How to contribute a new function |
10 | 49 |
|
11 | 50 | - [Open an issue](https://github.com/data-apis/array-api-extra/issues/new) to |
@@ -51,99 +90,3 @@ See [the tracker for adding delegation][delegation-tracker]. |
51 | 90 | - Don't worry if you are not sure how to do some of the above steps or think you |
52 | 91 | might have done something wrong - |
53 | 92 | [make a PR!](https://github.com/data-apis/array-api-extra/pulls) |
54 | | - |
55 | | -## Development workflow |
56 | | - |
57 | | -If you are an experienced contributor to Python packages, feel free to develop |
58 | | -however you feel comfortable! However, if you would like some guidance, |
59 | | -development of array-api-extra is made easy with |
60 | | -[Pixi](https://pixi.sh/latest/): |
61 | | - |
62 | | -- [Clone the repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) |
63 | | - at <https://github.com/data-apis/array-api-extra>. |
64 | | -- `cd array-api-extra`. |
65 | | -- [Install Pixi](https://pixi.sh/latest/#installation). |
66 | | -- To enter a development environment (if you prefer this to the `pixi run` interface): |
67 | | - |
68 | | -``` |
69 | | -pixi shell -e dev |
70 | | -``` |
71 | | - |
72 | | -- To run the tests: |
73 | | - |
74 | | -``` |
75 | | -pixi run tests |
76 | | -``` |
77 | | - |
78 | | -- To build the docs locally: |
79 | | - |
80 | | -``` |
81 | | -pixi run docs |
82 | | -``` |
83 | | - |
84 | | -- To build and preview the docs locally: |
85 | | - |
86 | | -``` |
87 | | -pixi run open-docs |
88 | | -``` |
89 | | - |
90 | | -- To install pre-commit hooks: |
91 | | - |
92 | | -``` |
93 | | -pixi run hooks |
94 | | -``` |
95 | | - |
96 | | -- To run pre-commit checks on staged files: |
97 | | - |
98 | | -``` |
99 | | -pixi run pre-commit |
100 | | -``` |
101 | | - |
102 | | -- To run the full lint suite: |
103 | | - |
104 | | -``` |
105 | | -pixi run --environment=lint lint |
106 | | -``` |
107 | | - |
108 | | -- To enter an interactive Python prompt: |
109 | | - |
110 | | -``` |
111 | | -pixi run ipython |
112 | | -``` |
113 | | - |
114 | | -- To run individual parts of the lint suite separately (for example): |
115 | | - |
116 | | -``` |
117 | | -pixi run --environment=lint pyright |
118 | | -pixi run --environment=lint dprint |
119 | | -``` |
120 | | - |
121 | | -- To generate the coverage report: |
122 | | - |
123 | | -``` |
124 | | -pixi run coverage |
125 | | -``` |
126 | | - |
127 | | -- To generate and display the coverage report: |
128 | | - |
129 | | -``` |
130 | | -pixi run open-coverage |
131 | | -``` |
132 | | - |
133 | | -Alternative environments are available with a subset of the dependencies and |
134 | | -tasks available in the `dev` environment: |
135 | | - |
136 | | -``` |
137 | | -pixi shell --environment=docs |
138 | | -pixi shell --environment=tests |
139 | | -pixi shell --environment=tests-backends |
140 | | -pixi shell --environment=lint |
141 | | -``` |
142 | | - |
143 | | -If you run on a host with CUDA hardware, you can enable extra tests: |
144 | | - |
145 | | -``` |
146 | | -pixi shell --environment=dev-cuda |
147 | | -pixi shell --environment=tests-cuda |
148 | | -pixi run --environment=tests-cuda tests |
149 | | -``` |
0 commit comments