From 8642e619a8d0da574cc12ac65818fad2fdf604ce Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Tue, 7 Feb 2023 10:13:14 +0530 Subject: [PATCH 1/5] --wip-- [skip ci] --- README.rst | 4 ++-- docs/index.md | 17 +++++++++++++++++ mkdocs.yml | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/README.rst b/README.rst index f934fab1..f304d793 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ -======== +[======== json2xml ======== .. image:: https://badge.fury.io/py/json2xml.svg .. image:: https://static.pepy.tech/personalized-badge/json2xml?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads - :target: https://pepy.tech/project/json2xml + :target: https://pepy.tech/project/json2xml .. image:: https://github.com/vinitkumar/json2xml/actions/workflows/pythonpackage.yml/badge.svg .. image:: https://img.shields.io/pypi/pyversions/json2xml.svg diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..000ea345 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,17 @@ +# Welcome to MkDocs + +For full documentation visit [mkdocs.org](https://www.mkdocs.org). + +## Commands + +* `mkdocs new [dir-name]` - Create a new project. +* `mkdocs serve` - Start the live-reloading docs server. +* `mkdocs build` - Build the documentation site. +* `mkdocs -h` - Print help message and exit. + +## Project layout + + mkdocs.yml # The configuration file. + docs/ + index.md # The documentation homepage. + ... # Other markdown pages, images and other files. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000..c97182f5 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1 @@ +site_name: My Docs From 1edf5e8ae15618ddbd9799d75a22f48987359d23 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 26 Apr 2023 23:24:13 +0530 Subject: [PATCH 2/5] fix: use new faster macos runners --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index f4f4ff9a..8cef8622 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,7 @@ jobs: os: [ ubuntu-latest, windows-latest, - macos-latest, + macos-latest-xl, ] steps: From 53bbc3d460caaecf752dcd0a64ef24a641eb55bc Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 26 Apr 2023 23:26:09 +0530 Subject: [PATCH 3/5] fix: revert changes --- README.rst | 6 +++--- docs/index.md | 17 ----------------- mkdocs.yml | 1 - 3 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 docs/index.md delete mode 100644 mkdocs.yml diff --git a/README.rst b/README.rst index f304d793..304ccfc8 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ -[======== +======== json2xml ======== .. image:: https://badge.fury.io/py/json2xml.svg .. image:: https://static.pepy.tech/personalized-badge/json2xml?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads - :target: https://pepy.tech/project/json2xml + :target: https://pepy.tech/project/json2xml .. image:: https://github.com/vinitkumar/json2xml/actions/workflows/pythonpackage.yml/badge.svg .. image:: https://img.shields.io/pypi/pyversions/json2xml.svg @@ -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/docs/index.md b/docs/index.md deleted file mode 100644 index 000ea345..00000000 --- a/docs/index.md +++ /dev/null @@ -1,17 +0,0 @@ -# Welcome to MkDocs - -For full documentation visit [mkdocs.org](https://www.mkdocs.org). - -## Commands - -* `mkdocs new [dir-name]` - Create a new project. -* `mkdocs serve` - Start the live-reloading docs server. -* `mkdocs build` - Build the documentation site. -* `mkdocs -h` - Print help message and exit. - -## Project layout - - mkdocs.yml # The configuration file. - docs/ - index.md # The documentation homepage. - ... # Other markdown pages, images and other files. diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index c97182f5..00000000 --- a/mkdocs.yml +++ /dev/null @@ -1 +0,0 @@ -site_name: My Docs From 9d792f2ad761b53942077657b26f4a5c1d8d2a79 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 26 Apr 2023 23:31:53 +0530 Subject: [PATCH 4/5] fix: adapt ruff --- .github/workflows/lint.yml | 37 ++++++++++--------------------------- json2xml/dicttoxml.py | 1 + json2xml/utils.py | 2 +- pyproject.toml | 19 +++++++++++++++++++ tests/test_json2xml.py | 14 ++++++++++---- 5 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 pyproject.toml 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/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: From d365950cd5ec2152b841709723b8e1d6d0980141 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Thu, 27 Apr 2023 00:35:19 +0530 Subject: [PATCH 5/5] fix: just try macos 13 --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8cef8622..ed76cd03 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,7 @@ jobs: os: [ ubuntu-latest, windows-latest, - macos-latest-xl, + macos-13, ] steps: