pixel-sizes 0.2.2__tar.gz → 0.4.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 (40) hide show
  1. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.coveragerc +3 -0
  2. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.github/workflows/gitignore-in.yml +1 -6
  3. pixel_sizes-0.4.0/.github/workflows/happy.yml +15 -0
  4. pixel_sizes-0.4.0/.github/workflows/octocov.yml +56 -0
  5. pixel_sizes-0.4.0/.github/workflows/pypi-publish.yml +65 -0
  6. pixel_sizes-0.4.0/.github/workflows/python-test.yml +63 -0
  7. pixel_sizes-0.4.0/.github/workflows/spellcheck.yml +13 -0
  8. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.gitignore +121 -27
  9. pixel_sizes-0.4.0/.octocov.yml +22 -0
  10. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/PKG-INFO +71 -8
  11. pixel_sizes-0.4.0/README.md +79 -0
  12. pixel_sizes-0.4.0/SECURITY.md +23 -0
  13. pixel_sizes-0.4.0/lefthook.yml +13 -0
  14. pixel_sizes-0.4.0/pixel_sizes/__init__.py +204 -0
  15. pixel_sizes-0.4.0/pixel_sizes/_version.py +24 -0
  16. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pixel_sizes.egg-info/PKG-INFO +71 -8
  17. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pixel_sizes.egg-info/SOURCES.txt +6 -0
  18. pixel_sizes-0.4.0/pixel_sizes.egg-info/scm_file_list.json +26 -0
  19. pixel_sizes-0.4.0/pixel_sizes.egg-info/scm_version.json +8 -0
  20. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pyproject.toml +46 -6
  21. pixel_sizes-0.4.0/tests/test_basis.py +119 -0
  22. pixel_sizes-0.4.0/uv.lock +587 -0
  23. pixel_sizes-0.2.2/.github/workflows/happy.yml +0 -18
  24. pixel_sizes-0.2.2/.github/workflows/pypi-publish.yml +0 -49
  25. pixel_sizes-0.2.2/.github/workflows/python-test.yml +0 -61
  26. pixel_sizes-0.2.2/.github/workflows/spellcheck.yml +0 -16
  27. pixel_sizes-0.2.2/README.md +0 -17
  28. pixel_sizes-0.2.2/pixel_sizes/__init__.py +0 -32
  29. pixel_sizes-0.2.2/pixel_sizes/_version.py +0 -16
  30. pixel_sizes-0.2.2/tests/test_basis.py +0 -26
  31. pixel_sizes-0.2.2/uv.lock +0 -403
  32. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.editorconfig +0 -0
  33. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.github/renovate.json5 +0 -0
  34. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/.gitignore.in +0 -0
  35. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/LICENSE +0 -0
  36. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pixel_sizes/py.typed +0 -0
  37. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pixel_sizes.egg-info/dependency_links.txt +0 -0
  38. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/pixel_sizes.egg-info/top_level.txt +0 -0
  39. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/setup.cfg +0 -0
  40. {pixel_sizes-0.2.2 → pixel_sizes-0.4.0}/tests/__init__.py +0 -0
@@ -1,3 +1,6 @@
1
+ [run]
2
+ branch = True
3
+
1
4
  [report]
2
5
  exclude_lines =
3
6
  @overload
@@ -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@a7071a4635eaece62696cd7132306616ce283c47
@@ -0,0 +1,15 @@
1
+ name: happy-commit
2
+ on:
3
+ - pull_request
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ 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@a7071a4635eaece62696cd7132306616ce283c47
@@ -0,0 +1,56 @@
1
+ name: octocov
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ 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
+ with:
29
+ persist-credentials: false
30
+
31
+ - name: Set up Python
32
+ id: setup-python
33
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
34
+ with:
35
+ python-version: "${{ matrix.python }}"
36
+
37
+ - name: Set up uv
38
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
39
+ with:
40
+ enable-cache: "true"
41
+
42
+ - name: Install dependencies
43
+ run: uv sync
44
+
45
+ - name: Test
46
+ run: uv run poe test
47
+
48
+ - name: Coverage
49
+ run: uv run poe coverage-xml
50
+
51
+ # See also: https://github.com/k1LoW/octocov-action
52
+ - name: Report coverage with octocov
53
+ uses: k1LoW/octocov-action@b3b6ee60482a667950f87553abf1df63217235d9 # v1
54
+ with:
55
+ github-token: ${{ secrets.GITHUB_TOKEN }}
56
+ config: .octocov.yml
@@ -0,0 +1,65 @@
1
+ name: Packaging
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+ release:
7
+ # "released" events are emitted either when directly be released or be edited from pre-released.
8
+ types: [prereleased, released]
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ env:
18
+ python_version: 3.13
19
+
20
+ jobs:
21
+ deploy:
22
+ runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: read
25
+ id-token: write
26
+ attestations: write
27
+ steps:
28
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29
+ with:
30
+ persist-credentials: false
31
+
32
+ - name: Set up Python
33
+ id: setup-python
34
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
35
+ with:
36
+ python-version: ${{ env.python_version }}
37
+
38
+ - name: Set up uv
39
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
40
+ with:
41
+ enable-cache: "true"
42
+
43
+ - name: Install dependencies
44
+ run: |
45
+ uv python pin ${{ env.python_version }}
46
+ uv sync
47
+
48
+ - name: Build
49
+ run: uv build
50
+
51
+ - name: Generate artifact attestation
52
+ if: github.event_name == 'release' && !github.event.release.prerelease
53
+ uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
54
+ with:
55
+ subject-path: 'dist/*'
56
+
57
+ - name: Publish distribution to Test PyPI
58
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
59
+ if: github.event_name == 'release' && github.event.release.prerelease
60
+ with:
61
+ repository-url: https://test.pypi.org/legacy/
62
+
63
+ - name: Publish distribution to PyPI
64
+ if: github.event_name == 'release' && !github.event.release.prerelease
65
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
@@ -0,0 +1,63 @@
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.ref }}
13
+ cancel-in-progress: true
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ test:
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
25
+
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29
+
30
+ - name: Set up Python
31
+ id: setup-python
32
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
33
+ with:
34
+ python-version: "${{ matrix.python }}"
35
+
36
+ - name: Set up uv
37
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
38
+ with:
39
+ enable-cache: "true"
40
+
41
+ - name: Install dependencies
42
+ run: |
43
+ uv python pin ${{ matrix.python }}
44
+ uv sync
45
+
46
+ - parallel:
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
@@ -0,0 +1,13 @@
1
+ name: Spellcheck
2
+ on:
3
+ - pull_request
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ 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
  _version.py
@@ -0,0 +1,22 @@
1
+ # https://github.com/k1LoW/octocov?tab=readme-ov-file#configuration
2
+ coverage:
3
+ paths:
4
+ - coverage.xml
5
+ if: coverage.percentage >= 80.0
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: pixel_sizes
3
- Version: 0.2.2
3
+ Version: 0.4.0
4
4
  Summary: Pixel sizes
5
5
  Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
6
6
  License: Copyright 2022-2025 Kitsu Yui
@@ -17,31 +17,94 @@ License: Copyright 2022-2025 Kitsu Yui
17
17
 
18
18
  Project-URL: Homepage, https://github.com/kitsuyui/python-pixel-sizes
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
+ Requires-Python: >=3.10
28
28
  Description-Content-Type: text/markdown
29
29
  License-File: LICENSE
30
+ Dynamic: license-file
30
31
 
31
32
  # python-pixel-sizes
32
33
 
33
- [![codecov](https://codecov.io/gh/kitsuyui/python-pixel-sizes/graph/badge.svg?token=830WMASKHU)](https://codecov.io/gh/kitsuyui/python-pixel-sizes)
34
+ ![Coverage](https://raw.githubusercontent.com/kitsuyui/octocov-central/main/badges/kitsuyui/python-pixel-sizes/coverage.svg)
34
35
 
35
36
  ## Usage
36
37
 
37
38
  ```python
38
39
  from pixel_sizes import SIZES
39
40
 
40
- SIZES['8k'].width # 7680
41
- SIZES['8k'].height # 4320
42
- SIZES['8k'].aspect_ratio() # 16/9 == 1.7777777777777777
41
+ SIZES['Full HD'].width # 1920
42
+ SIZES['Full HD'].height # 1080
43
+ SIZES['Full HD'].aspect_ratio() # 16/9 == 1.7777777777777777
44
+ SIZES['Full HD'].aspect_ratio_fraction() # (16, 9)
45
+ SIZES['Full HD'].rotate() # Size(width=1080, height=1920)
46
+ SIZES['Full HD'].scale(2) # Size(width=3840, height=2160)
43
47
  ```
44
48
 
49
+ ## API
50
+
51
+ ### `Size`
52
+
53
+ | Attribute / Method | Description |
54
+ | --- | --- |
55
+ | `width: int` | Width in pixels |
56
+ | `height: int` | Height in pixels |
57
+ | `aspect_ratio() -> float` | Width / height as a float |
58
+ | `aspect_ratio_fraction() -> tuple[int, int]` | Aspect ratio reduced to lowest terms, e.g. `(16, 9)` |
59
+ | `rotate() -> Size` | New `Size` with width and height swapped |
60
+ | `scale(factor: int \| float) -> Size` | New `Size` multiplied by *factor* |
61
+
62
+ ### `SIZES`
63
+
64
+ A read-only mapping of type `Mapping[str, Size]` containing named display
65
+ resolutions. Attempting to assign or delete entries raises `TypeError`.
66
+ Representative keys (full list in source):
67
+
68
+ ```python
69
+ "480p", "720p", "1080p", "Full HD", "HD 1080p",
70
+ "WQHD", "4K UHD", "8K UHD", ...
71
+ ```
72
+
73
+ Iterate all available names:
74
+
75
+ ```python
76
+ from pixel_sizes import SIZES
77
+ list(SIZES.keys())
78
+ ```
79
+
80
+ ## Development
81
+
82
+ This repository uses [lefthook](https://lefthook.dev/) to run the same checks as CI
83
+ locally, so problems surface before they reach CI.
84
+
85
+ ```sh
86
+ # Install dependencies
87
+ uv sync
88
+
89
+ # Install the Git hooks (once; requires lefthook on your PATH)
90
+ lefthook install
91
+ ```
92
+
93
+ Once installed, the hooks run automatically:
94
+
95
+ - **pre-commit**: `uv run poe check`
96
+ - **pre-push**: `uv run poe check` and `uv run poe test`
97
+
98
+ You can also run the checks manually:
99
+
100
+ ```sh
101
+ uv run poe check
102
+ uv run poe test
103
+ ```
104
+
105
+ CI still runs the full matrix (see `.github/workflows/`); the hooks only bring that
106
+ feedback earlier on your machine.
107
+
45
108
  # LICENSE
46
109
 
47
110
  The 3-Clause BSD License. See also LICENSE file.