Skip to content

Commit 88a43cf

Browse files
committed
chore: update makefile and others
1 parent 44f6777 commit 88a43cf

File tree

4 files changed

+66
-23
lines changed

4 files changed

+66
-23
lines changed

.gitignore

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.vscode/
2+
.idea/
3+
4+
### Python template
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]
@@ -20,7 +24,6 @@ parts/
2024
sdist/
2125
var/
2226
wheels/
23-
pip-wheel-metadata/
2427
share/python-wheels/
2528
*.egg-info/
2629
.installed.cfg
@@ -50,6 +53,7 @@ coverage.xml
5053
*.py,cover
5154
.hypothesis/
5255
.pytest_cache/
56+
cover/
5357

5458
# Translations
5559
*.mo
@@ -72,6 +76,7 @@ instance/
7276
docs/_build/
7377

7478
# PyBuilder
79+
.pybuilder/
7580
target/
7681

7782
# Jupyter Notebook
@@ -82,7 +87,9 @@ profile_default/
8287
ipython_config.py
8388

8489
# pyenv
85-
.python-version
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
8693

8794
# pipenv
8895
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -127,6 +134,9 @@ dmypy.json
127134

128135
# Pyre type checker
129136
.pyre/
130-
.vscode
131137

132-
tmp.py
138+
# pytype static type analyzer
139+
.pytype/
140+
141+
# Cython debug symbols
142+
cython_debug/

Makefile

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,58 @@
1-
.PHONY: test install
1+
# project metadata
2+
NAME := `python setup.py --name`
3+
FULLNAME := `python setup.py --fullname`
4+
VERSION := `python setup.py --version`
5+
BUILD := `git rev-parse --short HEAD`
26

3-
install:
4-
pip install . --no-index
7+
.PHONY: info help clean dist docs
8+
.DEFAULT_GOAL := help
59

6-
uninstall:
7-
pip uninstall jsonpath
10+
define PRINT_HELP_PYSCRIPT
11+
import re, sys
812

9-
test:
10-
pytest test -vv -s
13+
for line in sys.stdin:
14+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
15+
if match:
16+
target, help = match.groups()
17+
print("%-20s %s" % (target, help))
18+
endef
19+
export PRINT_HELP_PYSCRIPT
1120

21+
info: ## project info
22+
@echo $(FULLNAME) at $(BUILD)
1223

13-
PYCACHE_DIR := $(shell find . -name '__pycache__' -type d)
14-
PYTEST_DIR := $(shell find . -name '.pytest_cache' -type d)
15-
EGG_DIR := $(shell find . -name '*.egg-info' -type d)
24+
help:
25+
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
1626

17-
clean:
18-
rm -rf $(PYCACHE_DIR) ${PYTEST_DIR} ${EGG_DIR} dist
27+
clean: clean-build clean-pyc ## remove all build, test, coverage and Python artifacts
1928

20-
package: clean
29+
clean-build: ## remove build artifacts
30+
rm -fr build/
31+
rm -fr dist/
32+
rm -fr .eggs/
33+
find . -name '*.egg-info' -exec rm -fr {} +
34+
find . -name '*.egg' -exec rm -f {} +
35+
36+
clean-pyc: ## remove Python file artifacts
37+
find . -name '*.pyc' -exec rm -f {} +
38+
find . -name '*.pyo' -exec rm -f {} +
39+
find . -name '*~' -exec rm -f {} +
40+
find . -name '__pycache__' -exec rm -fr {} +
41+
42+
lint: ## check style with black
43+
find $(NAME) -name '*.py' -type f -not -path "*/pb/*" -not -path "*/data/*" -exec black {} +
44+
45+
docs: ## format docs
46+
doctoc --gitlab README.md
47+
48+
install: ## install the package to the active Python's site-packages
49+
pip install . -U --no-index
50+
51+
uninstall: ## uninstall the package
52+
pip uninstall $(NAME)
53+
54+
dist: clean ## package
2155
python3 setup.py sdist bdist_wheel
2256

23-
upload: package
57+
upload: dist # upload the package to pypi
2458
twine upload dist/*

jsonpath/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Author : zhangxianbing
33
Date : 2020-12-27 09:22:14
44
LastEditors : zhangxianbing
5-
LastEditTime : 2021-03-02 20:01:19
5+
LastEditTime : 2021-06-04 09:07:14
66
Description : JSONPath
77
"""
88
__version__ = "1.0.5"
@@ -16,8 +16,6 @@
1616
from collections import defaultdict
1717
from typing import Union
1818

19-
# pylint: disable=invalid-name,missing-function-docstring,missing-class-docstring,eval-used,logging-fstring-interpolation
20-
2119

2220
def create_logger(name: str = None, level: Union[int, str] = logging.INFO):
2321
"""Get or create a logger used for local debug."""

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
url="https://github.com/zhangxianbing/jsonpath-python",
1515
packages=find_packages(include=["jsonpath*"]),
1616
classifiers=[
17-
"Programming Language :: Python :: 3.6",
17+
"Development Status :: 3 - Alpha",
18+
"Intended Audience :: Developers",
1819
"License :: OSI Approved :: MIT License",
19-
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3.6",
2021
],
2122
python_requires=">=3.6",
2223
)

0 commit comments

Comments
 (0)