Skip to content

Commit 3c2113b

Browse files
authored
Use GitHub actions to lint and test (#163)
1 parent 85bea26 commit 3c2113b

File tree

19 files changed

+332
-308
lines changed

19 files changed

+332
-308
lines changed

.github/workflows/linting.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Run static code analysis.
3+
#
4+
name: Static Analysis
5+
6+
on:
7+
- push
8+
9+
jobs:
10+
static-check:
11+
name: Run Static Analysis
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8"]
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Cache dependencies
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-dev-${{ hashFiles('setup.py') }}
29+
restore-keys: |
30+
${{ runner.os }}-dev-
31+
32+
- name: Install dependencies
33+
run: |
34+
pip install virtualenv
35+
make venv reqs-install
36+
37+
- name: Analysing the code with mypy
38+
run: |
39+
make mypy
40+
41+
- name: Analysing the code with pylint
42+
run: |
43+
make lint

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Run unit tests.
3+
#
4+
name: Test
5+
6+
on:
7+
- pull_request
8+
9+
jobs:
10+
pytest:
11+
name: Run Tests
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
strategy:
15+
matrix:
16+
python-version:
17+
- "3.5"
18+
- "3.6"
19+
- "3.7"
20+
- "3.8"
21+
- "3.9"
22+
- "3.10"
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Cache dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: ~/.cache/pip
35+
key: ${{ runner.os }}-test-${{ hashFiles('setup.py') }}
36+
restore-keys: |
37+
${{ runner.os }}-test-
38+
39+
- name: Download Samples
40+
run: |
41+
make samples-download
42+
43+
- name: Install
44+
run: |
45+
pip install -e .
46+
47+
- name: Run in debug and color mode
48+
run: |
49+
find exif-samples-master -name *.tiff -o -name *.jpg | xargs EXIF.py -dc
50+
51+
- name: Compare image processing output
52+
run: |
53+
find exif-samples-master -name *.tiff -o -name *.jpg | sort -f | xargs EXIF.py > exif-samples-master/dump_test
54+
diff -Z --side-by-side --suppress-common-lines exif-samples-master/dump exif-samples-master/dump_test

.pylintrc

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -60,79 +60,13 @@ confidence=
6060
# --enable=similarities". If you want to run only the classes checker, but have
6161
# no Warning level messages displayed, use "--disable=all --enable=classes
6262
# --disable=W".
63-
disable=parameter-unpacking,
64-
unpacking-in-except,
65-
backtick,
66-
long-suffix,
67-
raw-checker-failed,
68-
bad-inline-option,
69-
locally-disabled,
70-
file-ignored,
71-
suppressed-message,
72-
useless-suppression,
73-
use-symbolic-message-instead,
74-
apply-builtin,
75-
basestring-builtin,
76-
buffer-builtin,
77-
cmp-builtin,
78-
coerce-builtin,
79-
execfile-builtin,
80-
file-builtin,
81-
long-builtin,
82-
raw_input-builtin,
83-
reduce-builtin,
84-
standarderror-builtin,
85-
unicode-builtin,
86-
xrange-builtin,
87-
coerce-method,
88-
delslice-method,
89-
getslice-method,
90-
setslice-method,
91-
no-absolute-import,
92-
old-division,
93-
dict-iter-method,
94-
dict-view-method,
95-
next-method-called,
96-
metaclass-assignment,
97-
indexing-exception,
98-
oct-method,
99-
hex-method,
100-
nonzero-method,
101-
cmp-method,
102-
input-builtin,
103-
round-builtin,
104-
intern-builtin,
105-
unichr-builtin,
106-
map-builtin-not-iterating,
107-
zip-builtin-not-iterating,
108-
range-builtin-not-iterating,
109-
filter-builtin-not-iterating,
110-
using-cmp-argument,
111-
eq-without-hash,
112-
div-method,
113-
idiv-method,
114-
rdiv-method,
115-
exception-message-attribute,
116-
deprecated-str-translate-call,
117-
deprecated-itertools-function,
118-
deprecated-types-field,
119-
next-method-defined,
120-
dict-items-not-iterating,
121-
dict-keys-not-iterating,
122-
dict-values-not-iterating,
123-
deprecated-operator-function,
124-
xreadlines-attribute,
125-
deprecated-sys-function,
126-
exception-escape,
127-
comprehension-escape,
128-
missing-docstring,
129-
# some magic stuff going on, look into this
130-
import-error,
63+
disable=missing-docstring,
64+
duplicate-code, # https://github.com/PyCQA/pylint/issues/214
13165
# we should try to get rid of these at some point!
13266
fixme,
67+
consider-using-f-string,
13368
too-many-arguments,
13469
too-many-branches,
135-
too-many-statements,
13670

13771
# Enable the message, report, category or checker with the given id(s). You can
13872
# either give multiple identifier separated by comma (,) or put this option

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

EXIF.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
#
88
# Copyright (c) 2002-2007 Gene Cash
9-
# Copyright (c) 2007-2020 Ianaré Sévi and contributors
9+
# Copyright (c) 2007-2022 Ianaré Sévi and contributors
1010
#
1111
# See LICENSE.txt file for licensing information
1212
# See ChangeLog.rst file for all contributors and changes
@@ -18,9 +18,8 @@
1818

1919
import sys
2020
import argparse
21-
import logging
2221
import timeit
23-
from exifread.tags import DEFAULT_STOP_TAG, FIELD_TYPES
22+
from exifread.tags import FIELD_TYPES
2423
from exifread import process_file, exif_log, __version__
2524

2625
logger = exif_log.get_logger()
@@ -122,5 +121,4 @@ def main(args) -> None:
122121

123122

124123
if __name__ == '__main__':
125-
args = get_args()
126-
main(args)
124+
main(get_args())

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ lint: ## Run linting (pylint)
2424
$(PYLINT_BIN) -f colorized ./exifread
2525

2626
mypy: ## Run mypy
27-
$(MYPY_BIN) --show-error-context ./exifread
27+
$(MYPY_BIN) --show-error-context ./exifread ./EXIF.py
2828

2929
#test: ## Run all tests
3030
# $(PYTHON_BIN) -m unittest discover -v -s ./tests
3131

3232
analyze: lint mypy ## Run all static analysis tools
3333

34-
reqs-install: ## Install requirements
35-
$(PIP_INSTALL) pylint==2.6.2 mypy==0.782
34+
reqs-install: ## Install with all requirements
35+
$(PIP_INSTALL) .[dev]
3636

3737
samples-download: ## Install sample files used for testing.
3838
wget https://github.com/ianare/exif-samples/archive/master.tar.gz

README.rst

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ Supported formats: TIFF, JPEG, Webp, HEIC
1313
Compatibility
1414
*************
1515

16-
EXIF.py is tested and officially supported on the following Python versions:
17-
18-
- 3.5
19-
- 3.6
20-
- 3.7
21-
- 3.8
16+
EXIF.py is tested and officially supported on Python 3.5 to 3.10
2217

2318
Starting with version ``3.0.0``, Python2 compatibility is dropped *completely*
2419
(syntax errors due to type hinting).
@@ -29,21 +24,23 @@ https://pythonclock.org/
2924
Installation
3025
************
3126

32-
PyPI
33-
====
27+
Stable Version
28+
==============
3429
The recommended process is to install the `PyPI package <https://pypi.python.org/pypi/ExifRead>`_,
3530
as it allows easily staying up to date::
3631

3732
$ pip install exifread
3833

3934
See the `pip documentation <https://pip.pypa.io/en/latest/user_guide.html>`_ for more info.
4035

41-
Archive
42-
=======
43-
Download an archive from the project's `releases page <https://github.com/ianare/exif-py/releases>`_.
36+
Development Version
37+
===================
38+
39+
After cloning the repo, use the provided Makefile::
4440

45-
Extract and enjoy.
41+
make venv reqs-install
4642

43+
Which will install a virtual environment and install development dependencies.
4744

4845
Usage
4946
*****
@@ -53,13 +50,13 @@ Command line
5350

5451
Some examples::
5552

56-
$ EXIF.py image1.jpg
57-
$ EXIF.py -dc image1.jpg image2.tiff
58-
$ find ~/Pictures -name "*.jpg" -o -name "*.tiff" | xargs EXIF.py
53+
EXIF.py image1.jpg
54+
EXIF.py -dc image1.jpg image2.tiff
55+
find ~/Pictures -name "*.jpg" -o -name "*.tiff" | xargs EXIF.py
5956

6057
Show command line options::
6158

62-
$ EXIF.py -h
59+
EXIF.py -h
6360

6461
Python Script
6562
=============

0 commit comments

Comments
 (0)