Skip to content

Commit

Permalink
Merge branch 'main' into at
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Dec 12, 2024
2 parents ec90884 + 7ff0d0a commit d3a5bc4
Show file tree
Hide file tree
Showing 18 changed files with 79 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
"profile": "https://github.com/crusaderky",
"contributions": [
"code",
"doc"
"doc",
"tool"
]
}
]
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
additional_dependencies: [black==24.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -35,14 +35,14 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.3"
rev: "v3.4.2"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.1"
rev: "v0.8.2"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -68,13 +68,13 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.19"
rev: "v0.23"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.29.1"
rev: "0.30.0"
hooks:
- id: check-dependabot
- id: check-github-workflows
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This project exists thanks to the following contributors
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://ogrisel.com"><img src="https://avatars.githubusercontent.com/u/89061?v=4?s=100" width="100px;" alt="Olivier Grisel"/><br /><sub><b>Olivier Grisel</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=ogrisel" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/crusaderky"><img src="https://avatars.githubusercontent.com/u/6213168?v=4?s=100" width="100px;" alt="Guido Imperiale"/><br /><sub><b>Guido Imperiale</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/crusaderky"><img src="https://avatars.githubusercontent.com/u/6213168?v=4?s=100" width="100px;" alt="Guido Imperiale"/><br /><sub><b>Guido Imperiale</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Documentation">📖</a> <a href="#tool-crusaderky" title="Tools">🔧</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This project exists thanks to the following contributors
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://ogrisel.com"><img src="https://avatars.githubusercontent.com/u/89061?v=4?s=100" width="100px;" alt="Olivier Grisel"/><br /><sub><b>Olivier Grisel</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=ogrisel" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/crusaderky"><img src="https://avatars.githubusercontent.com/u/6213168?v=4?s=100" width="100px;" alt="Guido Imperiale"/><br /><sub><b>Guido Imperiale</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/crusaderky"><img src="https://avatars.githubusercontent.com/u/6213168?v=4?s=100" width="100px;" alt="Guido Imperiale"/><br /><sub><b>Guido Imperiale</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=crusaderky" title="Documentation">📖</a> <a href="#tool-crusaderky" title="Tools">🔧</a></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import importlib.metadata
from typing import Any

Expand Down Expand Up @@ -38,7 +36,7 @@
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
</svg>
""",
""", # noqa: E501
"class": "",
},
],
Expand Down
14 changes: 13 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,25 @@ pixi shell -e dev
pixi run tests
```

- To generate the coverage report:

```
pixi run coverage
```

- To generate and display the coverage report:

```
pixi run open-coverage
```

- To build the docs locally:

```
pixi run docs
```

- To open and preview the locally-built docs:
- To build and preview the docs locally:

```
pixi run open-docs
Expand Down
61 changes: 29 additions & 32 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@ pre-commit = "*"
pylint = "*"
basedmypy = "*"
basedpyright = "*"
typing_extensions = ">=4.12.2,<4.13"
# import dependencies for mypy:
array-api-strict = "*"
numpy = "*"
pytest = "*"

[tool.pixi.feature.lint.tasks]
pre-commit-install = { cmd = "pre-commit install" }
pre-commit = { cmd = "pre-commit run -v --all-files --show-diff-on-failure" }
pre-commit = { cmd = "pre-commit run --all-files" }
mypy = { cmd = "mypy", cwd = "." }
pylint = { cmd = ["pylint", "array_api_extra"], cwd = "src" }
pyright = { cmd = "basedpyright", cwd = "." }
Expand All @@ -99,21 +98,22 @@ array-api-strict = "*"
numpy = "*"

[tool.pixi.feature.tests.tasks]
tests = { cmd = "pytest" }
tests-ci = { cmd = "pytest -ra --cov --cov-report=xml --cov-report=term --durations=20" }
tests = { cmd = "pytest -v" }
tests-ci = { cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20" }
tests-vendor = { cmd = "pytest vendor_tests" }
coverage = { cmd = ["coverage", "html"], depends-on = ["tests-ci"] }
open-coverage = { cmd = ["open", "htmlcov/index.html"], depends-on = ["coverage"] }

[tool.pixi.feature.docs.dependencies]
sphinx = ">=7.0"
furo = ">=2023.08.17"
myst-parser = ">=0.13"
sphinx-copybutton = "*"
sphinx-autodoc-typehints = "*"
typing_extensions = ">=4.12.2,<4.13"

[tool.pixi.feature.docs.tasks]
docs = { cmd = ["sphinx-build", ".", "build/"], cwd = "docs" }
open-docs = { cmd = ["open", "build/index.html"], cwd = "docs" }
open-docs = { cmd = ["open", "build/index.html"], cwd = "docs", depends-on = ["docs"] }

[tool.pixi.feature.dev.dependencies]
ipython = "*"
Expand Down Expand Up @@ -189,6 +189,7 @@ run.source = ["array_api_extra"]
report.exclude_also = [
'\.\.\.',
'if typing.TYPE_CHECKING:',
'if TYPE_CHECKING:',
]


Expand Down Expand Up @@ -237,11 +238,16 @@ target-version = "py310"
[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"F", # Pyflakes
"I", # isort
"E", # Pycodestyle
"W", # Pycodestyle
"N", # pep8-naming
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
Expand All @@ -257,11 +263,15 @@ extend-select = [
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
"UP", # Pyupgrade
]
ignore = [
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"ISC001", # Conflicts with formatter
"N801", # Class name should use CapWords convention
"N802", # Function name should be lowercase
"N806", # Variable in function should be lowercase
"PD008", # Use `.loc` instead of `.at`
]

Expand Down
2 changes: 0 additions & 2 deletions src/array_api_extra/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990

from ._funcs import (
at,
atleast_nd,
Expand Down
7 changes: 2 additions & 5 deletions src/array_api_extra/_funcs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990
from __future__ import annotations

import operator
import typing
import warnings

# https://github.com/pylint-dev/pylint/issues/10112
Expand All @@ -14,9 +13,7 @@
is_jax_array,
is_writeable_array,
)

if typing.TYPE_CHECKING:
from ._lib._typing import Array, Index, ModuleType
from ._lib._typing import Array, Index, ModuleType

__all__ = [
"at",
Expand Down
1 change: 0 additions & 1 deletion src/array_api_extra/_lib/_compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Allow packages that vendor both `array-api-extra` and
# `array-api-compat` to override the import location
from __future__ import annotations

try:
from ..._array_api_compat_vendor import ( # pyright: ignore[reportMissingImports]
Expand Down
Loading

0 comments on commit d3a5bc4

Please sign in to comment.