Skip to content

Commit

Permalink
fix:github action
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed May 28, 2024
1 parent 6b2c95d commit 4601845
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
name: Python package

on: [ push ]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
lint:
name: "flake8 on code"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
allow-prereleases: true

- name: Run flake8
shell: bash
run: |
flake8
test:
needs: [ lint ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -21,14 +48,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install coveralls
# - name: Lint with flake8
# run: |
# stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install -r requirements-dev.txt
- name: Test
run: |
make coverage
9 changes: 3 additions & 6 deletions jsonpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,20 @@

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


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



try:
from collections.abc import Mapping, Sequence
except ImportError: # Python 3
from collections import Mapping, Sequence

from itertools import tee, chain
import re
import copy
import re
from itertools import tee, chain

_nothing = object()

Expand Down Expand Up @@ -298,7 +295,7 @@ def join(self, suffix):
suffix_parts = suffix
try:
return JsonPointer.from_parts(chain(self.parts, suffix_parts))
except:
except: # noqa E722
raise JsonPointerException("Invalid suffix")

def __truediv__(self, suffix): # Python 3
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ wheel
twine>=5.1.0
setuptools>=70
coverage
flake8==7.0.0
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[bdist_wheel]
universal = 1

[flake8]
max-line-length = 120
exclude = .git,.tox,dist,doc,*egg,build,.venv
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python

from setuptools import setup
import re
import io
import os.path
import re

from setuptools import setup

dirname = os.path.dirname(os.path.abspath(__file__))
filename = os.path.join(dirname, 'jsonpointer.py')
Expand All @@ -14,7 +15,7 @@
PACKAGE = 'jsonpointer'

MODULES = (
'jsonpointer',
'jsonpointer',
)

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


with open('README.md') as readme:
long_description = readme.read()

long_description = readme.read()

CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
Expand Down Expand Up @@ -64,4 +63,4 @@
scripts=['bin/jsonpointer'],
classifiers=CLASSIFIERS,
python_requires='>=3.7',
)
)

0 comments on commit 4601845

Please sign in to comment.