Skip to content

Commit 1e69cbd

Browse files
committed
🎉
0 parents  commit 1e69cbd

13 files changed

+591
-0
lines changed

‎.github/dependabot.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
target-branch: main
6+
schedule:
7+
interval: daily
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"
12+
13+
- package-ecosystem: pip
14+
directory: /
15+
target-branch: main
16+
schedule:
17+
interval: daily
18+
groups:
19+
actions:
20+
patterns:
21+
- "*"

‎.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
12+
cancel-in-progress: true
13+
14+
env:
15+
UV_FROZEN: 1
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 2
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: typos
26+
uses: crate-ci/typos@master
27+
28+
- uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
python-version: "3.13"
32+
version: latest
33+
34+
- name: ruff
35+
run: |
36+
uv run ruff check --output-format=github
37+
uv run ruff format --check
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build and publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [prereleased, released]
7+
8+
jobs:
9+
pypi-publish:
10+
name: Publish release to PyPI
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/p/numpy-stubs
16+
permissions:
17+
id-token: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: setup uv
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
python-version: "3.13"
24+
- name: uv build
25+
run: uv build
26+
- name: publish to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1

‎.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
12+
# Cache
13+
.cache/
14+
.mypy_cache/
15+
.pytest_cache/
16+
.ruff_cache/
17+
.tox/

‎.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

‎.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"charliermarsh.ruff",
4+
"detachhead.basedpyright",
5+
"ms-python.mypy-type-checker",
6+
"ms-python.python",
7+
"tamasfe.even-better-toml"
8+
],
9+
"unwantedRecommendations": ["ms-pyright.pyright", "ms-python.vscode-pylance"]
10+
}

‎.vscode/settings.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"[python]": {
3+
"editor.rulers": [130]
4+
},
5+
"evenBetterToml.formatter.alignComments": true,
6+
"evenBetterToml.formatter.allowedBlankLines": 2,
7+
"evenBetterToml.formatter.arrayTrailingComma": true,
8+
"evenBetterToml.formatter.columnWidth": 100,
9+
"evenBetterToml.formatter.compactArrays": true,
10+
"evenBetterToml.formatter.compactInlineTables": true,
11+
"evenBetterToml.formatter.indentString": " ",
12+
"evenBetterToml.formatter.indentTables": true,
13+
"evenBetterToml.formatter.trailingNewline": true
14+
}

‎CONTRIBUTING.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# NumPy\'s Contributing guidelines
2+
3+
Welcome to the NumPy community! We\'re excited to have you here. Whether
4+
you\'re new to open source or experienced, your contributions help us
5+
grow.
6+
7+
Pull requests (PRs) are always welcome, but making a PR is just the
8+
start. Please respond to comments and requests for changes to help move
9+
the process forward. Please follow our [Code of
10+
Conduct](https://numpy.org/code-of-conduct/), which applies to all
11+
interactions, including issues and PRs.
12+
13+
For more, please read <https://www.numpy.org/devdocs/dev/index.html>
14+
15+
Thank you for contributing, and happy coding!

‎LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2025, NumPy Developers.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# numpy-stubs

‎pyproject.toml

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "numpy-stubs"
7+
version = "2.2.2.0.dev0"
8+
description = "Official typing stubs for NumPy"
9+
readme = "README.md"
10+
authors = [{name = "Joren Hammudoglu", email = "[email protected]"}]
11+
maintainers = [{name = "NumPy Developers", email = "[email protected]"}]
12+
license = "BSD-3-Clause"
13+
keywords = ["numpy", "stubs", "typing", "types", "pep484"]
14+
classifiers = [
15+
"Development Status :: 3 - Alpha",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: BSD License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Typing :: Stubs Only",
26+
"Typing :: Typed",
27+
]
28+
requires-python = ">=3.11"
29+
dependencies = []
30+
31+
[project.optional-dependencies]
32+
numpy = ["numpy>=2.2.2,<2.3"]
33+
34+
[project.urls]
35+
Homepage = "https://numpy.org/"
36+
Repository = "https://github.com/jorenham/numpyi/"
37+
Issues = "https://github.com/jorenham/numpyi/issues"
38+
Changelog = "https://github.com/jorenham/numpyi/releases"
39+
40+
[dependency-groups]
41+
numpy = ["numpy-stubs[numpy]"]
42+
dev = [
43+
{include-group = "numpy"},
44+
"ruff>=0.9.3",
45+
"basedmypy[faster-cache]>=2.9.1",
46+
"basedpyright>=1.24.0",
47+
]
48+
49+
[tool.hatch.build]
50+
packages = ["numpy-stubs"]
51+
52+
53+
[tool.mypy]
54+
files = ["src/**/*.py", "src/**/*.pyi"]
55+
python_version = "3.11"
56+
strict = true
57+
disable_bytearray_promotion = true
58+
disable_memoryview_promotion = true
59+
enable_error_code = ["ignore-without-code", "truthy-bool"]
60+
61+
# basedmypy only
62+
warn_unreachable = false
63+
warn_unused_ignores = false
64+
disallow_any_explicit = false
65+
66+
67+
[tool.pyright]
68+
include = ["src"]
69+
ignore = [".venv"]
70+
venv = ".venv"
71+
venvPath = "."
72+
stubPath = "."
73+
pythonVersion = "3.11"
74+
pythonPlatform = "All"
75+
typeCheckingMode = "strict"
76+
77+
deprecateTypingAliases = true
78+
enableReachabilityAnalysis = false
79+
enableTypeIgnoreComments = false
80+
reportCallInDefaultInitializer = true
81+
reportImplicitOverride = true
82+
reportImportCycles = true
83+
reportMissingSuperCall = true
84+
reportPrivateUsage = false
85+
reportPropertyTypeMismatch = false
86+
reportShadowedImports = true
87+
reportUninitializedInstanceVariable = true
88+
reportUnnecessaryTypeIgnoreComment = true
89+
90+
# basedpyright only
91+
failOnWarnings = true
92+
reportIgnoreCommentWithoutRule = true
93+
reportImplicitAbstractClass = true
94+
reportImplicitRelativeImport = true
95+
reportImplicitStringConcatenation = false
96+
reportInvalidCast = true
97+
reportPrivateLocalImportUsage = true
98+
reportUnannotatedClassAttribute = true
99+
strictGenericNarrowing = true
100+
101+
102+
[tool.ruff]
103+
src = ["src"]
104+
extend-exclude = [".git", ".mypy_cache", ".tox", ".venv"]
105+
force-exclude = true
106+
# https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#maximum-line-length
107+
line-length = 130
108+
preview = true
109+
110+
[tool.ruff.format]
111+
docstring-code-format = true
112+
line-ending = "lf"
113+
114+
[tool.ruff.lint]
115+
select = ["ALL"]
116+
ignore = [
117+
"COM812", # flake8-commas: missing-trailing-comma
118+
"CPY", # flake8-copyright
119+
"EM", # flake8-errmsg
120+
"FA100", # flake8-future-annotations: future-rewritable-type-annotation
121+
"T20", # flake8-print
122+
"TC001", # flake8-type-checking: typing-only-first-party-import
123+
"TC003", # flake8-type-checking: typing-only-standard-library-import
124+
"TD003", # flake8-todo: Missing issue link for this TODO
125+
"FIX", # flake8-fixme
126+
]
127+
128+
[tool.ruff.lint.per-file-ignores]
129+
"*.pyi" = [
130+
"E741", # pycodestyle/E: ambiguous-variable-name
131+
"E742", # pycodestyle/E: ambiguous-class-name
132+
"E743", # pycodestyle/E: ambiguous-function-name
133+
"N", # pep8-naming
134+
"D", # pydocstyle
135+
"ANN401", # flake8-annotations: any-type
136+
"A", # flake8-builtins
137+
"DOC", # flake8-docstrings
138+
"PYI054", # flake8-pyi: numeric-literal-too-long
139+
"PYI064", # flake8-pyi: redundant-final-literal
140+
"PLC2701", # pylint/C: import-private-name
141+
"PLR0904", # pylint/R: too-many-public-methods
142+
"PLR0913", # pylint/R: too-many-arguments
143+
"PLR0917", # pylint/R: too-many-positional-arguments
144+
"PLR2044", # pylint/R: empty-comment
145+
"PLR6301", # pylint/R: no-self-use
146+
"PLW3201", # pylint/W: bad-dunder-method-name
147+
"FURB", # refurb
148+
]
149+
150+
[tool.ruff.lint.flake8-annotations]
151+
suppress-dummy-args = true
152+
153+
[tool.ruff.lint.flake8-import-conventions]
154+
banned-from = ["abc", "ctypes", "datetime", "os", "sys", "numpy", "numpy.typing"]
155+
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
156+
"ctypes" = "ct"
157+
"datetime" = "dt"
158+
"numpy" = "np"
159+
"numpy.typing" = "npt"
160+
161+
[tool.ruff.lint.isort]
162+
case-sensitive = true
163+
combine-as-imports = true
164+
extra-standard-library = ["_typeshed", "typing_extensions"]
165+
known-first-party = ["numpy"]
166+
split-on-trailing-comma = true
167+
168+
[tool.ruff.lint.pydocstyle]
169+
convention = "numpy"
170+
171+
172+
[tool.typos.files]
173+
extend-exclude = ["*.pyi", ".mypyignore"]

‎src/numpy-stubs/__init__.pyi

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from typing import Any
2+
3+
def __getattr__(name: str) -> Any: ...

0 commit comments

Comments
 (0)