From 7d8419728b8621da321d156f61d4400468230b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 08:55:30 +0100 Subject: [PATCH 1/6] Refine make tasks --- Makefile | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6e0a5b6..839e52b 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,19 @@ -setup: venv +PYTHON_VERSION ?= 3.9 dist: clean-dist venv . venv/bin/activate && python3 -m build . -venv: dev-requirements.txt +.PHONY: setup +setup: venv/setup.txt + +venv: virtualenv venv --python=${PYTHON_VERSION} + +venv/setup.txt: venv dev-requirements.txt . venv/bin/activate && \ pip3 install --upgrade pip && \ - pip3 install \ - --requirement dev-requirements.txt + pip3 install --requirement dev-requirements.txt + touch venv/setup.txt .PHONY: clean clean: clean-dist @@ -21,13 +26,21 @@ clean-dist: rm -rf dist .PHONY: test -test: venv +test: setup @ . venv/bin/activate && PYTHONPATH=src/ pytest -vv -rsx tests/ src/ --cov ./src/json_normalize/ --no-cov-on-fail --cov-report term-missing --doctest-modules --doctest-continue-on-failure @ . venv/bin/activate && flake8 src --exclude '#*,~*,.#*' @ . venv/bin/activate && black --check src/ tests/ .PHONY: test-focus -test-focus: venv +test-focus: setup @ . venv/bin/activate && PYTHONPATH=src/ pytest -vv -m focus -rsx tests/ src/ --cov ./src/json_normalize/ --no-cov-on-fail --cov-report term-missing --doctest-modules --doctest-continue-on-failure @ . venv/bin/activate && flake8 src --exclude '#*,~*,.#*' @ . venv/bin/activate && black --check src/ tests/ + +.PHONY: release +release: test dist + . venv/bin/activate && twine upload dist/* + +.PHONY: test-release +test-release: test dist + . venv/bin/activate && twine upload -r testpypi dist/* From 8bd7cc270c03b98554cc0114cca202dba08401f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 08:59:41 +0100 Subject: [PATCH 2/6] Fix __all__ to contain strings For reference, see https://docs.python.org/3/tutorial/modules.html#importing-from-a-package --- src/json_normalize/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json_normalize/__init__.py b/src/json_normalize/__init__.py index 74b2bba..4fb0eb8 100644 --- a/src/json_normalize/__init__.py +++ b/src/json_normalize/__init__.py @@ -2,8 +2,8 @@ from .key_joiners import last_node_name __all__ = [ - json_normalize, - last_node_name, + "json_normalize", + "last_node_name", ] __version__ = "1.0.1" From 0f76c60aff2365b0e2a3297cc7f497a0c56d54ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 09:00:59 +0100 Subject: [PATCH 3/6] Bump version to 1.1.0 --- src/json_normalize/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json_normalize/__init__.py b/src/json_normalize/__init__.py index 4fb0eb8..288b553 100644 --- a/src/json_normalize/__init__.py +++ b/src/json_normalize/__init__.py @@ -6,6 +6,6 @@ "last_node_name", ] -__version__ = "1.0.1" +__version__ = "1.1.0" VERSION = __version__ From 363cc633b1efe9a698e324a773c053108b749138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 09:03:07 +0100 Subject: [PATCH 4/6] Update README with installation instructions --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 73d051e..a13dcc9 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ This package contains a function, json_normalize. It will take a json-like struc Data association will flows up and down inside dicts although in iterables, e.g. lists, data +## Installation + +Install the package `json_normalize` version `1.1+` from PyPI. +The recommended `requirements.txt` line is `json_normalize~=1.1`. + ## json_normalize.json_normalize ```python From e7cd6f51fb0c57b5ebf2bfb8bbebaa6aa989d969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 09:03:24 +0100 Subject: [PATCH 5/6] Bump copyright year range --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 07ed3cb..6dee7ee 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Funnel +Copyright (c) 2021-2024 Funnel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 370f3342a818e59176158f914032c3ce284e4632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Frid=C3=A9n?= Date: Thu, 28 Mar 2024 10:16:04 +0100 Subject: [PATCH 6/6] Update GitHub test action --- .github/workflows/test.yml | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28f0ed9..8ac93c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,10 @@ name: test -on: +on: push: - workflow_dispatch: + branches: [ master ] + pull_request: + branches: [ master ] jobs: build: @@ -11,14 +13,23 @@ jobs: fail-fast: false matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - steps: - - uses: actions/checkout@v4 - - - name: install virtual env - run: | - pip install virtualenv - - - name: make test - run: | - make test + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics + - name: Test with pytest + run: | + PYTHONPATH=src/ pytest --doctest-modules --doctest-continue-on-failure