From 5a2b5f868af616bdfa73fa1c12bacc1c03e349f2 Mon Sep 17 00:00:00 2001 From: Ashley Sommer Date: Fri, 25 Oct 2024 21:42:11 +1000 Subject: [PATCH] Quick logging fix for v0.28.1 release --- CHANGELOG.md | 8 +++++++- CITATION.cff | 4 ++-- Dockerfile | 4 ++-- pyproject.toml | 4 ++-- pyshacl/__init__.py | 2 +- pyshacl/entrypoints.py | 9 +++++---- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b5cfa..284a992 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Python PEP 440 Versioning](https://www.python.org/d ## [Unreleased] - Nothing yet +## [0.28.1] - 2024-10-25 + +### Fixed +- PySHACL no longer overwrites the Python `root` logger and removes all its handlers. How Rude. + ## [0.28.0] - 2024-10-23 ### Added - owl:imports now works with bnode values, where it contains the following: @@ -1177,7 +1182,8 @@ just leaves the files open. Now it is up to the command-line client to close the - Initial version, limited functionality -[Unreleased]: https://github.com/RDFLib/pySHACL/compare/v0.28.0...HEAD +[Unreleased]: https://github.com/RDFLib/pySHACL/compare/v0.28.1...HEAD +[0.28.1]: https://github.com/RDFLib/pySHACL/compare/v0.28.0...v0.28.1 [0.28.0]: https://github.com/RDFLib/pySHACL/compare/v0.27.0...v0.28.0 [0.27.0]: https://github.com/RDFLib/pySHACL/compare/v0.26.0...v0.27.0 [0.26.0]: https://github.com/RDFLib/pySHACL/compare/v0.25.0...v0.26.0 diff --git a/CITATION.cff b/CITATION.cff index 5523fd4..0834b01 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,8 +8,8 @@ authors: given-names: "Nicholas" orcid: "http://orcid.org/0000-0002-8742-7730" title: "pySHACL" -version: 0.28.0 +version: 0.28.1 doi: 10.5281/zenodo.4750840 license: Apache-2.0 -date-released: 2022-01-13 +date-released: 2024-10-25 url: "https://github.com/RDFLib/pySHACL" diff --git a/Dockerfile b/Dockerfile index 468e24c..077beb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,12 @@ WORKDIR /home/pyshacl RUN addgroup -g 1000 -S pyshacl &&\ adduser --disabled-password --gecos "" --home "$(pwd)" --ingroup "pyshacl" --no-create-home --uid 1000 pyshacl WORKDIR /app -LABEL org.opencontainers.image.version="0.28.0" +LABEL org.opencontainers.image.version="0.28.1" COPY . . RUN chown -R pyshacl:pyshacl /home/pyshacl /app && chmod -R 775 /home/pyshacl /app USER pyshacl ENV PATH="/home/pyshacl/.local/bin:$PATH" -RUN pip3 install "poetry>=1.8.3,<2.0" +RUN pip3 install "poetry>=1.8.4,<2.0" RUN poetry install --no-dev --extras "js http" USER root RUN apk del build-dependencies diff --git a/pyproject.toml b/pyproject.toml index fa85b9e..463c762 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ requires-python = ">=3.8.1" [tool.poetry] name = "pyshacl" -version = "0.28.0" +version = "0.28.1" # Don't forget to change the version number in __init__.py, Dockerfile, and CITATION.cff along with this one description = "Python SHACL Validator" license = "Apache-2.0" @@ -211,7 +211,7 @@ toxworkdir={env:TOX_WORK_DIR:.tox} [testenv] deps = - poetry>=1.8.2 + poetry>=1.8.4 passenv = DBUS_SESSION_BUS_ADDRESS PIP_KEYRING_PROVIDER diff --git a/pyshacl/__init__.py b/pyshacl/__init__.py index 5da9891..6564870 100644 --- a/pyshacl/__init__.py +++ b/pyshacl/__init__.py @@ -7,7 +7,7 @@ from .validator import Validator # version compliant with https://www.python.org/dev/peps/pep-0440/ -__version__ = '0.28.0' +__version__ = '0.28.1' # Don't forget to change the version number in pyproject.toml, Dockerfile, and CITATION.cff along with this one __all__ = ['validate', 'shacl_rules', 'Validator', 'RuleExpandRunner', '__version__', 'Shape', 'ShapesGraph'] diff --git a/pyshacl/entrypoints.py b/pyshacl/entrypoints.py index bb43222..878940a 100644 --- a/pyshacl/entrypoints.py +++ b/pyshacl/entrypoints.py @@ -227,11 +227,12 @@ def meta_validate(shacl_graph: Union[GraphLike, str], inference: Optional[str] = return validate(shacl_graph, shacl_graph=shacl_shacl_graph, inference=inference, **kwargs) -def make_default_logger(name: Union[str, None] = None, debug: bool = False) -> logging.Logger: +def make_default_logger(name: Union[str, None] = None, debug: bool = False, clear_handlers: bool = True) -> logging.Logger: log_handler = logging.StreamHandler(stderr) - log = logging.getLogger() - for h in log.handlers: - log.removeHandler(h) # pragma:no cover + log = logging.getLogger(name) + if clear_handlers: + for h in log.handlers: + log.removeHandler(h) # pragma:no cover log.addHandler(log_handler) log.setLevel(logging.INFO if not debug else logging.DEBUG) log_handler.setLevel(logging.INFO if not debug else logging.DEBUG)