Skip to content

Commit

Permalink
Merge pull request #41 from spyoungtech/typing
Browse files Browse the repository at this point in the history
Add Typing
  • Loading branch information
spyoungtech committed Aug 1, 2023
2 parents 2347cbb + 7209f54 commit 43151be
Show file tree
Hide file tree
Showing 25 changed files with 1,040 additions and 469 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Expand Up @@ -14,13 +14,13 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.11

- name: build
shell: bash
run: |
python -m pip install --upgrade wheel setuptools sly regex
python setup.py sdist bdist_wheel
python -m pip install --upgrade wheel setuptools sly regex build
python -m build
- name: Release PyPI
shell: bash
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/unittests.yml
Expand Up @@ -2,24 +2,32 @@ on: [ push, pull_request ]

jobs:
build:
strategy:
fail-fast: false
matrix:
python_version: ["3.10", "3.9", "3.8", "3.11"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python_version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install sly coverage regex pytest
python -m pip install -r requirements-dev.txt
python -m pip install .
python -m pip install tox
git clone https://github.com/json5/json5-tests.git
- name: Test with coverage/pytest
env:
PYTHONUNBUFFERED: "1"
run: |
coverage run -m pytest tests
tox -e py
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -5,3 +5,42 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.10.0
hooks:
- id: reorder-python-imports

- repo: https://github.com/psf/black
rev: '23.7.0'
hooks:
- id: black
args:
- "-S"
- "-l"
- "120"

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
- id: pyupgrade
args: ["--py38-plus"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.4.1'
hooks:
- id: mypy
args:
- "--strict"
- "--disable-error-code"
- "name-defined"
exclude: ^(tests/.*|setup.py|docs/.*)
additional_dependencies:
- types-regex

- repo: https://github.com/pycqa/flake8
rev: '6.0.0' # pick a git hash / tag to point to
hooks:
- id: flake8
args:
- "--ignore"
- "E501,E704,E301,W503,F405,F811,F821,F403,"
7 changes: 1 addition & 6 deletions docs/conf.py
Expand Up @@ -3,18 +3,14 @@
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'json-five'
Expand All @@ -30,8 +26,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
8 changes: 6 additions & 2 deletions json5/__init__.py
@@ -1,3 +1,7 @@
from .loader import loads, load
from .dumper import dumps, dump
from .dumper import dump
from .dumper import dumps
from .loader import load
from .loader import loads
from .utils import JSON5DecodeError

__all__ = ['dump', 'dumps', 'load', 'loads', 'JSON5DecodeError']

0 comments on commit 43151be

Please sign in to comment.