Skip to content

Commit 4601845

Browse files
committed
fix:github action
1 parent 6b2c95d commit 4601845

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

Diff for: .github/workflows/test.yaml

+31-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
name: Python package
22

3-
on: [ push ]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
410

511
jobs:
6-
build:
12+
lint:
13+
name: "flake8 on code"
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.ref }}
721

22+
- name: Set up Python 3.12
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3.12
26+
allow-prereleases: true
27+
28+
- name: Run flake8
29+
shell: bash
30+
run: |
31+
flake8
32+
33+
test:
34+
needs: [ lint ]
835
runs-on: ubuntu-latest
936
strategy:
1037
fail-fast: false
@@ -21,14 +48,8 @@ jobs:
2148
- name: Install dependencies
2249
run: |
2350
python -m pip install --upgrade pip
24-
pip install flake8 pytest
25-
pip install coveralls
26-
# - name: Lint with flake8
27-
# run: |
28-
# stop the build if there are Python syntax errors or undefined names
29-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
30-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
31-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
51+
pip install -r requirements-dev.txt
52+
3253
- name: Test
3354
run: |
3455
make coverage

Diff for: jsonpointer.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,20 @@
3232

3333
""" Identify specific nodes in a JSON document (RFC 6901) """
3434

35-
3635
# Will be parsed by setup.py to determine package metadata
3736
__author__ = 'Stefan Kögl <[email protected]>'
3837
__version__ = '3.0.0'
3938
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
4039
__license__ = 'Modified BSD License'
4140

42-
43-
4441
try:
4542
from collections.abc import Mapping, Sequence
4643
except ImportError: # Python 3
4744
from collections import Mapping, Sequence
4845

49-
from itertools import tee, chain
50-
import re
5146
import copy
47+
import re
48+
from itertools import tee, chain
5249

5350
_nothing = object()
5451

@@ -298,7 +295,7 @@ def join(self, suffix):
298295
suffix_parts = suffix
299296
try:
300297
return JsonPointer.from_parts(chain(self.parts, suffix_parts))
301-
except:
298+
except: # noqa E722
302299
raise JsonPointerException("Invalid suffix")
303300

304301
def __truediv__(self, suffix): # Python 3

Diff for: requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ wheel
22
twine>=5.1.0
33
setuptools>=70
44
coverage
5+
flake8==7.0.0

Diff for: setup.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[bdist_wheel]
22
universal = 1
3+
4+
[flake8]
5+
max-line-length = 120
6+
exclude = .git,.tox,dist,doc,*egg,build,.venv

Diff for: setup.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python
22

3-
from setuptools import setup
4-
import re
53
import io
64
import os.path
5+
import re
6+
7+
from setuptools import setup
78

89
dirname = os.path.dirname(os.path.abspath(__file__))
910
filename = os.path.join(dirname, 'jsonpointer.py')
@@ -14,7 +15,7 @@
1415
PACKAGE = 'jsonpointer'
1516

1617
MODULES = (
17-
'jsonpointer',
18+
'jsonpointer',
1819
)
1920

2021
AUTHOR_EMAIL = metadata['author']
@@ -26,10 +27,8 @@
2627
# Extract name and e-mail ("Firstname Lastname <[email protected]>")
2728
AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups()
2829

29-
3030
with open('README.md') as readme:
31-
long_description = readme.read()
32-
31+
long_description = readme.read()
3332

3433
CLASSIFIERS = [
3534
'Development Status :: 5 - Production/Stable',
@@ -64,4 +63,4 @@
6463
scripts=['bin/jsonpointer'],
6564
classifiers=CLASSIFIERS,
6665
python_requires='>=3.7',
67-
)
66+
)

0 commit comments

Comments
 (0)