Skip to content

Commit

Permalink
1.4.2 - add support for python3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
clarketm committed Apr 19, 2020
1 parent 75603e0 commit 199e1ed
Show file tree
Hide file tree
Showing 7 changed files with 863 additions and 19 deletions.
38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
PYTHON := python
project:=pprintjson
version:=$(shell python -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')
version:=$(shell $(PYTHON) -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')

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

.PHONY: format
format:
python -m black .
@$(PYTHON) -m black *.py ./pprintjson/*.py

.PHONY: build
build: clean
rm -rf ./dist/*
python3 setup.py sdist bdist_wheel
@rm -rf ./dist/*
@$(PYTHON) setup.py sdist bdist_wheel

.PHONY: test-setup
test-setup:
@pyenv install -s 3.6.10
@pyenv install -s 3.7.7
@pyenv install -s 3.8.2

.PHONY: test
test:
pyenv local 3.5.6 3.6.8 system
python -m tox
test: test-setup
@pyenv local 3.6.10 3.7.7 3.8.2
@$(PYTHON) -m tox

.PHONY: clean
clean:
rm -rf ./dist ./build ./*.egg-info ./htmlcov
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
@rm -rf ./dist ./build ./*.egg-info ./htmlcov
@find . -name '*.pyc' -delete
@find . -name '__pycache__' -delete

.PHONY: check
check:
twine check dist/*
@twine check dist/*

.PHONY: upload-test
upload-test: test clean build check
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
@twine upload --repository-url https://test.pypi.org/legacy/ dist/*

.PHONY: tag
tag:
ifeq (,$(shell git tag --list | grep "${version}"))
git tag "v${version}"
@git tag "v${version}"
endif

.PHONY: release
release: tag
ifdef version
curl -XPOST \
@curl -XPOST \
-H "Authorization: token ${GITHUB_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
"https://api.github.com/repos/clarketm/${project}/releases" \
Expand All @@ -51,5 +58,4 @@ endif

.PHONY: upload
publish upload: test clean build check
twine upload dist/*

@twine upload dist/*
15 changes: 14 additions & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ Version |version|

## Installation

Install with the standard [`json`](https://docs.python.org/3/library/json.html) JSON encoder

```bash
$ pip install pprintjson
```

Install with the premier [`simplejson`](https://simplejson.readthedocs.io/en/latest/) JSON encoder
```bash
$ pip install pprintjson[simplejson]
```

## Usage

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

Pretty print JSON from a **stdin** using the `pprintjson` CLI.

```bash
$ echo '{ "a": 1, "b": "string", "c": true }' | pprintjson
```

Pretty print JSON from a **string** using the `pprintjson` CLI.

```bash
Expand Down
Loading

0 comments on commit 199e1ed

Please sign in to comment.