Skip to content

Commit 6fff003

Browse files
authored
DEV: set up package with cookie (#1)
1 parent 496bcab commit 6fff003

14 files changed

+2371
-25
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GitHub syntax highlighting
2+
pixi.lock linguist-language=YAML linguist-generated=true

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

.github/workflows/ci.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
# Many color libraries just need this to be set to any value, but at least
16+
# one distinguishes color depth, where "3" -> "256-bit color".
17+
FORCE_COLOR: 3
18+
19+
jobs:
20+
pre-commit-and-lint:
21+
name: Format
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
- uses: pre-commit/[email protected]
31+
with:
32+
extra_args: --hook-stage manual --all-files
33+
- uses: prefix-dev/[email protected]
34+
with:
35+
pixi-version: v0.30.0
36+
cache: true
37+
auth-host: prefix.dev
38+
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
39+
- name: Run lint checks
40+
run: pixi run lint
41+
42+
checks:
43+
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
44+
runs-on: ${{ matrix.runs-on }}
45+
needs: [pre-commit-and-lint]
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
python-version: ["3.9", "3.13"]
50+
runs-on: [ubuntu-latest, windows-latest, macos-14]
51+
52+
include:
53+
- python-version: "pypy-3.10"
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
60+
61+
- uses: actions/setup-python@v5
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
allow-prereleases: true
65+
66+
- name: Install package
67+
run: python -m pip install .[test]
68+
69+
- name: Test package
70+
run: pixi run test-ci -e dev
71+
72+
- name: Upload coverage report
73+
uses: codecov/[email protected]
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

+23-24
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,7 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110-
.pdm.toml
111-
.pdm-python
112-
.pdm-build/
113-
114-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
11598
__pypackages__/
11699

117100
# Celery stuff
@@ -154,9 +137,25 @@ dmypy.json
154137
# Cython debug symbols
155138
cython_debug/
156139

157-
# PyCharm
158-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160-
# and can be added to the global gitignore or merged into this file. For a more nuclear
161-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
140+
# setuptools_scm
141+
src/*/_version.py
142+
143+
144+
# ruff
145+
.ruff_cache/
146+
147+
# OS specific stuff
148+
.DS_Store
149+
.DS_Store?
150+
._*
151+
.Spotlight-V100
152+
.Trashes
153+
ehthumbs.db
154+
Thumbs.db
155+
156+
# Common editor files
157+
*~
158+
*.swp
159+
# pixi environments
160+
.pixi
161+
*.egg-info

.pre-commit-config.yaml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
ci:
2+
autoupdate_commit_msg: "chore: update pre-commit hooks"
3+
autofix_commit_msg: "style: pre-commit fixes"
4+
5+
exclude: ^.cruft.json|.copier-answers.yml$
6+
7+
repos:
8+
- repo: https://github.com/adamchainz/blacken-docs
9+
rev: "1.18.0"
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies: [black==24.*]
13+
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: "v4.6.0"
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-case-conflict
19+
- id: check-merge-conflict
20+
- id: check-symlinks
21+
- id: check-yaml
22+
- id: debug-statements
23+
- id: end-of-file-fixer
24+
- id: mixed-line-ending
25+
- id: name-tests-test
26+
args: ["--pytest-test-first"]
27+
- id: requirements-txt-fixer
28+
- id: trailing-whitespace
29+
30+
- repo: https://github.com/pre-commit/pygrep-hooks
31+
rev: "v1.10.0"
32+
hooks:
33+
- id: rst-backticks
34+
- id: rst-directive-colons
35+
- id: rst-inline-touching-normal
36+
37+
- repo: https://github.com/rbubley/mirrors-prettier
38+
rev: "v3.3.3"
39+
hooks:
40+
- id: prettier
41+
types_or: [yaml, markdown, html, css, scss, javascript, json]
42+
args: [--prose-wrap=always]
43+
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: "v0.6.1"
46+
hooks:
47+
- id: ruff
48+
args: ["--fix", "--show-fixes"]
49+
- id: ruff-format
50+
51+
- repo: https://github.com/pre-commit/mirrors-mypy
52+
rev: "v1.11.1"
53+
hooks:
54+
- id: mypy
55+
files: src|tests
56+
args: []
57+
additional_dependencies:
58+
- pytest
59+
60+
- repo: https://github.com/codespell-project/codespell
61+
rev: "v2.3.0"
62+
hooks:
63+
- id: codespell
64+
exclude: pixi.lock
65+
66+
- repo: https://github.com/shellcheck-py/shellcheck-py
67+
rev: "v0.10.0.1"
68+
hooks:
69+
- id: shellcheck
70+
71+
- repo: local
72+
hooks:
73+
- id: disallow-caps
74+
name: Disallow improper capitalization
75+
language: pygrep
76+
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
77+
exclude: .pre-commit-config.yaml
78+
79+
- repo: https://github.com/abravalheri/validate-pyproject
80+
rev: "v0.19"
81+
hooks:
82+
- id: validate-pyproject
83+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
84+
85+
- repo: https://github.com/python-jsonschema/check-jsonschema
86+
rev: "0.29.1"
87+
hooks:
88+
- id: check-dependabot
89+
- id: check-github-workflows
90+
- id: check-readthedocs

.readthedocs.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3.12"
10+
commands:
11+
- asdf plugin add uv
12+
- asdf install uv latest
13+
- asdf global uv latest
14+
- uv venv
15+
- uv pip install .[docs]
16+
- .venv/bin/python -m sphinx -T -b html -d docs/_build/doctrees -D
17+
language=en docs $READTHEDOCS_OUTPUT/html

README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
# array-api-extra
2-
Extra array functions that aren't in the array API standard
2+
3+
[![Actions Status][actions-badge]][actions-link]
4+
[![Documentation Status][rtd-badge]][rtd-link]
5+
6+
[![PyPI version][pypi-version]][pypi-link]
7+
[![Conda-Forge][conda-badge]][conda-link]
8+
[![PyPI platforms][pypi-platforms]][pypi-link]
9+
10+
[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
11+
12+
<!-- SPHINX-START -->
13+
14+
<!-- prettier-ignore-start -->
15+
[actions-badge]: https://github.com/data-apis/array-api-extra/workflows/CI/badge.svg
16+
[actions-link]: https://github.com/data-apis/array-api-extra/actions
17+
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/array-api-extra
18+
[conda-link]: https://github.com/conda-forge/array-api-extra-feedstock
19+
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
20+
[github-discussions-link]: https://github.com/data-apis/array-api-extra/discussions
21+
[pypi-link]: https://pypi.org/project/array-api-extra/
22+
[pypi-platforms]: https://img.shields.io/pypi/pyversions/array-api-extra
23+
[pypi-version]: https://img.shields.io/pypi/v/array-api-extra
24+
[rtd-badge]: https://readthedocs.org/projects/array-api-extra/badge/?version=latest
25+
[rtd-link]: https://array-api-extra.readthedocs.io/en/latest/?badge=latest
26+
27+
<!-- prettier-ignore-end -->
28+
29+
Extra array functions that aren't in the array API standard, implemented in
30+
terms of the standard.

docs/conf.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from __future__ import annotations
2+
3+
import importlib.metadata
4+
from typing import Any
5+
6+
project = "array-api-extra"
7+
version = release = importlib.metadata.version("array_api_extra")
8+
9+
extensions = [
10+
"myst_parser",
11+
"sphinx.ext.autodoc",
12+
"sphinx.ext.intersphinx",
13+
"sphinx.ext.mathjax",
14+
"sphinx.ext.napoleon",
15+
"sphinx_autodoc_typehints",
16+
"sphinx_copybutton",
17+
]
18+
19+
source_suffix = [".rst", ".md"]
20+
exclude_patterns = [
21+
"_build",
22+
"**.ipynb_checkpoints",
23+
"Thumbs.db",
24+
".DS_Store",
25+
".env",
26+
".venv",
27+
]
28+
29+
html_theme = "furo"
30+
31+
html_theme_options: dict[str, Any] = {
32+
"footer_icons": [
33+
{
34+
"name": "GitHub",
35+
"url": "https://github.com/data-apis/array-api-extra",
36+
"html": """
37+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
38+
<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>
39+
</svg>
40+
""",
41+
"class": "",
42+
},
43+
],
44+
"source_repository": "https://github.com/data-apis/array-api-extra",
45+
"source_branch": "main",
46+
"source_directory": "docs/",
47+
}
48+
49+
myst_enable_extensions = [
50+
"colon_fence",
51+
]
52+
53+
intersphinx_mapping = {
54+
"python": ("https://docs.python.org/3", None),
55+
}
56+
57+
nitpick_ignore = [
58+
("py:class", "_io.StringIO"),
59+
("py:class", "_io.BytesIO"),
60+
]
61+
62+
always_document_param_types = True

docs/index.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# array-api-extra
2+
3+
```{toctree}
4+
:maxdepth: 2
5+
:hidden:
6+
7+
```
8+
9+
```{include} ../README.md
10+
:start-after: <!-- SPHINX-START -->
11+
```
12+
13+
## Indices and tables
14+
15+
- {ref}`genindex`
16+
- {ref}`modindex`
17+
- {ref}`search`

0 commit comments

Comments
 (0)