Skip to content

Commit

Permalink
Merge pull request #85 from wwkimball/development
Browse files Browse the repository at this point in the history
Release 3.1.0
  • Loading branch information
wwkimball authored Oct 18, 2020
2 parents 60bfccf + 9bdc2d4 commit 9b6b7b8
Show file tree
Hide file tree
Showing 23 changed files with 1,183 additions and 184 deletions.
30 changes: 30 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
3.1.0:
Enhancements:
* yaml-set can now delete nodes when using --delete rather than other input
arguments.
* A new command-line tool has been created, yaml-validate, which validates
YAML/JSON/compatible single- and multi-documents (files or STDIN).

Bug Fixes:
* The yaml-merge command-line tool wasn't allowing Scalar values supplied via
STDIN -- with no structure, just bare Scalar values -- to be appended to
exising Array data structures; rather, it was wholly overwriting the
destination, deleting all pre-exisiting elements.
* The yaml-merge command-line tool wasn't accepting empty-strings as STDIN
documents; it was reporting a document-read error, instead. This turns out
to be useful when you want to use yaml-merge instead of yaml-set to
deliberately write an empty-string value at some --mergeat location within
the LHS document.
* The yaml-merge command would not accept any variation of "false" as a Scalar
value input; it was instead reporting a document-read error. This turns out
to be useful when using yaml-merge as if it were yaml-set to write a false
Boolean value to the LHS document at some --mergeat location.

API Changes:
* The func.get_yaml_data and func.get_yaml_multidoc_data functions now
return/yield tuples. The first field is the desired yaml_data (can be None
for empty documents) and the second field is a Boolean which indicates True
when the document loaded with no errors or False when an error occurred.
This is necessary in order to accept a bare "false" Scalar value as a
STDIN-supplied document.

3.0.0:
Enhancements:
* Added a new YAML Path Segment Type: *
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ yaml = get_yaml_editor()
# At this point, you'd load or parse your YAML file, stream, or string. When
# loading from file, I typically follow this pattern:
yaml_data = get_yaml_data(yaml, log, yaml_file)
if yaml_data is None:
(yaml_data, doc_loaded) = get_yaml_data(yaml, log, yaml_file)
if not doc_loaded:
# There was an issue loading the file; an error message has already been
# printed.
exit(1)
Expand Down
45 changes: 37 additions & 8 deletions build-release-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,61 @@
# Clean up old releases
[ -e dist ] && rm -rf dist

# Update pip and install release tools
python3 -m pip install --upgrade pip
pip3 install wheel || exit $?

# Require successful tests
if [ ! -x run-tests.sh ]; then
echo "ERROR: run-tests.sh script must exist and be executable in the present directory!" >&2
exit 2
fi
./run-tests.sh || exit $?

# Create a dedicated virtual Python enviroment for this
envName=venv-build-release-artifacts-$(date +%Y%m%dT%H%M%S)
if [ 0 -ne $? ]; then
echo "ERROR: Unable to identify the build virtual environment! Is date a command?" >&2
exit 3
fi
echo "Building virtual environment for $(python3 --version): ${envName}"
rm -rf "$envName"
python3 -m pip install --upgrade pip
python3 -m venv "$envName" || exit 86
source "$envName"/bin/activate || exit 87

# Update pip and install release tools
echo "Installing release tools..."
pip3 install ruamel.yaml wheel || exit $?

# Build release artifacts
echo "Building release artifacts..."
python3 setup.py sdist bdist_wheel || exit $?

# Generate a ZIP file for Windows users
cd dist || exit 2
echo "Building Windows ZIP file..."
pushd dist || exit 2
relname=$(basename $(ls -1 ./*.tar.gz) .tar.gz)
mkdir win \
&& cp "${relname}.tar.gz" win/ \
&& cd win/ \
&& pushd win/ \
&& tar xvzf ./*.tar.gz \
&& rm -f ./*.gz \
&& zip --recurse-paths --test --verbose "${relname}.zip" "${relname}"/ \
&& mv ./*.zip .. \
&& cd .. \
&& popd \
&& rm -rf win
popd

# Clean up
echo "Cleaning up..."
deactivate
if ! rm -rf "$envName"; then
echo "WARNING: Unable to remove temporary build environment: ${envName}!"
fi
if ! rm -rf build; then
echo "WARNING: Unable to remove build directory!"
fi
if ! rm -rf yamlpath.egg-info; then
echo "WARNING: Unable to remove EGG information directory!"
fi

# Show the final release artifacts
ls -1 ./*
echo -e "\nRelease artifacts:"
ls -1 ./dist/*
3 changes: 1 addition & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[mypy]
python_version = 3.6
warn_return_any = True
warn_unused_configs = True

[mypy-ruamel.yaml.*]
[mypy-ruamel.*]
ignore_missing_imports = True
4 changes: 3 additions & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ EOF
echo "...upgrading pip"
python -m pip install --upgrade pip >/dev/null
echo "...reinstalling ruamel.yaml (because pip upgrades break it)"
pip install --force-reinstall ruamel.yaml==0.15.96 >/dev/null
pip install --force-reinstall ruamel.yaml >/dev/null
echo "...upgrading ruamel.yaml"
pip install --upgrade ruamel.yaml >/dev/null
echo "...upgrading testing tools"
pip install --upgrade mypy pytest pytest-cov pytest-console-scripts \
pylint coveralls pep257 >/dev/null
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
setuptools.setup(
name="yamlpath",
version=YAMLPATH_VERSION,
description="Read and change YAML/Compatible data using powerful, intuitive, command-line friendly syntax",
description=(
"Command-line get/set/merge/scan/convert processors for"
+ " YAML/JSON/Compatible data using powerful, intuitive, command-line"
+ " friendly syntax"),
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
Expand All @@ -24,7 +27,7 @@
author="William W. Kimball, Jr., MBA, MSIS",
author_email="github-yamlpath@kimballstuff.com",
license="ISC",
keywords="yaml eyaml yaml-path",
keywords="yaml eyaml json yaml-path",
packages=setuptools.find_packages(),
entry_points={
"console_scripts": [
Expand All @@ -33,6 +36,7 @@
"yaml-paths = yamlpath.commands.yaml_paths:main",
"yaml-set = yamlpath.commands.yaml_set:main",
"yaml-merge = yamlpath.commands.yaml_merge:main",
"yaml-validate = yamlpath.commands.yaml_validate:main",
]
},
python_requires=">3.6.0",
Expand Down
Loading

0 comments on commit 9b6b7b8

Please sign in to comment.