Skip to content

Commit

Permalink
Merge pull request #11 from torfsen/drop-python2-support
Browse files Browse the repository at this point in the history
Drop support for Python < 3.7
  • Loading branch information
torfsen committed Jul 29, 2023
2 parents 858a8a8 + cfc2e38 commit 6c0f803
Show file tree
Hide file tree
Showing 19 changed files with 266 additions and 67 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Adapted from the example on https://github.com/tox-dev/tox-gh

name: test
on:
push:
pull_request:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: test with ${{ matrix.py }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py:
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install dependencies
run: python -m pip install -r requirements-tox.txt tox-gh==1.2
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
run: tox --skip-pkg-install
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/build/
/README.html
/CHANGELOG.html
/.python-version

*.egg-info/

Expand Down
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
The format of this file is based on [Keep a Changelog] and this project adheres to [Semantic Versioning].


## [Unreleased]
## [1.0.0] (2023-07-29)

### Fixed

- `IllegalValue.__str__` was broken (reported and fixed by [@tusharmakkar08] in [#4])

### Added

- Support for Python 3.7, 3.8, 3.9, 3.10, and 3.11

### Removed

- Support for Python 2

### Changed

- Code cleanup (contributed by [@gvx] in [#3])
Expand All @@ -33,7 +41,8 @@ The format of this file is based on [Keep a Changelog] and this project adheres
[Keep a Changelog]: http://keepachangelog.com/
[Semantic Versioning]: http://semver.org/

[Unreleased]: https://github.com/torfsen/barely_json/compare/v0.1.1...master
[Unreleased]: https://github.com/torfsen/barely_json/compare/v1.0.0...master
[1.0.0]: https://github.com/torfsen/barely_json/compare/v0.1.1...v1.0.0
[0.1.1]: https://github.com/torfsen/barely_json/compare/v0.1.0...v0.1.1

[@gvx]: https://github.com/gvx
Expand All @@ -43,4 +52,3 @@ The format of this file is based on [Keep a Changelog] and this project adheres
[#2]: https://github.com/torfsen/barely_json/issues/2
[#3]: https://github.com/torfsen/barely_json/pull/3
[#4]: https://github.com/torfsen/barely_json/pull/4

12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PHONY: requirements

requirements-dev.txt:
pip-compile -q requirements-dev.in

requirements-test.txt:
pip-compile -q requirements-test.in

requirements-tox.txt:
pip-compile -q requirements-tox.in

requirements: requirements-dev.txt requirements-test.txt requirements-tox.txt
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Barely JSON

[![Travis CI badge](https://travis-ci.org/torfsen/barely_json.svg?branch=master)](https://travis-ci.org/torfsen/barely_json)
[![GitHub Actions badge](https://github.com/torfsen/barely_json/actions/workflows/test.yml/badge.svg)](https://github.com/torfsen/barely_json/actions/workflows/test.yml)

*A Python package for parsing data that only looks like JSON*

Expand Down Expand Up @@ -77,16 +77,16 @@ Clone the repository:
git clone https://github.com/torfsen/barely_json.git
cd barely_json

Install [tox] locally in a [virtualenv] if you haven't installed it globally:
Install the development dependencies

virtualenv venv
source venv/bin/activate
pip install tox
pip install -r requirements-dev.txt

Run the tests:

tox

For pull requests, the tests are run using GitHub actions.


[virtualenv]: https://virtualenv.pypa.io
[tox]: https://tox.readthedocs.io
Expand Down
11 changes: 3 additions & 8 deletions barely_json/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
#!/usr/bin/env python
# encoding: utf-8

'''
A very forgiving JSON parser.
'''

from __future__ import (absolute_import, division, print_function,
unicode_literals)

import codecs
import re

from six import iteritems
from pyparsing import *


__version__ = '0.1.1'
__version__ = '1.0.0'


class IllegalValue(object):
class IllegalValue:
'''
A value that is illegal in JSON.
Expand Down Expand Up @@ -183,7 +178,7 @@ def resolve(data, resolver=default_resolver):
if isinstance(data, list):
return [resolve(item, resolver) for item in data]
if isinstance(data, dict):
return {resolve(key, resolver): resolve(value, resolver) for key, value in iteritems(data)}
return {resolve(key, resolver): resolve(value, resolver) for key, value in data.items()}
if isinstance(data, IllegalValue):
return resolver(data.source)
return data
Expand Down
2 changes: 0 additions & 2 deletions dev-requirements.in

This file was deleted.

12 changes: 0 additions & 12 deletions dev-requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements-tox.in
pip-tools==6.14.0
69 changes: 69 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile requirements-dev.in
#
build==0.10.0
# via pip-tools
cachetools==5.3.1
# via tox
chardet==5.1.0
# via tox
click==8.1.6
# via pip-tools
colorama==0.4.6
# via tox
distlib==0.3.7
# via virtualenv
filelock==3.12.2
# via
# tox
# virtualenv
importlib-metadata==6.7.0
# via
# build
# click
# pluggy
# tox
# virtualenv
packaging==23.1
# via
# build
# pyproject-api
# tox
pip-tools==6.14.0
# via -r requirements-dev.in
platformdirs==3.9.1
# via
# tox
# virtualenv
pluggy==1.2.0
# via tox
pyproject-api==1.5.3
# via tox
pyproject-hooks==1.0.0
# via build
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-api
# tox
tox==4.6.4
# via -r requirements-dev.in
typing-extensions==4.7.1
# via
# importlib-metadata
# platformdirs
# tox
virtualenv==20.24.2
# via tox
wheel==0.41.0
# via pip-tools
zipp==3.15.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
1 change: 1 addition & 0 deletions requirements-test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest==7.4.0
26 changes: 26 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile requirements-test.in
#
exceptiongroup==1.1.2
# via pytest
importlib-metadata==6.7.0
# via
# pluggy
# pytest
iniconfig==2.0.0
# via pytest
packaging==23.1
# via pytest
pluggy==1.2.0
# via pytest
pytest==7.4.0
# via -r requirements-test.in
tomli==2.0.1
# via pytest
typing-extensions==4.7.1
# via importlib-metadata
zipp==3.15.0
# via importlib-metadata
2 changes: 2 additions & 0 deletions requirements-tox.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip-tools==6.14.0
tox==4.6.4
69 changes: 69 additions & 0 deletions requirements-tox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile requirements-tox.in
#
build==0.10.0
# via pip-tools
cachetools==5.3.1
# via tox
chardet==5.1.0
# via tox
click==8.1.6
# via pip-tools
colorama==0.4.6
# via tox
distlib==0.3.7
# via virtualenv
filelock==3.12.2
# via
# tox
# virtualenv
importlib-metadata==6.7.0
# via
# build
# click
# pluggy
# tox
# virtualenv
packaging==23.1
# via
# build
# pyproject-api
# tox
pip-tools==6.14.0
# via -r requirements-tox.in
platformdirs==3.9.1
# via
# tox
# virtualenv
pluggy==1.2.0
# via tox
pyproject-api==1.5.3
# via tox
pyproject-hooks==1.0.0
# via build
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-api
# tox
tox==4.6.4
# via -r requirements-tox.in
typing-extensions==4.7.1
# via
# importlib-metadata
# platformdirs
# tox
virtualenv==20.24.2
# via tox
wheel==0.41.0
# via pip-tools
zipp==3.15.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
3 changes: 0 additions & 3 deletions requirements.in

This file was deleted.

9 changes: 1 addition & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements.txt requirements.in
#
pyparsing==2.2.0
six==1.10.0
pyparsing>=3.1.0
Loading

0 comments on commit 6c0f803

Please sign in to comment.