Skip to content

Commit 199e1ed

Browse files
committed
1.4.2 - add support for python3.8
1 parent 75603e0 commit 199e1ed

File tree

7 files changed

+863
-19
lines changed

7 files changed

+863
-19
lines changed

Makefile

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1+
PYTHON := python
12
project:=pprintjson
2-
version:=$(shell python -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')
3+
version:=$(shell $(PYTHON) -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')
34

45
.PHONY: list
56
list help:
67
@make -pq | awk -F':' '/^[a-zA-Z0-9][^$$#\/\t=]*:([^=]|$$)/ {split($$1,A,/ /);for(i in A)print A[i]}' | sed '/Makefile/d' | sort
78

89
.PHONY: format
910
format:
10-
python -m black .
11+
@$(PYTHON) -m black *.py ./pprintjson/*.py
1112

1213
.PHONY: build
1314
build: clean
14-
rm -rf ./dist/*
15-
python3 setup.py sdist bdist_wheel
15+
@rm -rf ./dist/*
16+
@$(PYTHON) setup.py sdist bdist_wheel
17+
18+
.PHONY: test-setup
19+
test-setup:
20+
@pyenv install -s 3.6.10
21+
@pyenv install -s 3.7.7
22+
@pyenv install -s 3.8.2
1623

1724
.PHONY: test
18-
test:
19-
pyenv local 3.5.6 3.6.8 system
20-
python -m tox
25+
test: test-setup
26+
@pyenv local 3.6.10 3.7.7 3.8.2
27+
@$(PYTHON) -m tox
2128

2229
.PHONY: clean
2330
clean:
24-
rm -rf ./dist ./build ./*.egg-info ./htmlcov
25-
find . -name '*.pyc' -delete
26-
find . -name '__pycache__' -delete
31+
@rm -rf ./dist ./build ./*.egg-info ./htmlcov
32+
@find . -name '*.pyc' -delete
33+
@find . -name '__pycache__' -delete
2734

2835
.PHONY: check
2936
check:
30-
twine check dist/*
37+
@twine check dist/*
3138

3239
.PHONY: upload-test
3340
upload-test: test clean build check
34-
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
41+
@twine upload --repository-url https://test.pypi.org/legacy/ dist/*
3542

3643
.PHONY: tag
3744
tag:
3845
ifeq (,$(shell git tag --list | grep "${version}"))
39-
git tag "v${version}"
46+
@git tag "v${version}"
4047
endif
4148

4249
.PHONY: release
4350
release: tag
4451
ifdef version
45-
curl -XPOST \
52+
@curl -XPOST \
4653
-H "Authorization: token ${GITHUB_ACCESS_TOKEN}" \
4754
-H "Content-Type: application/json" \
4855
"https://api.github.com/repos/clarketm/${project}/releases" \
@@ -51,5 +58,4 @@ endif
5158

5259
.PHONY: upload
5360
publish upload: test clean build check
54-
twine upload dist/*
55-
61+
@twine upload dist/*

docs/source/index.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ Version |version|
2525

2626
## Installation
2727

28+
Install with the standard [`json`](https://docs.python.org/3/library/json.html) JSON encoder
29+
2830
```bash
2931
$ pip install pprintjson
3032
```
3133

34+
Install with the premier [`simplejson`](https://simplejson.readthedocs.io/en/latest/) JSON encoder
35+
```bash
36+
$ pip install pprintjson[simplejson]
37+
```
38+
3239
## Usage
3340

3441
```text
@@ -44,7 +51,7 @@ optional arguments:
4451
-h, --help show this help message and exit
4552
-i num, --indent num indent <num> number of spaces at each level (default: 4)
4653
-o file, --output file write output to <file> instead of stdout (default: stdout)
47-
-c cmd, --command cmd json <str> to pretty-print
54+
-c cmd, --command cmd json <cmd> to pretty-print
4855
-v, --version show program's version number and exit
4956
5057
```
@@ -57,6 +64,12 @@ Pretty print JSON from a **file** using the `pprintjson` CLI.
5764
$ pprintjson "./path/to/file.json"
5865
```
5966

67+
Pretty print JSON from a **stdin** using the `pprintjson` CLI.
68+
69+
```bash
70+
$ echo '{ "a": 1, "b": "string", "c": true }' | pprintjson
71+
```
72+
6073
Pretty print JSON from a **string** using the `pprintjson` CLI.
6174

6275
```bash

0 commit comments

Comments
 (0)