From 45116be3754b979b71a529ee07c64b1a30a16ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rpel?= Date: Fri, 26 Jul 2024 15:59:20 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20anystore=200.1.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 9 +++++---- pyproject.toml | 2 +- requirements.txt | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index 7b480d2..6a6eeb2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -198,13 +198,13 @@ files = [ [[package]] name = "anystore" -version = "0.1.7" +version = "0.1.8" description = "Store and cache things anywhere" optional = false python-versions = "<4,>=3.11" files = [ - {file = "anystore-0.1.7-py3-none-any.whl", hash = "sha256:42fc5724e3aecfabc8a487ada0502162aad72a3a7be1d55b97b3b2bc7c364865"}, - {file = "anystore-0.1.7.tar.gz", hash = "sha256:a5468a40f359d518e584f8b491ff3e5bdcdfdb27876508af89d1b1012d2f54c8"}, + {file = "anystore-0.1.8-py3-none-any.whl", hash = "sha256:a4c794e06fb19192f9ab3755b516bbb96209c0f7970664cf58ef78c53c4ba2d3"}, + {file = "anystore-0.1.8.tar.gz", hash = "sha256:418735305d24ef2351dadf80e8c4f96833736c0761aebe93664e6e336219510c"}, ] [package.dependencies] @@ -221,6 +221,7 @@ pydantic-settings = ">=2.2.1,<3.0.0" pytest = ">=8.0.2,<9.0.0" rich = ">=13.7.0,<14.0.0" s3fs = ">2023.10,<2025" +structlog = ">=24.4.0,<25.0.0" typer = ">=0.9,<0.13" [[package]] @@ -3832,4 +3833,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.11,<4" -content-hash = "4d74408d22561d4e1d53b5b84489f6b495e9f4f22c2858426e32fcb620cd07f3" +content-hash = "11c4806025cbdebe9394c080cc10b4107973e582746947ea58b42aa6acbee4ab" diff --git a/pyproject.toml b/pyproject.toml index 5fc36d2..c3a9518 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ alephclient = "^2.4.1" pycountry = ">=23.12.11,<25.0.0" urllib3 = "<3" nomenklatura = "^3.12.5" -anystore = "^0.1.7" +anystore = "^0.1.8" pantomime = "^0.6.1" structlog = "^24.4.0" diff --git a/requirements.txt b/requirements.txt index 72daf16..7684b4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -93,9 +93,9 @@ alephclient==2.4.1 ; python_version >= "3.11" and python_version < "4" \ annotated-types==0.7.0 ; python_version >= "3.11" and python_version < "4" \ --hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \ --hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89 -anystore==0.1.7 ; python_version >= "3.11" and python_version < "4" \ - --hash=sha256:42fc5724e3aecfabc8a487ada0502162aad72a3a7be1d55b97b3b2bc7c364865 \ - --hash=sha256:a5468a40f359d518e584f8b491ff3e5bdcdfdb27876508af89d1b1012d2f54c8 +anystore==0.1.8 ; python_version >= "3.11" and python_version < "4" \ + --hash=sha256:418735305d24ef2351dadf80e8c4f96833736c0761aebe93664e6e336219510c \ + --hash=sha256:a4c794e06fb19192f9ab3755b516bbb96209c0f7970664cf58ef78c53c4ba2d3 asttokens==2.4.1 ; python_version >= "3.11" and python_version < "4" \ --hash=sha256:051ed49c3dcae8913ea7cd08e46a606dba30b79993209636c4875bc1d637bc24 \ --hash=sha256:b03869718ba9a6eb027e134bfdf69f38a236d681c83c160d510768af11254ba0 From cc28ed244c43bb6930bfc69132c11d6a5f1de90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rpel?= Date: Fri, 26 Jul 2024 15:59:49 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=8A=20Log=20everything=20to=20stde?= =?UTF-8?q?rr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftmq/cli.py | 6 ++---- ftmq/logging.py | 4 ++-- tests/test_cli.py | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ftmq/cli.py b/ftmq/cli.py index 68bcd2e..2042dd8 100644 --- a/ftmq/cli.py +++ b/ftmq/cli.py @@ -1,5 +1,3 @@ -import logging - import click import orjson from anystore.io import smart_write @@ -8,7 +6,7 @@ from ftmq.aggregate import aggregate from ftmq.io import apply_datasets, smart_read_proxies, smart_write_proxies -from ftmq.logging import get_logger +from ftmq.logging import configure_logging, get_logger from ftmq.model.coverage import Collector from ftmq.model.dataset import Catalog, Dataset from ftmq.query import Query @@ -20,7 +18,7 @@ @click.group(cls=DefaultGroup, default="q", default_if_no_args=True) def cli() -> None: - logging.basicConfig(level=logging.INFO) + configure_logging() @cli.command( diff --git a/ftmq/logging.py b/ftmq/logging.py index 8fd78cd..fc38cf5 100644 --- a/ftmq/logging.py +++ b/ftmq/logging.py @@ -72,8 +72,8 @@ def configure_logging(level: int = logging.INFO) -> None: logger_factory=LoggerFactory(), ) - # handler for low level logs that should be sent to STDOUT - out_handler = logging.StreamHandler(sys.stdout) + # handler for low level logs that should be sent to STDERR + out_handler = logging.StreamHandler(sys.stderr) out_handler.setLevel(level) out_handler.addFilter(_MaxLevelFilter(logging.WARNING)) out_handler.setFormatter(formatter) diff --git a/tests/test_cli.py b/tests/test_cli.py index db79a85..1f04297 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -221,11 +221,11 @@ def test_cli_generate(fixtures_path: Path): # dataset uri = str(fixtures_path / "dataset.yml") res = runner.invoke(cli, ["dataset", "generate", "-i", uri]) - res = orjson.loads(res.output) + res = orjson.loads(res.stdout.split("\n")[-1]) # FIXME logging assert Dataset(**res) # catalog uri = str(fixtures_path / "catalog.yml") res = runner.invoke(cli, ["catalog", "generate", "-i", uri]) - res = orjson.loads(res.output) + res = orjson.loads(res.stdout.split("\n")[-1]) # FIXME logging assert Catalog(**res) From 145bddefc4b970c28c26cb5910c18413e4a3e319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rpel?= Date: Fri, 26 Jul 2024 16:09:37 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=8A=20Obtain=20logging=20settings?= =?UTF-8?q?=20from=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftmq/logging.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ftmq/logging.py b/ftmq/logging.py index fc38cf5..028d424 100644 --- a/ftmq/logging.py +++ b/ftmq/logging.py @@ -1,9 +1,11 @@ import logging +import os import sys from logging import Filter, LogRecord from typing import Any, Dict, List import structlog +from banal import as_bool from structlog.contextvars import merge_contextvars from structlog.dev import ConsoleRenderer, set_exc_info from structlog.processors import ( @@ -21,8 +23,8 @@ ) from structlog.stdlib import get_logger as get_raw_logger -LOG_JSON = False -LOG_LEVEL = logging.INFO +LOG_JSON = as_bool(os.environ.get("LOG_JSON")) +LOG_LEVEL = os.environ.get("LOG_LEVEL", "info").upper() def get_logger(name: str, *args, **kwargs) -> BoundLogger: From e95c10a4137885b75aa6b7d44ee37265041f389c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rpel?= Date: Fri, 26 Jul 2024 16:10:34 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=96=20Bump=20version:=200.6.10=20?= =?UTF-8?q?=E2=86=92=200.6.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- VERSION | 2 +- ftmq/__init__.py | 2 +- package.json | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2a465b2..c003b05 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.6.10 +current_version = 0.6.11 commit = True tag = True message = 🔖 Bump version: {current_version} → {new_version} diff --git a/VERSION b/VERSION index 04e84f8..45a346d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.10 +0.6.11 diff --git a/ftmq/__init__.py b/ftmq/__init__.py index 077b52f..49bcc8f 100644 --- a/ftmq/__init__.py +++ b/ftmq/__init__.py @@ -1,4 +1,4 @@ from ftmq.query import Query -__version__ = "0.6.10" +__version__ = "0.6.11" __all__ = ["Query"] diff --git a/package.json b/package.json index 5037e9d..a801aef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@investigativedata/ftmq", - "version": "0.6.10", + "version": "0.6.11", "description": "javascript interface for ftmq", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/pyproject.toml b/pyproject.toml index c3a9518..34029f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ftmq" -version = "0.6.10" +version = "0.6.11" description = "followthemoney query dsl and io helpers" authors = ["Simon Wörpel "] license = "MIT"