Skip to content

Commit d95f470

Browse files
authored
Merge pull request #902 from lucascolley/dev-workflow
DEV/DOC: overhaul dev workflow docs
2 parents 95552ef + cbf0c83 commit d95f470

3 files changed

Lines changed: 47 additions & 102 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
environments: docs
3232

3333
- name: Build Docs
34-
run: pixi run -e docs docs
34+
run: pixi run docs
3535

3636
- name: Upload Artifact
3737
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

docs/contributing.md

Lines changed: 43 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,50 @@
11
# Contributing
22

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-
73
Thanks to [all contributors](contributors.md) so far!
84

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+
948
## How to contribute a new function
1049

1150
- [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].
5190
- Don't worry if you are not sure how to do some of the above steps or think you
5291
might have done something wrong -
5392
[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-
```

pixi.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[workspace]
2+
name = "array-api-extra"
3+
description = "Extra array functions built on top of the array API standard."
24
channels = ["https://prefix.dev/conda-forge"]
35
platforms = [
46
"linux-64",
@@ -128,7 +130,7 @@ hooks = {
128130
default-environment = "lint",
129131
}
130132
pre-commit = {
131-
description = "Run pre-commit checks",
133+
description = "Run pre-commit checks on staged files",
132134
cmd = "lefthook run pre-commit",
133135
default-environment = "lint",
134136
}

0 commit comments

Comments
 (0)