Skip to content

🤖 dprint #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"json": {
"lineWidth": 88,
"array.preferSingleLine": true,
},
"markdown": {
"lineWidth": 88,
"emphasisKind": "asterisks",
},
"yaml": {
"printWidth": 88,
"formatComments": true,
"braceSpacing": false,
},
"excludes": ["**/*-lock.json", "**/*.lock", "**/node_modules/", "dist/"],
"plugins": [
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
"https://plugins.dprint.dev/json-0.20.0.wasm",
"https://plugins.dprint.dev/markdown-0.19.0.wasm",
"https://plugins.dprint.dev/toml-0.7.0.wasm",
],
}
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: dprint
uses: dprint/check@9cb3a2b17a8e606d37aae341e49df3654933fc23 # v2.3

- name: Install uv
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
> for working with the [Python array API standard](https://data-apis.org/array-api/latest/), but it
> may change significantly in the future.


## Installation

```bash
Expand Down Expand Up @@ -45,6 +44,7 @@ pip install -e . # editable mode

### Quick example

<!-- dprint-ignore-start -->
```pycon
>>> import array_api_typing as xpt
>>> import numpy as np
Expand All @@ -56,3 +56,4 @@ pip install -e . # editable mode
array([1, 2, 3])

```
<!-- dprint-ignore-end -->
4 changes: 4 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ templates:
pre-commit:
parallel: true
jobs:
- name: dprint
glob: "*.{json,jsonc,md,toml,yaml,yml}"
stage_fixed: true
run: uv {run} dprint fmt --incremental=false
- name: ruff
glob: "*.{py,pyi}"
stage_fixed: true
Expand Down
268 changes: 131 additions & 137 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,158 +1,152 @@
[project]
name = "array-api-typing"
dynamic = ["version"]
description = "Static typing support for the array API standard"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
{ name = "Consortium for Python Data API Standards", email = "[email protected]" },
{ name = "Joren Hammudoglu", email = "[email protected]" },
{ name = "Nathaniel Starkman", email = "[email protected]" },
]
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dependencies = [
"typing-extensions>=4.14.1",
]

[project.urls]
Repository = "https://github.com/data-apis/array-api-typing"
Changelog = "https://github.com/data-apis/array-api-typing/releases"

name = "array-api-typing"
dynamic = ["version"]
description = "Static typing support for the array API standard"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
{ name = "Consortium for Python Data API Standards", email = "[email protected]" },
{ name = "Joren Hammudoglu", email = "[email protected]" },
{ name = "Nathaniel Starkman", email = "[email protected]" },
]
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dependencies = [
"typing-extensions>=4.14.1",
]

[project.urls]
Repository = "https://github.com/data-apis/array-api-typing"
Changelog = "https://github.com/data-apis/array-api-typing/releases"

[build-system]
requires = ["hatch-vcs", "hatchling"]
build-backend = "hatchling.build"

requires = ["hatch-vcs", "hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
{ include-group = "lint" },
{ include-group = "mypy" },
{ include-group = "test_runtime" },
{ include-group = "test_numpy" },
"lefthook==1.12.0",
"orjson>=3.11.0; python_version<'3.14'", # used by mypy
]
lint = [
"ruff==0.12.4",
]
mypy = [
"mypy==1.17.0",
]
test_runtime = [
"pytest==8.4.1",
"pytest-cov>=6.2.1",
"pytest-github-actions-annotate-failures==0.3.0",
"sybil==9.1.0",
]
test_numpy = [
"numpy>=1.25",
]

dev = [
{ include-group = "lint" },
{ include-group = "mypy" },
{ include-group = "test_runtime" },
{ include-group = "test_numpy" },
"lefthook==1.12.2",
"orjson>=3.11.0; python_version<'3.14'", # used by mypy
]
lint = [
"ruff==0.12.4",
"dprint-py>=0.50.0.0",
]
mypy = [
"mypy==1.17.0",
]
test_runtime = [
"pytest==8.4.1",
"pytest-cov>=6.2.1",
"pytest-github-actions-annotate-failures==0.3.0",
"sybil==9.1.0",
]
test_numpy = [
"numpy>=1.25",
]

[tool.hatch]
version.source = "vcs"
version.source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/array_api_typing/_version.py"
template = '''
[tool.hatch.build.hooks.vcs]
version-file = "src/array_api_typing/_version.py"
template = '''
# This file is automatically generated by Hatch
version = {version!r}
version_tuple = {version_tuple!r}
'''


[tool.coverage]
report.exclude_also = ['\.\.\.', 'if typing.TYPE_CHECKING:']
run.source = ["array-api-typing"]
run.branch = true

report.exclude_also = ['\.\.\.', 'if typing.TYPE_CHECKING:']
run.source = ["array-api-typing"]
run.branch = true

[tool.mypy]
mypy_path = ["src"]
namespace_packages = true

strict = true
allow_redefinition_new = true
local_partial_types = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
mypy_path = ["src"]
namespace_packages = true

strict = true
allow_redefinition_new = true
local_partial_types = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true

[tool.pytest.ini_options]
addopts = [
"--showlocals",
"--strict-config",
"--strict-markers",
"-p no:doctest", # using sybil
"-ra",
]
filterwarnings = [
"error",
# Sybil
"ignore:Attribute s is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
"ignore:ast\\.Str is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
]
log_cli_level = "INFO"
minversion = "8.4"
testpaths = ["README.md", "src/", "tests/runtime/"]
xfail_strict = true

addopts = [
"--showlocals",
"--strict-config",
"--strict-markers",
"-p no:doctest", # using sybil
"-ra",
]
filterwarnings = [
"error",
# Sybil
"ignore:Attribute s is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
"ignore:ast\\.Str is deprecated and will be removed in Python 3\\.14:DeprecationWarning",
]
log_cli_level = "INFO"
minversion = "8.4"
testpaths = ["README.md", "src/", "tests/runtime/"]
xfail_strict = true

[tool.ruff]
preview = true
force-exclude = true

[tool.ruff.lint]
extend-select = ["ALL"]
ignore = [
"COM812", # Conflicts with formatter
"CPY", # Missing copyright notice at top of file (NOTE revisit when autofixable)
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"ISC001", # Conflicts with formatter
]

[tool.ruff.lint.pylint]
allow-dunder-method-names = [
"__array_api_version__",
"__array_namespace__",
"__array_namespace_info__",
"__dlpack__",
"__dlpack_device__",
"__dlpack_device__",
]

[tool.ruff.lint.flake8-import-conventions]
banned-from = ["array_api_typing"]

[tool.ruff.lint.flake8-import-conventions.extend-aliases]
array_api_typing = "xpt"

[tool.ruff.lint.isort]
combine-as-imports = true
extra-standard-library = ["_typeshed", "typing_extensions"]
known-local-folder = ["array_api_typing"]

[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"
preview = true
force-exclude = true

[tool.ruff.lint]
extend-select = ["ALL"]
ignore = [
"COM812", # Conflicts with formatter
"CPY", # Missing copyright notice at top of file (NOTE revisit when autofixable)
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"ISC001", # Conflicts with formatter
]

[tool.ruff.lint.pylint]
allow-dunder-method-names = [
"__array_api_version__",
"__array_namespace__",
"__array_namespace_info__",
"__dlpack__",
"__dlpack_device__",
"__dlpack_device__",
]

[tool.ruff.lint.flake8-import-conventions]
banned-from = ["array_api_typing"]

[tool.ruff.lint.flake8-import-conventions.extend-aliases]
array_api_typing = "xpt"

[tool.ruff.lint.isort]
combine-as-imports = true
extra-standard-library = ["_typeshed", "typing_extensions"]
known-local-folder = ["array_api_typing"]

[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"
4 changes: 2 additions & 2 deletions tests/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extend = "../pyproject.toml"
[lint]
extend-ignore = [
"ANN201", # https://docs.astral.sh/ruff/rules/missing-return-type-undocumented-public-function/
"D1", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"D1", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"INP001", # https://docs.astral.sh/ruff/rules/implicit-namespace-package/
"S101", # https://docs.astral.sh/ruff/rules/assert/
"S101", # https://docs.astral.sh/ruff/rules/assert/
]
Loading
Loading