Skip to content

Commit

Permalink
updated makefile, setup.py, github actions:
Browse files Browse the repository at this point in the history
* makefile depends on its own venv for each target
* dev-requirements moved to requirements-dev.txt
  • Loading branch information
venthur committed Jun 29, 2021
1 parent 21977c3 commit 526c6cd
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 54 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .['dev']
- name: Run linter
run: |
make lint
Expand Down
50 changes: 39 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
# system python interpreter. used only to create virtual environment
PY = python3
VENV = venv
BIN=$(VENV)/bin

DOCS_SRC = docs
DOCS_OUT = $(DOCS_SRC)/_build


ifeq ($(OS), Windows_NT)
BIN=$(VENV)/Scripts
PY=python
endif


all: lint test

test:
pytest
$(VENV): requirements-dev.txt setup.py
$(PY) -m venv $(VENV)
$(BIN)/pip install --upgrade -r requirements-dev.txt
$(BIN)/pip install -e .
touch $(VENV)

.PHONY: test
test: $(VENV)
$(BIN)/pytest

lint:
flake8 gron
.PHONY: lint
lint: $(VENV)
$(BIN)/flake8

docs:
$(MAKE) -C docs html
.PHONY: docs

release:
python3 setup.py sdist bdist_wheel upload
.PHONY: release
release: $(VENV)
rm -rf dist
$(BIN)/python setup.py sdist bdist_wheel
$(BIN)/twine upload dist/*

.PHONY: docs
docs: $(VENV)
$(BIN)/sphinx-build $(DOCS_SRC) $(DOCS_OUT)

.PHONY: clean
clean:
rm -rf build dist *.egg-info
rm -rf $(VENV)
rm -rf $(DOCS_OUT)
find . -type f -name *.pyc -delete
find . -type d -name __pycache__ -delete
.PHONY: clean
# coverage
rm -rf htmlcov .coverage
6 changes: 6 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sphinx==4.0.1
twine==3.4.1
wheel==0.36.2
pytest==6.2.4
pytest-cov==2.12.1
flake8==3.9.2
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
addopts =
--cov=gron
--cov=tests
--cov-branch
--cov-report=html
--cov-report=term-missing:skip-covered

[flake8]
exclude = venv,build
exclude = venv,build,docs
58 changes: 29 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
exec(open('./gron/version.py').read(), meta)
meta['long_description'] = open('./README.md').read()

setup(name='gron',
version=meta['__VERSION__'],
description='Python library to grep JSON.',
long_description=meta['long_description'],
long_description_content_type='text/markdown',
keywords='gron json cli',
author='Bastian Venthur',
author_email='mail@venthur.de',
url='https://github.com/venthur/python-gron',
python_requires='>=3',
extras_require={
'dev': [
'pytest',
'pytest-cov',
'flake8',
setup(
name='gron',
version=meta['__VERSION__'],
description='Python library to grep JSON.',
long_description=meta['long_description'],
long_description_content_type='text/markdown',
keywords='gron json cli',
author='Bastian Venthur',
author_email='mail@venthur.de',
url='https://github.com/venthur/python-gron',
project_urls={
'Documentation': 'https://gron.readthedocs.io/',
'Source': 'https://github.com/venthur/gron',
'Changelog':
'https://github.com/venthur/gron/blob/master/CHANGELOG.md',
},
python_requires='>=3',
packages=['gron'],
entry_points={
'console_scripts': [
'gron = gron.__main__:main'
]
},
packages=['gron'],
entry_points={
'console_scripts': [
'gron = gron.__main__:main'
]
},
license='MIT',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
},
license='MIT',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
)
14 changes: 7 additions & 7 deletions tests/unit/test_gron.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def test_github_data():
assert out == OUT

# not implemented yet
#def test_stream():
# with open('./tests/data/stream.json', 'r') as fh:
# IN = fh.read().strip()
# with open('./tests/data/stream.gron', 'r') as fh:
# OUT = fh.read().strip()
# out = gron(IN)
# assert out == OUT
# def test_stream():
# with open('./tests/data/stream.json', 'r') as fh:
# IN = fh.read().strip()
# with open('./tests/data/stream.gron', 'r') as fh:
# OUT = fh.read().strip()
# out = gron(IN)
# assert out == OUT


def test_one():
Expand Down

0 comments on commit 526c6cd

Please sign in to comment.