Skip to content

Commit a7ea7dd

Browse files
committed
[global] Switch from setuptools to pypa/build
Build instructions are now consolidated into pyproject.toml. This commit constitutes release 1.3.3.
1 parent 3131888 commit a7ea7dd

14 files changed

+52
-71
lines changed

.ruff.toml

+2-13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ target-version = "py38"
33
line-length = 150
44

55
select = ["ALL"]
6+
67
ignore = [
78

89
# ignore complete rule packages [common]
@@ -36,18 +37,6 @@ ignore = [
3637

3738
# ignore individual errors & warnings [this project]
3839

39-
]
40-
41-
42-
[pylint]
43-
44-
max-args = 8 # default: 5
45-
max-statements = 60 # default: 50
46-
47-
48-
[per-file-ignores]
40+
"INP001", # implicit-namespace-package
4941

50-
"__init__.py" = [
51-
"E402", # pycodestyle: module-import-not-at-top-of-file
52-
"F403", # pyflakes: import-star
5342
]

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ language: python
44
python:
55
- 3.8
66
install:
7-
- pip install -r requirements.txt
7+
- pip install pytest
88
- pip install httpie
99
- pip install ruff
1010
script:

MANIFEST.in

-3
This file was deleted.

Makefile

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
deps:
2-
pip3 install -r requirements.txt
3-
41
lint:
5-
ruff check --show-source imsize/[^a]*.py
2+
ruff check --show-source src/[^a]*.py
63

74
download:
85
ifeq (,$(wildcard ./test/images/*.DNG))
96
cd ./test/images && http --download https://support.theta360.com/intl/download/sample/R0010001.DNG
107
endif
118

129
test: download
13-
python3 setup.py test
10+
pytest -v
1411
make lint
1512

1613
install:
14+
pip3 install --user build
15+
rm -rf build dist || true
1716
pip3 uninstall --yes imsize || true
18-
rm -rf build dist imsize.egg-info || true
19-
python3 setup.py sdist bdist_wheel
20-
pip3 install --user dist/*.whl
17+
pyproject-build || true
18+
pip3 install --user dist/*.whl || true
19+
rm -rf build src/imsize.egg-info || true
2120
@python3 -c 'import imsize; print(f"Installed imsize version {imsize.__version__}.")'
2221

2322
release:
24-
pip3 install --user setuptools wheel twine
23+
pip3 install --user twine
2524
make install
2625
twine upload dist/*
2726

28-
.PHONY: deps lint download test install release
27+
.PHONY: lint download test install release

imsize/__init__.py

-15
This file was deleted.

pyproject.toml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[project]
2+
name = "imsize"
3+
version = "1.3.3"
4+
description="Lightning-fast extraction of image dimensions & bit depth."
5+
authors = [{name = "Tomi Aarnio", email = "[email protected]"}]
6+
readme = "README.md"
7+
requires-python = ">= 3.8"
8+
license = {file = "LICENSE"}
9+
classifiers = [
10+
"Programming Language :: Python :: 3",
11+
"License :: OSI Approved :: MIT License",
12+
"Operating System :: OS Independent",
13+
]
14+
dependencies = [
15+
"numpy >= 1.21.2",
16+
"piexif >= 1.1.3",
17+
"pyexiv2 >= 2.7.0",
18+
"rawpy >= 0.16.0"
19+
]
20+
21+
[project.urls]
22+
Homepage = "http://github.com/toaarnio/imsize"
23+
24+
[project.scripts]
25+
imsize = "consoleapp:main"

requirements.txt

-4
This file was deleted.

setup.py

-25
This file was deleted.
File renamed without changes.

imsize/consoleapp.py renamed to src/consoleapp.py

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def main():
5151
print(" supported file types:")
5252
print(" ", '\n '.join(FILETYPES))
5353
print()
54+
print(f"imsize version {imsize.__version__}")
55+
print()
5456
sys.exit(-1)
5557
else:
5658
if verbose:
File renamed without changes.

imsize/imsize.py renamed to src/imsize.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
"""
22
Extracts image dimensions, bit depth, and other basic metadata.
3+
4+
Example:
5+
info = imsize.read("myfile.jpg")
6+
factor = info.nbytes / info.filesize
7+
print(f"{info.filespec}: compression factor = {factor.1f}")
8+
9+
https://github.com/toaarnio/imsize
310
"""
411

512
import os # built-in library
@@ -23,6 +30,12 @@
2330
import pfmhdr
2431
import exrhdr
2532

33+
# Fetch version number from pyproject.toml
34+
35+
import importlib.metadata # built-in library
36+
37+
__version__ = importlib.metadata.version(__package__ or __name__)
38+
2639

2740
######################################################################################
2841
#
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)