Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.2 #61

Merged
merged 28 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d62159d
Bump pytest-cov from 4.1.0 to 5.0.0
dependabot[bot] May 20, 2024
b77e5d3
Merge pull request #41 from investigativedata/dependabot/pip/develop/…
simonwoerpel May 20, 2024
0e15434
💚 (docker) upsi
simonwoerpel May 20, 2024
e9fb650
Bump flake8 from 6.1.0 to 7.0.0
dependabot[bot] May 20, 2024
bcbacd0
Merge pull request #34 from investigativedata/dependabot/pip/develop/…
simonwoerpel May 20, 2024
0c0688c
Bump black from 23.12.1 to 24.4.2
dependabot[bot] May 20, 2024
a5a962c
Merge pull request #40 from investigativedata/dependabot/pip/develop/…
simonwoerpel May 20, 2024
0f33682
Bump clickhouse-driver from 0.2.7 to 0.2.8
dependabot[bot] Jun 13, 2024
1f40d29
Bump flake8 from 7.0.0 to 7.1.0
dependabot[bot] Jun 17, 2024
e0ee9c8
Bump docker/build-push-action from 5 to 6
dependabot[bot] Jun 18, 2024
62d6c9c
Bump mypy from 1.10.0 to 1.11.0
dependabot[bot] Jul 22, 2024
8435a18
Bump ftmq from 0.6.5 to 0.6.10
dependabot[bot] Jul 26, 2024
c2eaef3
Bump pytest from 8.2.1 to 8.3.2
dependabot[bot] Jul 26, 2024
2c13d42
Merge pull request #60 from investigativedata/dependabot/pip/develop/…
simonwoerpel Jul 27, 2024
b2f3219
Merge pull request #59 from investigativedata/dependabot/pip/develop/…
simonwoerpel Jul 27, 2024
2567e1b
Merge pull request #57 from investigativedata/dependabot/pip/develop/…
simonwoerpel Jul 27, 2024
ebf2d68
Merge pull request #50 from investigativedata/dependabot/github_actio…
simonwoerpel Jul 27, 2024
e312a06
Merge pull request #48 from investigativedata/dependabot/pip/develop/…
simonwoerpel Jul 27, 2024
a4a40d2
Merge pull request #47 from investigativedata/dependabot/pip/develop/…
simonwoerpel Jul 27, 2024
2ac23d3
Merge branch 'main' into develop
simonwoerpel Jul 27, 2024
a806a76
⬆️ Upgrade dependencies
simonwoerpel Jul 27, 2024
be2059e
🚧 Fix store initialization, cleanup cli
simonwoerpel Jul 27, 2024
0488c19
👷 (github/python) Add py3.12 tests
simonwoerpel Jul 27, 2024
e7427b9
👷 Add arm64 build
simonwoerpel Jul 27, 2024
0d974c8
⬆️ ftmq v0.6.12
simonwoerpel Jul 27, 2024
c400676
🧪 (tests/cli) Sync after write
simonwoerpel Jul 27, 2024
85d70c2
📌
simonwoerpel Jul 27, 2024
b8997f4
🔖 Bump version: 0.3.1 → 0.3.2
simonwoerpel Jul 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.1
current_version = 0.3.2
commit = True
tag = True
message = 🔖 Bump version: {current_version} → {new_version}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push release
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# python-version: ["3.11", "3.12"]
python-version: ["3.11"]
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -79,6 +78,5 @@ jobs:
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
# carryforward: "run-3.11,run-3.12"
carryforward: "run-3.11"
carryforward: "run-3.11,run-3.12"
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:
exclude: (test_[\w]+\.py)$

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
exclude: (test_[\w]+\.py|\.csv|\.i?jsonl?|\.lock)$
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ghcr.io/investigativedata/ftm-docker:main
FROM ghcr.io/investigativedata/ftmq:main

RUN apt-get update && apt-get -y upgrade && && apt-get -y autoremove && apt-get clean
RUN apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get clean

COPY ftm_columnstore /app/ftm_columnstore
COPY setup.py /app/setup.py
Expand All @@ -11,5 +11,3 @@ COPY VERSION /app/VERSION
WORKDIR /app
RUN pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir .

ENTRYPOINT ["ftmcs"]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.3.2
8 changes: 5 additions & 3 deletions ftm_columnstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
import warnings

import nomenklatura.settings
import numpy as np

from ftm_columnstore.engine import get_engine
from ftm_columnstore.store import get_store

# import numpy as np


# shut up
logging.getLogger("clickhouse_driver.columns.service").setLevel(logging.ERROR)
logging.getLogger("numpy.core.fromnumeric").setLevel(logging.ERROR)
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
# warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)

# FIXME sqlalchemy monkey patch not working
nomenklatura.settings.DB_URL = "sqlite:///:memory:"

__version__ = "0.3.1"
__version__ = "0.3.2"

__all__ = ["get_engine", "get_store"]
49 changes: 1 addition & 48 deletions ftm_columnstore/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
from typing import Annotated, Optional

import typer
from ftmq.io import smart_read_proxies, smart_write_proxies
from rich import print

from ftm_columnstore import get_engine, get_store, settings
from ftm_columnstore import get_engine, settings

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -34,52 +33,6 @@ def cli_init(
engine.ensure(recreate=recreate, exists_ok=True)


@cli.command("iterate", help="Read entities from the store.")
def cli_iterate(
dataset: Annotated[
Optional[str], typer.Option("-d", help="Dataset to read from")
] = None,
out_uri: Annotated[
str, typer.Option("-o", help="Entities uri (as interpreted by `ftmq`)")
] = "-",
):
"""
Read entities from the store and write json to `-o` (default: stdout)
"""
store = get_store(dataset=dataset)
smart_write_proxies(out_uri, store.iterate(dataset), serialize=True)


@cli.command("write", help="Write entity fragments to the store.")
def cli_write(
in_uri: Annotated[
str, typer.Option("-i", help="Entities uri (as read by `ftmq`)")
] = "-",
dataset: Annotated[
Optional[str], typer.Option("-d", help="Dataset to write to")
] = None,
optimize: Annotated[
Optional[bool],
typer.Option(
..., help="Optimize after import (don't do that when writing parallel)"
),
] = False,
):
"""
Write json entities from `infile` to store.
"""
store = get_store(dataset=dataset)
with store.writer() as bulk:
for ix, proxy in enumerate(smart_read_proxies(in_uri)):
bulk.add_entity(proxy)
if ix and ix % 10_000 == 0:
print("Write entity `%d` ..." % ix)

if optimize:
engine = get_engine()
engine.optimize()


@cli.command("optimize")
def cli_optimize(
full: Annotated[
Expand Down
7 changes: 3 additions & 4 deletions ftm_columnstore/settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import os

VERSION = "0.3.1"
VERSION = "0.3.2"


def get_env(name, default=None):
def get_env(name, default):
value = os.environ.get(name)
if value is not None:
return str(value)
if default is not None:
return str(default)
return str(default)


DATABASE_URI = get_env("DATABASE_URI", "clickhouse://localhost/default")
Expand Down
10 changes: 5 additions & 5 deletions ftm_columnstore/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class BaseClickhouseStore(nk.SQLStore):
def __init__(
self,
dataset: DS,
resolver: Resolver[CE],
linker: Resolver[CE],
uri: str | None = None,
):
super().__init__(dataset, resolver)
super().__init__(dataset, linker)
self.metadata = MetaData()
self.table = make_statement_table(self.metadata)
self.engine = get_engine(uri)
Expand Down Expand Up @@ -73,12 +73,12 @@ def pop(self, entity_id: str) -> list[Statement]:

@cache
def get_store(
uri: str | None = None,
catalog: C | None = None,
dataset: Dataset | str | None = None,
resolver: Resolver | str | None = None,
uri: str | None = None,
linker: Resolver | str | None = None,
) -> ClickhouseStore:
get_metadata.cache_clear()
if isinstance(dataset, str):
dataset = Dataset(name=dataset)
return ClickhouseStore(catalog, dataset, uri=uri, resolver=resolver)
return ClickhouseStore(catalog, dataset, uri=uri, linker=linker)
Loading
Loading