diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 71513a62..3a4a57cc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,8 +7,8 @@ concurrency: cancel-in-progress: true jobs: - flake8: - name: flake8 + ruff: + name: ruff runs-on: ubuntu-latest steps: - name: Checkout @@ -16,32 +16,15 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11' - cache: 'pip' - - run: pip install --upgrade flake8 - - name: flake8 - uses: liskin/gh-problem-matcher-wrap@v1 - with: - linters: flake8 - run: flake8 - - isort: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' + python-version: "3.11" cache: 'pip' - - run: python -m pip install isort - - name: isort - uses: liskin/gh-problem-matcher-wrap@v1 - with: - linters: isort - run: isort --check --diff json2xml - + - run: | + python -m pip install --upgrade pip + pip install ruff + - name: Run Ruff + run: | + ruff json2xml + ruff tests mypy: diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index f4f4ff9a..ed76cd03 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,7 @@ jobs: os: [ ubuntu-latest, windows-latest, - macos-latest, + macos-13, ] steps: diff --git a/README.rst b/README.rst index f934fab1..304ccfc8 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ The library supports the following features: * convert from a `json` file * convert from an API that emits `json` data -Usage +Usage ^^^^^ The library can be used in these ways: diff --git a/json2xml/dicttoxml.py b/json2xml/dicttoxml.py index ff449b21..1d89103a 100644 --- a/json2xml/dicttoxml.py +++ b/json2xml/dicttoxml.py @@ -1,4 +1,5 @@ from __future__ import annotations + import datetime import logging import numbers diff --git a/json2xml/utils.py b/json2xml/utils.py index d5109bdf..37815700 100644 --- a/json2xml/utils.py +++ b/json2xml/utils.py @@ -1,6 +1,6 @@ +"""Utils methods to convert XML data to dict from various sources""" from __future__ import annotations -"""Utils methods to convert XML data to dict from various sources""" import json import urllib3 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..64bdc3d3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[tool.ruff] +exclude = [ + ".env", + ".venv", + "**/migrations/**", +] +ignore = [ + "E501", # line too long + "F403", # 'from module import *' used; unable to detect undefined names + "E701", # multiple statements on one line (colon) + "F401", # module imported but unused +] +line-length = 119 +select = [ + "I", + "E", + "F", + "W", +] diff --git a/tests/test_json2xml.py b/tests/test_json2xml.py index 40003fef..765cf7dc 100644 --- a/tests/test_json2xml.py +++ b/tests/test_json2xml.py @@ -2,16 +2,22 @@ """Tests for `json2xml` package.""" -import pytest import json +import pytest import xmltodict from pyexpat import ExpatError from json2xml import json2xml -from json2xml.utils import (InvalidDataError, JSONReadError, StringReadError, - URLReadError, readfromjson, readfromstring, - readfromurl) +from json2xml.utils import ( + InvalidDataError, + JSONReadError, + StringReadError, + URLReadError, + readfromjson, + readfromstring, + readfromurl, +) class TestJson2xml: