inline-snapshot-numpy 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- inline_snapshot_numpy-0.1.0/.copier-answers.yml +27 -0
- inline_snapshot_numpy-0.1.0/.copier-enforce.json +5 -0
- inline_snapshot_numpy-0.1.0/.github/FUNDING.yml +1 -0
- inline_snapshot_numpy-0.1.0/.github/actions/setup/action.yml +22 -0
- inline_snapshot_numpy-0.1.0/.github/pull_request_template.md +22 -0
- inline_snapshot_numpy-0.1.0/.github/workflows/ci.yml +236 -0
- inline_snapshot_numpy-0.1.0/.github/workflows/release-pr.yml +53 -0
- inline_snapshot_numpy-0.1.0/.github/workflows/weekly.yml +45 -0
- inline_snapshot_numpy-0.1.0/.gitignore +8 -0
- inline_snapshot_numpy-0.1.0/.pre-commit-config.yaml +103 -0
- inline_snapshot_numpy-0.1.0/CHANGELOG.md +3 -0
- inline_snapshot_numpy-0.1.0/CONTRIBUTING.md +39 -0
- inline_snapshot_numpy-0.1.0/LICENSE +21 -0
- inline_snapshot_numpy-0.1.0/PKG-INFO +86 -0
- inline_snapshot_numpy-0.1.0/README.md +59 -0
- inline_snapshot_numpy-0.1.0/changelog.d/.gitignore +1 -0
- inline_snapshot_numpy-0.1.0/pyproject.toml +116 -0
- inline_snapshot_numpy-0.1.0/src/inline_snapshot_numpy/__init__.py +105 -0
- inline_snapshot_numpy-0.1.0/tests/test_numpy.py +173 -0
- inline_snapshot_numpy-0.1.0/uv.lock +2004 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier
|
|
2
|
+
_commit: v0.4.3
|
|
3
|
+
_src_path: https://github.com/15r10nk/project-template.git
|
|
4
|
+
author_email: 15r10nk@polarbit.de
|
|
5
|
+
author_name: Frank Hoffmann
|
|
6
|
+
discord_id: ''
|
|
7
|
+
discord_invite_id: ''
|
|
8
|
+
full_coverage: true
|
|
9
|
+
github_user: 15r10nk
|
|
10
|
+
insider_only: false
|
|
11
|
+
module_name: inline_snapshot_numpy
|
|
12
|
+
project_description: NumPy integration for inline-snapshot
|
|
13
|
+
project_main: false
|
|
14
|
+
project_name: inline-snapshot-numpy
|
|
15
|
+
pypy_versions:
|
|
16
|
+
- pypy3.11
|
|
17
|
+
python_versions:
|
|
18
|
+
- '3.9'
|
|
19
|
+
- '3.10'
|
|
20
|
+
- '3.11'
|
|
21
|
+
- '3.12'
|
|
22
|
+
- '3.13'
|
|
23
|
+
- '3.14'
|
|
24
|
+
- '3.15'
|
|
25
|
+
show_project_logo: false
|
|
26
|
+
test_lowest_deps: true
|
|
27
|
+
use_mkdocs: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: 15r10nk
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: General Setup
|
|
2
|
+
description: checkout & setup python
|
|
3
|
+
inputs:
|
|
4
|
+
python-version: # id of input
|
|
5
|
+
description: the python version to use
|
|
6
|
+
required: false
|
|
7
|
+
|
|
8
|
+
default: '3.13'
|
|
9
|
+
|
|
10
|
+
runs:
|
|
11
|
+
using: composite
|
|
12
|
+
steps:
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{inputs.python-version}}
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{inputs.python-version}}
|
|
22
|
+
allow-prereleases: true
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
## Description
|
|
3
|
+
<!--
|
|
4
|
+
Please provide a clear and concise description of what this pull request does.
|
|
5
|
+
Create an issue first if you want to make bigger changes.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
## Related Issue(s)
|
|
9
|
+
<!--
|
|
10
|
+
- Closes #123 (replace with relevant issue number(s), if applicable)
|
|
11
|
+
- Related to #456
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
## Checklist
|
|
15
|
+
- [ ] I have tested my changes thoroughly (you can download the test coverage with `hatch run cov:github`).
|
|
16
|
+
- [ ] I have added/updated relevant documentation.
|
|
17
|
+
- [ ] I have added tests for new functionality (if applicable).
|
|
18
|
+
- [ ] I have reviewed my own code for errors.
|
|
19
|
+
- [ ] I have added a changelog entry with `hatch run changelog:entry`
|
|
20
|
+
- I used:
|
|
21
|
+
- [ ] semantic commits (`feat:` will cause a major and `fix:` a minor version bump)
|
|
22
|
+
- [ ] or my commits can be squashed during merge
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
|
|
10
|
+
detect_release:
|
|
11
|
+
|
|
12
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
pull-requests: read
|
|
17
|
+
outputs:
|
|
18
|
+
is_release: ${{steps.release.outputs.is_release}}
|
|
19
|
+
tag: ${{steps.release.outputs.tag}}
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
23
|
+
|
|
24
|
+
- name: Detect merged release pull request
|
|
25
|
+
id: release
|
|
26
|
+
env:
|
|
27
|
+
GH_TOKEN: ${{github.token}}
|
|
28
|
+
run: |
|
|
29
|
+
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
|
30
|
+
release_branch="$(
|
|
31
|
+
gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" \
|
|
32
|
+
--jq '[.[] | select(.merged_at != null and .base.ref == "main" and (.head.ref | startswith("release/v")))][0].head.ref // ""'
|
|
33
|
+
)"
|
|
34
|
+
if test "$release_branch" = "release/v$version"; then
|
|
35
|
+
echo "is_release=true" >> "$GITHUB_OUTPUT"
|
|
36
|
+
echo "tag=v$version" >> "$GITHUB_OUTPUT"
|
|
37
|
+
else
|
|
38
|
+
echo "is_release=false" >> "$GITHUB_OUTPUT"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
test:
|
|
43
|
+
|
|
44
|
+
runs-on: ${{matrix.os}}
|
|
45
|
+
|
|
46
|
+
strategy:
|
|
47
|
+
matrix:
|
|
48
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', pypy3.11]
|
|
49
|
+
|
|
50
|
+
os: [ubuntu-latest, windows-latest, macos-15]
|
|
51
|
+
lowest_resolution: [false]
|
|
52
|
+
is_insider:
|
|
53
|
+
- ${{contains(github.repository, '-insiders/')}}
|
|
54
|
+
|
|
55
|
+
exclude:
|
|
56
|
+
- is_insider: true
|
|
57
|
+
os: windows-latest
|
|
58
|
+
- is_insider: true
|
|
59
|
+
os: macos-15
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- os: macos-15
|
|
63
|
+
python-version: '3.10'
|
|
64
|
+
- os: windows-latest
|
|
65
|
+
python-version: '3.10'
|
|
66
|
+
|
|
67
|
+
- os: macos-15
|
|
68
|
+
python-version: '3.11'
|
|
69
|
+
- os: windows-latest
|
|
70
|
+
python-version: '3.11'
|
|
71
|
+
|
|
72
|
+
- os: macos-15
|
|
73
|
+
python-version: '3.12'
|
|
74
|
+
- os: windows-latest
|
|
75
|
+
python-version: '3.12'
|
|
76
|
+
|
|
77
|
+
- os: macos-15
|
|
78
|
+
python-version: '3.13'
|
|
79
|
+
- os: windows-latest
|
|
80
|
+
python-version: '3.13'
|
|
81
|
+
|
|
82
|
+
- os: macos-15
|
|
83
|
+
python-version: '3.14'
|
|
84
|
+
- os: windows-latest
|
|
85
|
+
python-version: '3.14'
|
|
86
|
+
|
|
87
|
+
- os: macos-15
|
|
88
|
+
python-version: pypy3.11
|
|
89
|
+
- os: windows-latest
|
|
90
|
+
python-version: pypy3.11
|
|
91
|
+
|
|
92
|
+
include:
|
|
93
|
+
- os: ubuntu-latest
|
|
94
|
+
python-version: '3.9'
|
|
95
|
+
lowest_resolution: true
|
|
96
|
+
- os: ubuntu-latest
|
|
97
|
+
python-version: '3.15'
|
|
98
|
+
lowest_resolution: true
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
env:
|
|
102
|
+
TOP: ${{github.workspace}}
|
|
103
|
+
COVERAGE_PROCESS_START: ${{github.workspace}}/pyproject.toml
|
|
104
|
+
steps:
|
|
105
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
106
|
+
- uses: ./.github/actions/setup
|
|
107
|
+
with:
|
|
108
|
+
python-version: ${{matrix.python-version}}
|
|
109
|
+
|
|
110
|
+
- name: Resolve lowest direct dependencies
|
|
111
|
+
if: matrix.lowest_resolution
|
|
112
|
+
run: |
|
|
113
|
+
uv lock --upgrade --resolution lowest-direct
|
|
114
|
+
uv sync --locked --resolution lowest-direct
|
|
115
|
+
uv pip install "coverage[toml]" coverage-enable-subprocess pytest pytest-xdist
|
|
116
|
+
|
|
117
|
+
- name: Test locked dependencies
|
|
118
|
+
if: ${{ !matrix.lowest_resolution }}
|
|
119
|
+
run: uv run --locked --with "coverage[toml]" --with coverage-enable-subprocess --with pytest --with pytest-xdist -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto -vv
|
|
120
|
+
|
|
121
|
+
- name: Test lowest direct dependencies
|
|
122
|
+
if: matrix.lowest_resolution
|
|
123
|
+
run: uv run --no-sync -m coverage run -m pytest -n=auto -vv
|
|
124
|
+
|
|
125
|
+
- run: |
|
|
126
|
+
uv run ${{ matrix.lowest_resolution && '--no-sync' || '--with "coverage[toml]"' }} -m coverage combine
|
|
127
|
+
mv .coverage .coverage.${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
|
|
128
|
+
if: matrix.os == 'ubuntu-latest'
|
|
129
|
+
|
|
130
|
+
- name: Upload coverage data
|
|
131
|
+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
|
132
|
+
if: matrix.os == 'ubuntu-latest'
|
|
133
|
+
with:
|
|
134
|
+
name: coverage-data-${{github.run_id}}-${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
|
|
135
|
+
path: .coverage.*
|
|
136
|
+
include-hidden-files: true
|
|
137
|
+
if-no-files-found: ignore
|
|
138
|
+
|
|
139
|
+
mypy:
|
|
140
|
+
name: Type check (${{matrix.python-version}})
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
strategy:
|
|
143
|
+
matrix:
|
|
144
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
steps:
|
|
148
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
149
|
+
- uses: ./.github/actions/setup
|
|
150
|
+
with:
|
|
151
|
+
python-version: ${{matrix.python-version}}
|
|
152
|
+
- run: uv run --locked --with mypy mypy src tests
|
|
153
|
+
|
|
154
|
+
coverage:
|
|
155
|
+
name: Combine & check coverage
|
|
156
|
+
env:
|
|
157
|
+
TOP: ${{github.workspace}}
|
|
158
|
+
if: always()
|
|
159
|
+
needs: test
|
|
160
|
+
runs-on: ubuntu-latest
|
|
161
|
+
|
|
162
|
+
steps:
|
|
163
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
164
|
+
- uses: ./.github/actions/setup
|
|
165
|
+
|
|
166
|
+
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
|
|
167
|
+
with:
|
|
168
|
+
pattern: coverage-data-${{github.run_id}}-*
|
|
169
|
+
merge-multiple: true
|
|
170
|
+
|
|
171
|
+
- name: Combine coverage & fail if it's <100%
|
|
172
|
+
run: |
|
|
173
|
+
uv run --with "coverage[toml]" coverage combine
|
|
174
|
+
uv run --with "coverage[toml]" coverage html --skip-covered --skip-empty
|
|
175
|
+
|
|
176
|
+
# Report and write to summary.
|
|
177
|
+
uv run --with "coverage[toml]" coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
|
|
178
|
+
|
|
179
|
+
# Report again and fail if under 100%.
|
|
180
|
+
uv run --with "coverage[toml]" coverage report --fail-under=100
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
- name: Upload HTML report if check failed
|
|
184
|
+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
|
185
|
+
with:
|
|
186
|
+
name: html-report
|
|
187
|
+
path: htmlcov
|
|
188
|
+
if: ${{ failure() }}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
publish:
|
|
192
|
+
name: Publish new release
|
|
193
|
+
needs: [detect_release, test, mypy, coverage]
|
|
194
|
+
if: needs.detect_release.outputs.is_release == 'true' && !contains(github.repository, '-insiders/')
|
|
195
|
+
runs-on: ubuntu-latest
|
|
196
|
+
environment: pypi
|
|
197
|
+
permissions:
|
|
198
|
+
contents: write
|
|
199
|
+
id-token: write
|
|
200
|
+
|
|
201
|
+
steps:
|
|
202
|
+
- name: Checkout tested commit
|
|
203
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
204
|
+
with:
|
|
205
|
+
fetch-depth: 0
|
|
206
|
+
token: ${{secrets.PAT_WEEKLY_UPDATE}}
|
|
207
|
+
|
|
208
|
+
- uses: ./.github/actions/setup
|
|
209
|
+
with:
|
|
210
|
+
python-version: '3.12'
|
|
211
|
+
|
|
212
|
+
- name: Build distributions
|
|
213
|
+
run: uvx hatch build
|
|
214
|
+
|
|
215
|
+
- name: Tag tested commit
|
|
216
|
+
env:
|
|
217
|
+
TAG: ${{needs.detect_release.outputs.tag}}
|
|
218
|
+
run: |
|
|
219
|
+
git config user.name github-actions[bot]
|
|
220
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
221
|
+
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
222
|
+
test "$(git rev-list -n 1 "$TAG")" = "$GITHUB_SHA"
|
|
223
|
+
else
|
|
224
|
+
git tag --annotate "$TAG" --message "Release $TAG"
|
|
225
|
+
git push origin "$TAG"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
- name: Publish package distributions to PyPI
|
|
229
|
+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
|
230
|
+
with:
|
|
231
|
+
skip-existing: true
|
|
232
|
+
|
|
233
|
+
- name: Create GitHub release
|
|
234
|
+
env:
|
|
235
|
+
GITHUB_TOKEN: ${{github.token}}
|
|
236
|
+
run: uv run --locked scriv github-release --repo "$GITHUB_REPOSITORY"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Create release pull request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: release-pull-request
|
|
8
|
+
cancel-in-progress: false
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release-pr:
|
|
12
|
+
if: "!contains(github.repository, '-insiders/')"
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
pull-requests: write
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout main
|
|
20
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: Set up uv
|
|
25
|
+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.13'
|
|
28
|
+
|
|
29
|
+
- name: Prepare release
|
|
30
|
+
id: release
|
|
31
|
+
run: |
|
|
32
|
+
version="$(uv run --locked cz bump --get-next --yes)"
|
|
33
|
+
uv run --locked scriv collect --version "$version" --no-edit
|
|
34
|
+
uv run --locked cz bump "$version" --yes --version-files-only
|
|
35
|
+
uv lock
|
|
36
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
37
|
+
|
|
38
|
+
- name: Run pre-commit
|
|
39
|
+
run: uvx pre-commit run --all-files || uvx pre-commit run --all-files
|
|
40
|
+
|
|
41
|
+
- name: Create pull request
|
|
42
|
+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
43
|
+
with:
|
|
44
|
+
token: ${{secrets.PAT_WEEKLY_UPDATE}}
|
|
45
|
+
branch: release/v${{steps.release.outputs.version}}
|
|
46
|
+
commit-message: 'chore: release v${{steps.release.outputs.version}}'
|
|
47
|
+
title: 'chore: release v${{steps.release.outputs.version}}'
|
|
48
|
+
body: |
|
|
49
|
+
Prepare release v${{steps.release.outputs.version}}.
|
|
50
|
+
|
|
51
|
+
This pull request was generated from the changelog fragments and
|
|
52
|
+
Conventional Commits on `main`.
|
|
53
|
+
delete-branch: true
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Weekly Cog Update
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: 0 8 * * 5 # Every Friday at 08:00 UTC
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
weekly-update:
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
23
|
+
with:
|
|
24
|
+
python-version: '3.12'
|
|
25
|
+
|
|
26
|
+
- name: Set up uv
|
|
27
|
+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
28
|
+
|
|
29
|
+
- name: Run cog update
|
|
30
|
+
run: |
|
|
31
|
+
git ls-files -z -- '*.py' '*.md' | xargs -0 -r uv run --group cog cog -r
|
|
32
|
+
uvx gha-update
|
|
33
|
+
uvx pre-commit run --all-files || uvx pre-commit run --all-files
|
|
34
|
+
|
|
35
|
+
- name: Create Pull Request
|
|
36
|
+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
37
|
+
with:
|
|
38
|
+
token: ${{github.token}}
|
|
39
|
+
branch-token: ${{secrets.PAT_WEEKLY_UPDATE}}
|
|
40
|
+
commit-message: 'chore: weekly cog update'
|
|
41
|
+
title: 'chore: weekly update'
|
|
42
|
+
body: Automated weekly update via scheduled workflow.
|
|
43
|
+
branch: chore/weekly-update
|
|
44
|
+
delete-branch: true
|
|
45
|
+
reviewers: 15r10nk
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autofix_pr: false
|
|
3
|
+
autoupdate_commit_msg: 'style: pre-commit autoupdate'
|
|
4
|
+
autofix_commit_msg: 'style: pre-commit fixed styling'
|
|
5
|
+
autoupdate_schedule: monthly
|
|
6
|
+
|
|
7
|
+
repos:
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/15r10nk/project-template
|
|
10
|
+
rev: v0.4.3
|
|
11
|
+
hooks:
|
|
12
|
+
- id: copier-enforce
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- hooks:
|
|
16
|
+
- id: check-ast
|
|
17
|
+
- id: check-merge-conflict
|
|
18
|
+
- id: trailing-whitespace
|
|
19
|
+
- id: mixed-line-ending
|
|
20
|
+
- id: fix-byte-order-marker
|
|
21
|
+
- id: check-case-conflict
|
|
22
|
+
- id: check-json
|
|
23
|
+
- id: end-of-file-fixer
|
|
24
|
+
repo: https://github.com/pre-commit/pre-commit-hooks
|
|
25
|
+
rev: v5.0.0
|
|
26
|
+
- hooks:
|
|
27
|
+
- args:
|
|
28
|
+
- --in-place
|
|
29
|
+
- --expand-star-imports
|
|
30
|
+
- --remove-all-unused-imports
|
|
31
|
+
- --ignore-init-module-imports
|
|
32
|
+
id: autoflake
|
|
33
|
+
repo: https://github.com/myint/autoflake
|
|
34
|
+
rev: v2.3.1
|
|
35
|
+
|
|
36
|
+
- repo: https://github.com/asottile/setup-cfg-fmt
|
|
37
|
+
rev: v2.8.0
|
|
38
|
+
hooks:
|
|
39
|
+
- id: setup-cfg-fmt
|
|
40
|
+
|
|
41
|
+
- repo: https://github.com/pycqa/isort
|
|
42
|
+
rev: 6.0.1
|
|
43
|
+
hooks:
|
|
44
|
+
- id: isort
|
|
45
|
+
name: isort (python)
|
|
46
|
+
args: [--profile, black]
|
|
47
|
+
|
|
48
|
+
- hooks:
|
|
49
|
+
- args:
|
|
50
|
+
- --py38-plus
|
|
51
|
+
id: pyupgrade
|
|
52
|
+
repo: https://github.com/asottile/pyupgrade
|
|
53
|
+
rev: v3.21.2
|
|
54
|
+
- hooks:
|
|
55
|
+
- id: black
|
|
56
|
+
repo: https://github.com/psf/black
|
|
57
|
+
rev: 25.1.0
|
|
58
|
+
- hooks:
|
|
59
|
+
- id: blacken-docs
|
|
60
|
+
args: [-l80]
|
|
61
|
+
repo: https://github.com/adamchainz/blacken-docs
|
|
62
|
+
rev: 1.19.1
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
|
66
|
+
rev: v2.15.0
|
|
67
|
+
hooks:
|
|
68
|
+
- id: pretty-format-yaml
|
|
69
|
+
args: [--autofix, --indent, '2']
|
|
70
|
+
|
|
71
|
+
- hooks:
|
|
72
|
+
- id: commitizen
|
|
73
|
+
stages:
|
|
74
|
+
- commit-msg
|
|
75
|
+
repo: https://github.com/commitizen-tools/commitizen
|
|
76
|
+
rev: v4.8.3
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# - repo: https://github.com/PyCQA/docformatter
|
|
80
|
+
# rev: v1.7.5
|
|
81
|
+
# hooks:
|
|
82
|
+
# - id: docformatter
|
|
83
|
+
|
|
84
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
85
|
+
rev: v0.24.1
|
|
86
|
+
hooks:
|
|
87
|
+
- id: validate-pyproject
|
|
88
|
+
|
|
89
|
+
- repo: https://github.com/henryiii/validate-pyproject-schema-store
|
|
90
|
+
rev: 2025.04.28
|
|
91
|
+
hooks:
|
|
92
|
+
- id: validate-pyproject
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
- repo: https://github.com/rhysd/actionlint
|
|
96
|
+
rev: v1.7.7
|
|
97
|
+
hooks:
|
|
98
|
+
- id: actionlint
|
|
99
|
+
|
|
100
|
+
- repo: https://github.com/crate-ci/typos
|
|
101
|
+
rev: v1.47.0
|
|
102
|
+
hooks:
|
|
103
|
+
- id: typos
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
Contributions are welcome.
|
|
3
|
+
Please create an issue before writing a pull request so we can discuss what needs to be changed.
|
|
4
|
+
|
|
5
|
+
# Testing
|
|
6
|
+
The code can be tested with [hatch](https://hatch.pypa.io/latest/)
|
|
7
|
+
|
|
8
|
+
* `hatch run cov:test` can be used to test all supported python versions and to check for coverage.
|
|
9
|
+
* `hatch run +py=3.10 all:test -- --sw` runs pytest for python 3.10 with the `--sw` argument.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Coverage
|
|
13
|
+
This project has a hard coverage requirement of 100%.
|
|
14
|
+
The goal here is to find different edge cases which might have bugs.
|
|
15
|
+
|
|
16
|
+
However, it is possible to exclude some code from the coverage.
|
|
17
|
+
|
|
18
|
+
Code can be marked with `pragma: no cover`, if it can not be tested for some reason.
|
|
19
|
+
This makes it easy to spot uncovered code in the source.
|
|
20
|
+
|
|
21
|
+
Impossible conditions can be handled with `assert False`.
|
|
22
|
+
``` python
|
|
23
|
+
if some_condition:
|
|
24
|
+
...
|
|
25
|
+
if some_other_condition:
|
|
26
|
+
...
|
|
27
|
+
else:
|
|
28
|
+
assert False, "unreachable because ..."
|
|
29
|
+
```
|
|
30
|
+
This serves also as an additional check during runtime.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Commits
|
|
34
|
+
Please use [pre-commit](https://pre-commit.com/) for your commits.
|
|
35
|
+
|
|
36
|
+
# Changelog
|
|
37
|
+
Add a changelog fragment for user-visible changes with
|
|
38
|
+
`uv run scriv create --add --edit`. The fragments are collected automatically
|
|
39
|
+
when the release pull request is created.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Frank Hoffmann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: inline-snapshot-numpy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NumPy integration for inline-snapshot
|
|
5
|
+
Project-URL: Documentation, https://github.com/15r10nk/inline-snapshot-numpy#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/15r10nk/inline-snapshot-numpy/issues
|
|
7
|
+
Project-URL: Source, https://github.com/15r10nk/inline-snapshot-numpy
|
|
8
|
+
Author-email: Frank Hoffmann <15r10nk@polarbit.de>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: inline-snapshot>=0.36.1
|
|
24
|
+
Requires-Dist: numpy>=1.20; python_version < '3.15'
|
|
25
|
+
Requires-Dist: numpy>=2.5.4; python_version >= '3.15'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# inline-snapshot-numpy
|
|
29
|
+
|
|
30
|
+
[NumPy](https://numpy.org/) integration for
|
|
31
|
+
[inline-snapshot](https://github.com/15r10nk/inline-snapshot).
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install inline-snapshot-numpy
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
The package provides snapshot-aware versions of NumPy's array assertions:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from inline_snapshot_numpy import assert_array_equal
|
|
45
|
+
from numpy import array
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_array():
|
|
49
|
+
actual = array([[1, 2], [3, 4]])
|
|
50
|
+
assert_array_equal(actual)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Create the missing snapshot with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pytest --inline-snapshot=create
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The test will become:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
def test_array():
|
|
63
|
+
actual = array([[1, 2], [3, 4]])
|
|
64
|
+
assert_array_equal(actual, desired=array([[1, 2], [3, 4]]))
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The following helpers are available: `assert_array_equal`, `assert_allclose`,
|
|
68
|
+
`assert_array_almost_equal`, `assert_array_almost_equal_nulp`,
|
|
69
|
+
and `assert_array_max_ulp`.
|
|
70
|
+
|
|
71
|
+
The expected array is managed through `snapshot_arg()`, so no explicit
|
|
72
|
+
`snapshot()` call or import is needed. You can still pass an explicit
|
|
73
|
+
`snapshot(...)` for compatibility.
|
|
74
|
+
|
|
75
|
+
Alternatively, call `setup()` from `conftest.py` to patch the corresponding
|
|
76
|
+
functions in `numpy.testing`:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from inline_snapshot_numpy import setup
|
|
80
|
+
|
|
81
|
+
setup()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Distributed under the terms of the MIT license.
|