timeout-iterator 0.2.1__tar.gz → 0.3.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.
Files changed (45) hide show
  1. timeout_iterator-0.3.0/.coveragerc +2 -0
  2. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/.github/workflows/gitignore-in.yml +1 -6
  3. timeout_iterator-0.3.0/.github/workflows/happy.yml +15 -0
  4. timeout_iterator-0.3.0/.github/workflows/octocov.yml +55 -0
  5. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/.github/workflows/pypi-publish.yml +18 -10
  6. timeout_iterator-0.3.0/.github/workflows/python-test.yml +78 -0
  7. timeout_iterator-0.3.0/.github/workflows/spellcheck.yml +13 -0
  8. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/.gitignore +121 -27
  9. timeout_iterator-0.3.0/.octocov.yml +22 -0
  10. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/PKG-INFO +68 -7
  11. timeout_iterator-0.3.0/README.md +110 -0
  12. timeout_iterator-0.3.0/lefthook.yml +13 -0
  13. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/pyproject.toml +51 -6
  14. timeout_iterator-0.3.0/tests/test_terminate.py +181 -0
  15. timeout_iterator-0.3.0/tests/test_without_terminate.py +66 -0
  16. timeout_iterator-0.3.0/timeout_iterator/__init__.py +7 -0
  17. timeout_iterator-0.3.0/timeout_iterator/_seconds.py +9 -0
  18. timeout_iterator-0.3.0/timeout_iterator/_version.py +24 -0
  19. timeout_iterator-0.3.0/timeout_iterator/py.typed +0 -0
  20. timeout_iterator-0.3.0/timeout_iterator/terminate.py +93 -0
  21. timeout_iterator-0.3.0/timeout_iterator/without_terminate.py +53 -0
  22. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/timeout_iterator.egg-info/PKG-INFO +68 -7
  23. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/timeout_iterator.egg-info/SOURCES.txt +8 -1
  24. timeout_iterator-0.3.0/timeout_iterator.egg-info/scm_file_list.json +28 -0
  25. timeout_iterator-0.3.0/timeout_iterator.egg-info/scm_version.json +8 -0
  26. timeout_iterator-0.3.0/uv.lock +587 -0
  27. timeout_iterator-0.2.1/.github/dependabot.yml +0 -11
  28. timeout_iterator-0.2.1/.github/workflows/happy.yml +0 -18
  29. timeout_iterator-0.2.1/.github/workflows/python-test.yml +0 -61
  30. timeout_iterator-0.2.1/.github/workflows/spellcheck.yml +0 -16
  31. timeout_iterator-0.2.1/README.md +0 -52
  32. timeout_iterator-0.2.1/tests/test_terminate.py +0 -49
  33. timeout_iterator-0.2.1/tests/test_without_terminate.py +0 -23
  34. timeout_iterator-0.2.1/timeout_iterator/__init__.py +0 -5
  35. timeout_iterator-0.2.1/timeout_iterator/_version.py +0 -16
  36. timeout_iterator-0.2.1/timeout_iterator/terminate.py +0 -33
  37. timeout_iterator-0.2.1/timeout_iterator/without_terminate.py +0 -22
  38. timeout_iterator-0.2.1/uv.lock +0 -403
  39. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/.github/renovate.json5 +0 -0
  40. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/.gitignore.in +0 -0
  41. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/LICENSE +0 -0
  42. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/setup.cfg +0 -0
  43. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/tests/__init__.py +0 -0
  44. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/timeout_iterator.egg-info/dependency_links.txt +0 -0
  45. {timeout_iterator-0.2.1 → timeout_iterator-0.3.0}/timeout_iterator.egg-info/top_level.txt +0 -0
@@ -0,0 +1,2 @@
1
+ [run]
2
+ branch = True
@@ -1,16 +1,11 @@
1
1
  name: Update gitignore file
2
-
3
2
  on:
4
3
  schedule:
5
4
  # daily at 00:00
6
5
  - cron: '0 0 * * *'
7
-
8
6
  permissions:
9
7
  contents: write
10
8
  pull-requests: write
11
-
12
9
  jobs:
13
10
  update-gitignore:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: gitignore-in/gh-action@v0.2.2
11
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/gitignore-in.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc # main
@@ -0,0 +1,15 @@
1
+ name: happy-commit
2
+ on:
3
+ - pull_request
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ permissions:
10
+ contents: read
11
+ pull-requests: write
12
+ issues: write
13
+ jobs:
14
+ happy:
15
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/happy-commit.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc
@@ -0,0 +1,55 @@
1
+ name: octocov
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ contents: read
14
+ pull-requests: write
15
+ checks: write
16
+
17
+ jobs:
18
+ octocov:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ python: ["3.14"]
24
+
25
+ steps:
26
+ - name: Checkout
27
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
28
+
29
+ - name: Set up Python
30
+ id: setup-python
31
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
32
+ with:
33
+ python-version: "${{ matrix.python }}"
34
+
35
+ - name: Set up uv
36
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
37
+ with:
38
+ enable-cache: true
39
+ cache-dependency-glob: uv.lock
40
+
41
+ - name: Install dependencies
42
+ run: uv sync
43
+
44
+ - name: Test
45
+ run: uv run poe test
46
+
47
+ - name: Coverage
48
+ run: uv run poe coverage-xml
49
+
50
+ # See also: https://github.com/k1LoW/octocov-action
51
+ - name: Report coverage with octocov
52
+ uses: k1LoW/octocov-action@b3b6ee60482a667950f87553abf1df63217235d9 # v1
53
+ with:
54
+ github-token: ${{ secrets.GITHUB_TOKEN }}
55
+ config: .octocov.yml
@@ -7,23 +7,36 @@ on:
7
7
  # "released" events are emitted either when directly be released or be edited from pre-released.
8
8
  types: [prereleased, released]
9
9
 
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13
+
10
14
  env:
11
15
  python_version: 3.13
12
16
 
17
+ permissions:
18
+ contents: read
19
+
13
20
  jobs:
14
21
  deploy:
15
22
  runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: read
25
+ id-token: write
16
26
  steps:
17
- - uses: actions/checkout@v4
27
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
18
28
 
19
29
  - name: Set up Python
20
30
  id: setup-python
21
- uses: actions/setup-python@v5
31
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
22
32
  with:
23
33
  python-version: ${{ env.python_version }}
24
34
 
25
35
  - name: Set up uv
26
- uses: astral-sh/setup-uv@v5
36
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
37
+ with:
38
+ enable-cache: true
39
+ cache-dependency-glob: uv.lock
27
40
 
28
41
  - name: Install dependencies
29
42
  run: |
@@ -34,16 +47,11 @@ jobs:
34
47
  run: uv build
35
48
 
36
49
  - name: Publish distribution to Test PyPI
37
- uses: pypa/gh-action-pypi-publish@release/v1
50
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
38
51
  if: github.event_name == 'release' && github.event.release.prerelease
39
52
  with:
40
- user: __token__
41
- password: ${{ secrets.TEST_PYPI_API_TOKEN }}
42
53
  repository-url: https://test.pypi.org/legacy/
43
54
 
44
55
  - name: Publish distribution to PyPI
45
56
  if: github.event_name == 'release' && !github.event.release.prerelease
46
- uses: pypa/gh-action-pypi-publish@release/v1
47
- with:
48
- user: __token__
49
- password: ${{ secrets.PYPI_API_TOKEN }}
57
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
@@ -0,0 +1,78 @@
1
+ name: Test
2
+ on:
3
+ # pull-request events are not triggered when a PR is merged
4
+ # push events are not triggered when a PR created from a fork repository
5
+ # So we need both to run tests on every PR and after merging
6
+ pull_request:
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ actionlint:
20
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/actionlint.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc # main
21
+ test:
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
27
+
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
31
+
32
+ - name: Set up Python
33
+ id: setup-python
34
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
35
+ with:
36
+ python-version: "${{ matrix.python }}"
37
+
38
+ - name: Set up uv
39
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
40
+ with:
41
+ enable-cache: true
42
+ cache-dependency-glob: uv.lock
43
+
44
+ - name: Install dependencies
45
+ run: uv sync
46
+
47
+ - name: Lint
48
+ run: uv run poe check
49
+
50
+ - name: Check Python version
51
+ run: |
52
+ actual_version=$(uv run python --version)
53
+ expected_version="Python ${{ matrix.python }}"
54
+ if [[ "$actual_version" != *"$expected_version"* ]]; then
55
+ echo "Expected $expected_version, but got $actual_version"
56
+ exit 1
57
+ fi
58
+
59
+ - name: Test
60
+ run: uv run poe test
61
+
62
+ - name: Coverage
63
+ run: uv run poe coverage-xml
64
+
65
+ pip-audit:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - name: Checkout
69
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
70
+
71
+ - name: Set up uv
72
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
73
+ with:
74
+ enable-cache: true
75
+ cache-dependency-glob: uv.lock
76
+
77
+ - name: Audit dependencies
78
+ run: uv --preview audit --frozen
@@ -0,0 +1,13 @@
1
+ name: Spellcheck
2
+ on:
3
+ - pull_request
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ permissions:
10
+ contents: read
11
+ jobs:
12
+ check:
13
+ uses: kitsuyui/gh-actions-workflows/.github/workflows/spellcheck.yml@3717c78af3a5e594b7a81b063276e15fac7e08fc # main
@@ -5,14 +5,14 @@
5
5
  # -----------------------------------------------------------------------------
6
6
  # gibo dump Linux
7
7
  ### Generated by gibo (https://github.com/simonwhitaker/gibo)
8
- ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Linux.gitignore
8
+ ### https://raw.github.com/github/gitignore/576334520435382d6522f349b9d270eda1e79a25/Global/Linux.gitignore
9
9
 
10
10
  *~
11
11
 
12
12
  # temporary files which can be created if a process still has a handle open of a deleted file
13
13
  .fuse_hidden*
14
14
 
15
- # KDE directory preferences
15
+ # Metadata left by Dolphin file manager, which comes with KDE Plasma
16
16
  .directory
17
17
 
18
18
  # Linux trash folder which might appear on any partition or disk
@@ -20,10 +20,13 @@
20
20
 
21
21
  # .nfs files are created when an open file is removed but is still being accessed
22
22
  .nfs*
23
+
24
+ # Log files created by default by the nohup command
25
+ nohup.out
23
26
  # -----------------------------------------------------------------------------
24
27
  # gibo dump Windows
25
28
  ### Generated by gibo (https://github.com/simonwhitaker/gibo)
26
- ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Windows.gitignore
29
+ ### https://raw.github.com/github/gitignore/576334520435382d6522f349b9d270eda1e79a25/Global/Windows.gitignore
27
30
 
28
31
  # Windows thumbnail cache files
29
32
  Thumbs.db
@@ -52,20 +55,20 @@ $RECYCLE.BIN/
52
55
  # -----------------------------------------------------------------------------
53
56
  # gibo dump macOS
54
57
  ### Generated by gibo (https://github.com/simonwhitaker/gibo)
55
- ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/macOS.gitignore
58
+ ### https://raw.github.com/github/gitignore/576334520435382d6522f349b9d270eda1e79a25/Global/macOS.gitignore
56
59
 
57
60
  # General
58
61
  .DS_Store
62
+ .localized
63
+ __MACOSX/
59
64
  .AppleDouble
60
65
  .LSOverride
66
+ Icon[
61
67
 
62
- # Icon must end with two \r
63
- Icon
64
-
65
- # Thumbnails
68
+ # Resource forks
66
69
  ._*
67
70
 
68
- # Files that might appear in the root of a volume
71
+ # Files and directories that might appear in the root of a volume
69
72
  .DocumentRevisions-V100
70
73
  .fseventsd
71
74
  .Spotlight-V100
@@ -73,6 +76,15 @@ Icon
73
76
  .Trashes
74
77
  .VolumeIcon.icns
75
78
  .com.apple.timemachine.donotpresent
79
+ .com.apple.timemachine.supported
80
+ .PKInstallSandboxManager
81
+ .PKInstallSandboxManager-SystemSoftware
82
+ .hotfiles.btree
83
+ .vol
84
+ .file
85
+ .disk_label*
86
+ lost+found
87
+ .HFS+ Private Directory Data[
76
88
 
77
89
  # Directories potentially created on remote AFP share
78
90
  .AppleDB
@@ -80,14 +92,36 @@ Icon
80
92
  Network Trash Folder
81
93
  Temporary Items
82
94
  .apdisk
95
+
96
+ # Mac OS 6 to 9
97
+ Desktop DB
98
+ Desktop DF
99
+ TheFindByContentFolder
100
+ TheVolumeSettingsFolder
101
+ .FBCIndex
102
+ .FBCSemaphoreFile
103
+ .FBCLockFolder
104
+
105
+ # Quota system
106
+ .quota.group
107
+ .quota.user
108
+ .quota.ops.group
109
+ .quota.ops.user
110
+
111
+ # TimeMachine
112
+ Backups.backupdb
113
+ .MobileBackups
114
+ .MobileBackups.trash
115
+ MobileBackups.trash
116
+ tmbootpicker.efi
83
117
  # -----------------------------------------------------------------------------
84
118
  # gibo dump Python
85
119
  ### Generated by gibo (https://github.com/simonwhitaker/gibo)
86
- ### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Python.gitignore
120
+ ### https://raw.github.com/github/gitignore/576334520435382d6522f349b9d270eda1e79a25/Python.gitignore
87
121
 
88
122
  # Byte-compiled / optimized / DLL files
89
123
  __pycache__/
90
- *.py[cod]
124
+ *.py[codz]
91
125
  *$py.class
92
126
 
93
127
  # C extensions
@@ -114,8 +148,8 @@ share/python-wheels/
114
148
  MANIFEST
115
149
 
116
150
  # PyInstaller
117
- # Usually these files are written by a python script from a template
118
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
151
+ # Usually these files are written by a python script from a template
152
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
119
153
  *.manifest
120
154
  *.spec
121
155
 
@@ -133,7 +167,8 @@ htmlcov/
133
167
  nosetests.xml
134
168
  coverage.xml
135
169
  *.cover
136
- *.py,cover
170
+ *.py.cover
171
+ *.lcov
137
172
  .hypothesis/
138
173
  .pytest_cache/
139
174
  cover/
@@ -179,35 +214,65 @@ ipython_config.py
179
214
  # However, in case of collaboration, if having platform-specific dependencies or dependencies
180
215
  # having no cross-platform support, pipenv may install dependencies that don't work, or not
181
216
  # install all needed dependencies.
182
- #Pipfile.lock
217
+ # Pipfile.lock
218
+
219
+ # UV
220
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
221
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
222
+ # commonly ignored for libraries.
223
+ # uv.lock
183
224
 
184
225
  # poetry
185
226
  # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
186
227
  # This is especially recommended for binary packages to ensure reproducibility, and is more
187
228
  # commonly ignored for libraries.
188
229
  # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
189
- #poetry.lock
230
+ # poetry.lock
231
+ # poetry.toml
190
232
 
191
233
  # pdm
192
234
  # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
193
- #pdm.lock
194
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
195
- # in version control.
196
- # https://pdm.fming.dev/#use-with-ide
197
- .pdm.toml
235
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
236
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
237
+ # pdm.lock
238
+ # pdm.toml
239
+ .pdm-python
240
+ .pdm-build/
241
+
242
+ # pixi
243
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
244
+ # pixi.lock
245
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
246
+ # in the .venv directory. It is recommended not to include this directory in version control.
247
+ .pixi/*
248
+ !.pixi/config.toml
198
249
 
199
250
  # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
200
251
  __pypackages__/
201
252
 
202
253
  # Celery stuff
203
- celerybeat-schedule
254
+ celerybeat-schedule*
204
255
  celerybeat.pid
205
256
 
257
+ # Redis
258
+ *.rdb
259
+ *.aof
260
+ *.pid
261
+
262
+ # RabbitMQ
263
+ mnesia/
264
+ rabbitmq/
265
+ rabbitmq-data/
266
+
267
+ # ActiveMQ
268
+ activemq-data/
269
+
206
270
  # SageMath parsed files
207
271
  *.sage.py
208
272
 
209
273
  # Environments
210
274
  .env
275
+ .envrc
211
276
  .venv
212
277
  env/
213
278
  venv/
@@ -240,10 +305,39 @@ dmypy.json
240
305
  cython_debug/
241
306
 
242
307
  # PyCharm
243
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
244
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
245
- # and can be added to the global gitignore or merged into this file. For a more nuclear
246
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
247
- #.idea/
308
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
309
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
310
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
311
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
312
+ # .idea/
313
+
314
+ # Abstra
315
+ # Abstra is an AI-powered process automation framework.
316
+ # Ignore directories containing user credentials, local state, and settings.
317
+ # Learn more at https://abstra.io/docs
318
+ .abstra/
319
+
320
+ # Visual Studio Code
321
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
322
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
323
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
324
+ # you could uncomment the following to ignore the entire vscode folder
325
+ # .vscode/
326
+ # Temporary file for partial code execution
327
+ tempCodeRunnerFile.py
328
+
329
+ # Ruff stuff:
330
+ .ruff_cache/
331
+
332
+ # PyPI configuration file
333
+ .pypirc
334
+
335
+ # Marimo
336
+ marimo/_static/
337
+ marimo/_lsp/
338
+ __marimo__/
339
+
340
+ # Streamlit
341
+ .streamlit/secrets.toml
248
342
  # -----------------------------------------------------------------------------
249
343
  timeout_iterator/_version.py
@@ -0,0 +1,22 @@
1
+ # https://github.com/k1LoW/octocov?tab=readme-ov-file#configuration
2
+ coverage:
3
+ acceptable: current >= 100%
4
+ paths:
5
+ - coverage.xml
6
+ codeToTestRatio:
7
+ code:
8
+ - "**/*.py"
9
+ test:
10
+ - "tests/**/*.py"
11
+ testExecutionTime:
12
+ if: true
13
+ diff:
14
+ datastores:
15
+ - artifact://${GITHUB_REPOSITORY}
16
+ comment:
17
+ if: is_pull_request
18
+ updatePrevious: true
19
+ report:
20
+ if: is_default_branch
21
+ datastores:
22
+ - artifact://${GITHUB_REPOSITORY}
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: timeout-iterator
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: Iterator with timeout
5
5
  Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
6
6
  License: Copyright 2024-2025 Kitsu Yui
@@ -17,16 +17,19 @@ License: Copyright 2024-2025 Kitsu Yui
17
17
  Project-URL: Homepage, https://github.com/kitsuyui/python-timeout-iterator
18
18
  Classifier: Development Status :: 3 - Alpha
19
19
  Classifier: License :: OSI Approved :: BSD License
20
- Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
24
23
  Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
25
  Classifier: Intended Audience :: Developers
26
26
  Classifier: Topic :: Software Development :: Libraries
27
- Requires-Python: >=3.9
27
+ Classifier: Operating System :: POSIX
28
+ Classifier: Operating System :: MacOS
29
+ Requires-Python: >=3.10
28
30
  Description-Content-Type: text/markdown
29
31
  License-File: LICENSE
32
+ Dynamic: license-file
30
33
 
31
34
  # python-timeout-iterator
32
35
 
@@ -34,7 +37,7 @@ License-File: LICENSE
34
37
 
35
38
  [![Python](https://img.shields.io/pypi/pyversions/timeout-iterator.svg)](https://badge.fury.io/py/timeout-iterator)
36
39
  [![PyPI version](https://img.shields.io/pypi/v/timeout-iterator.svg)](https://pypi.python.org/pypi/timeout-iterator/)
37
- [![codecov](https://codecov.io/gh/kitsuyui/python-timeout-iterator/graph/badge.svg?token=D608CG7CUH)](https://codecov.io/gh/kitsuyui/python-timeout-iterator)
40
+ ![Coverage](https://raw.githubusercontent.com/kitsuyui/octocov-central/main/badges/kitsuyui/python-timeout-iterator/coverage.svg)
38
41
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
39
42
 
40
43
  ## Installation
@@ -47,10 +50,13 @@ $ pip install timeout-iterator
47
50
 
48
51
  ### without_terminate
49
52
 
50
- `without_terminate` is a generator that it will not yield after the timeout,
51
- but it will not raise an exception.
53
+ `without_terminate` stops yielding items once the timeout elapses without
54
+ raising an exception. It is safe to use on all platforms because it does not
55
+ use signals.
52
56
 
53
57
  ```python
58
+ import time
59
+
54
60
  from timeout_iterator import without_terminate
55
61
  results = []
56
62
  for i in without_terminate(range(10), seconds=0.3):
@@ -60,11 +66,28 @@ for i in without_terminate(range(10), seconds=0.3):
60
66
  assert results == [0, 1, 2]
61
67
  ```
62
68
 
69
+ **Boundary behavior**: The timeout is checked *after* each item is fetched
70
+ from the upstream iterator. If the deadline passes between a fetch and its
71
+ yield, the fetched item is silently dropped. At most one item near the
72
+ boundary may be consumed from the upstream but not passed to the caller.
73
+ This differs from `terminate`, which delivers every item fetched before the
74
+ SIGALRM fires.
75
+
63
76
  ### terminate
64
77
 
65
78
  `terminate` is a generator that it will raise an exception after the timeout.
79
+ This function uses `signal.SIGALRM` and `signal.setitimer()`, so it is only
80
+ supported on Unix-like platforms that provide those signal APIs.
81
+
82
+ **Signal interaction**: `terminate` installs a `SIGALRM` handler for its
83
+ duration. Any `SIGALRM` that arrives before the timeout elapses is silently
84
+ discarded — the previous handler is not called for those signals. Libraries or
85
+ code that also use `signal.alarm()` / `signal.setitimer()` will have their
86
+ signals suppressed until the iterator exits.
66
87
 
67
88
  ```python
89
+ import time
90
+
68
91
  from timeout_iterator import terminate
69
92
  try:
70
93
  results = []
@@ -77,6 +100,44 @@ except TimeoutError:
77
100
  assert results == [0, 1, 2]
78
101
  ```
79
102
 
103
+ **Main-thread only**: `signal.signal()` and `signal.setitimer()` are
104
+ main-thread APIs in CPython. Calling `terminate()` from a worker thread
105
+ (e.g. inside `threading.Thread` or `concurrent.futures.ThreadPoolExecutor`)
106
+ raises `ValueError` immediately. Use `without_terminate()` for thread-safe
107
+ timeout iteration.
108
+
109
+ **Signal scope**: `SIGALRM` is delivered at any Python bytecode boundary in
110
+ the calling thread — not only during fetches from the upstream iterator. The
111
+ loop body itself can be interrupted and raise `TimeoutError`. Keep loop body
112
+ code safe to interrupt at any point, or use `without_terminate` if you need the
113
+ upstream items to be fully consumed before yielding control.
114
+ ## Development
115
+
116
+ This repository uses [lefthook](https://lefthook.dev/) to run the same checks as CI
117
+ locally, so problems surface before they reach CI.
118
+
119
+ ```sh
120
+ # Install dependencies
121
+ uv sync
122
+
123
+ # Install the Git hooks (once; requires lefthook on your PATH)
124
+ lefthook install
125
+ ```
126
+
127
+ Once installed, the hooks run automatically:
128
+
129
+ - **pre-commit**: `uv run poe check`
130
+ - **pre-push**: `uv run poe check` and `uv run poe test`
131
+
132
+ You can also run the checks manually:
133
+
134
+ ```sh
135
+ uv run poe check
136
+ uv run poe test
137
+ ```
138
+
139
+ CI still runs the full matrix (see `.github/workflows/`); the hooks only bring that
140
+ feedback earlier on your machine.
80
141
  # LICENSE
81
142
 
82
143
  BSD 3-Clause License