Skip to content

Commit

Permalink
Merge branch 'main' into body-type
Browse files Browse the repository at this point in the history
  • Loading branch information
hemidactylus committed May 23, 2024
2 parents 43f4d7e + 9dea084 commit e585975
Show file tree
Hide file tree
Showing 45 changed files with 2,150 additions and 1,064 deletions.
17 changes: 17 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
v 0.1.7
=======
Add support for multi-column partition/clustering keys

v 0.1.6
=======
Support for index analyzers (#142)
Support for awaitable vector dimension in vector mixin (#156)
User-supplied options to vector index (for choice of similarity) (#148)
Add cloud_kwargs to `cassio.init()` for timeout with /metadata (#152)
repo housekeeping:
mixins refactored into separate modules
use poetry
strict mypy
testcontainers-based Cassandra tests
dependabot for GHA job versions

v 0.1.5
=======
Add asyncio's a* methods to the table interface:
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
SHELL := /bin/bash

.PHONY: all format format-tests format-src test-all test-unit test-integration test-astra-integration test-cassandra-integration build help
.PHONY: all format format-fix format-tests format-src test-all test-unit test-integration test-astra-integration test-cassandra-integration build help

all: help

format: format-tests format-src
FMT_FLAGS ?= --check

format: format-src format-tests

format-tests:
poetry run ruff tests
poetry run black tests --check
poetry run isort tests $(FMT_FLAGS) --profile black
poetry run black tests $(FMT_FLAGS)
poetry run mypy tests

format-src:
poetry run ruff src
poetry run black src --check
poetry run isort src $(FMT_FLAGS) --profile black
poetry run black src $(FMT_FLAGS)
poetry run mypy src

format-fix: FMT_FLAGS=
format-fix: format-src format-tests

test-all: test-unit test-integration

test-unit:
Expand All @@ -34,7 +41,7 @@ test-testcontainerscassandra-integration:
TEST_DB_MODE="TESTCONTAINERS_CASSANDRA" poetry run pytest tests/integration -vv

build:
rm dist/*
rm -f dist/cassio*
poetry build

help:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ catch versions-specific issues
- `git tag v<x.y.z>; git push origin v<x.y.z>`

```
rm dist/cassio*
make build
poetry publish # (login to PyPI ...)
```
Expand Down
18 changes: 16 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cassio"
version = "0.1.5"
version = "0.1.7"
description = """A framework-agnostic Python library to seamlessly integrate \
Apache Cassandra(R) with ML/LLM/genAI workloads."""
authors = [
Expand All @@ -15,7 +15,7 @@ keywords = ["cassandra", "ai", "llm", "genai", "astradb"]
homepage = "https://cassio.org"
repository = "https://github.com/CassioML/cassio"
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
Expand Down Expand Up @@ -44,6 +44,7 @@ pytest = "~7.4.3"
types-requests = "^2.31.0.20240311"
testcontainers = "~3.7.1"
python-dotenv = "~1.0.1"
isort = "^5.13.2"

[tool.poetry.scripts]
cassio-create-init-string = "cassio.config.bundle_management:create_init_string_utility"
Expand Down
10 changes: 5 additions & 5 deletions src/cassio/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import tempfile
import shutil
import os
import shutil
import tempfile
from typing import Any, Dict, List, Optional, Union

from cassandra.cluster import Cluster, Session
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster, Session

from cassio.config.bundle_download import download_astra_bundle_url
from cassio.config.bundle_management import (
init_string_to_bundle_path_and_options,
infer_keyspace_from_bundle,
init_string_to_bundle_path_and_options,
)
from cassio.config.bundle_download import download_astra_bundle_url

ASTRA_CLOUD_AUTH_USERNAME = "token"
DOWNLOADED_BUNDLE_FILE_NAME = "secure-connect-bundle_devopsapi.zip"
Expand Down
2 changes: 1 addition & 1 deletion src/cassio/config/bundle_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
token.
"""
import logging
import requests
from typing import Optional

import requests

DEFAULT_GET_BUNDLE_URL_TEMPLATE = (
"https://api.astra.datastax.com/v2/databases/{database_id}/secureBundleURL"
Expand Down
10 changes: 4 additions & 6 deletions src/cassio/config/bundle_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
Facilities to manage the conversion between secure-connect-bundle (plus
additional info) and the "init string".
"""
import base64
import json
import os
from typing import Any, Dict, Optional, Tuple
import tempfile
import shutil
import json
import base64

import tempfile
from typing import Any, Dict, Optional, Tuple
from zipfile import ZipFile


CONFIG_FILE_NAME = "config.json"
USED_CONFIG_KEYS_AND_DEFAULTS = {
"caCertLocation": "./ca.crt",
Expand Down
1 change: 0 additions & 1 deletion src/cassio/db_reader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from cassio.db_reader.multi_table_cassandra_reader import MultiTableCassandraReader


__all__ = [
"MultiTableCassandraReader",
]
9 changes: 4 additions & 5 deletions src/cassio/db_reader/multi_table_cassandra_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,23 @@
from typing import (
Any,
Callable,
cast,
Dict,
Iterable,
Optional,
Set,
Tuple,
TypeVar,
Union,
cast,
)

from cassandra.concurrent import ExecutionResult, execute_concurrent
from cassandra.query import PreparedStatement
from cassandra.concurrent import execute_concurrent, ExecutionResult

from cassio.utils.db_inspection import table_partitionkey
from cassio.config import check_resolve_session, check_resolve_keyspace
from cassio.config import check_resolve_keyspace, check_resolve_session
from cassio.table.cql import SELECT_CQL_TEMPLATE
from cassio.table.table_types import SessionType

from cassio.utils.db_inspection import table_partitionkey

C = TypeVar("C")
ColumnOrFunctionType = Union[str, Callable[[Dict[str, Any]], C]]
Expand Down
2 changes: 1 addition & 1 deletion src/cassio/history/stored_blob_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"""

import uuid
from warnings import warn
from typing import Any, Iterable, Optional
from warnings import warn

from cassandra.cluster import Session

Expand Down
2 changes: 1 addition & 1 deletion src/cassio/keyvalue/k_v_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
One row per partition, serializes a multiple partition key into a string
"""

from typing import Any, Dict, List, Optional, cast
from warnings import warn
from typing import Any, cast, Dict, List, Optional

from cassandra.cluster import Session

Expand Down
41 changes: 30 additions & 11 deletions src/cassio/table/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
from cassio.table.tables import PlainCassandraTable # noqa: F401
from cassio.table.tables import ClusteredCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticMetadataCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticVectorCassandraTable # noqa: F401
from cassio.table.tables import ClusteredMetadataCassandraTable # noqa: F401
from cassio.table.tables import MetadataCassandraTable # noqa: F401
from cassio.table.tables import VectorCassandraTable # noqa: F401
from cassio.table.tables import ClusteredVectorCassandraTable # noqa: F401
from cassio.table.tables import ClusteredMetadataVectorCassandraTable # noqa: F401
from cassio.table.tables import MetadataVectorCassandraTable # noqa: F401
from cassio.table.tables import ClusteredVectorCassandraTable # noqa: F401
from cassio.table.tables import ElasticCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticMetadataCassandraTable # noqa: F401
from cassio.table.tables import ElasticMetadataCassandraTable # noqa: F401
from cassio.table.tables import ElasticMetadataVectorCassandraTable # noqa: F401
from cassio.table.tables import ElasticVectorCassandraTable # noqa: F401
from cassio.table.tables import ClusteredElasticVectorCassandraTable # noqa: F401
from cassio.table.tables import (
ClusteredElasticMetadataVectorCassandraTable, # noqa: F401
from cassio.table.tables import MetadataCassandraTable # noqa: F401
from cassio.table.tables import MetadataVectorCassandraTable # noqa: F401
from cassio.table.tables import PlainCassandraTable # noqa: F401
from cassio.table.tables import VectorCassandraTable # noqa: F401
from cassio.table.tables import ( # noqa: F401
ClusteredElasticMetadataVectorCassandraTable,
)
from cassio.table.tables import ElasticMetadataVectorCassandraTable # noqa: F401

__all__ = [
"PlainCassandraTable",
"ClusteredCassandraTable",
"ClusteredMetadataCassandraTable",
"MetadataCassandraTable",
"VectorCassandraTable",
"ClusteredVectorCassandraTable",
"ClusteredMetadataVectorCassandraTable",
"MetadataVectorCassandraTable",
"ElasticCassandraTable",
"ClusteredElasticCassandraTable",
"ClusteredElasticMetadataCassandraTable",
"ElasticMetadataCassandraTable",
"ElasticVectorCassandraTable",
"ClusteredElasticVectorCassandraTable",
"ClusteredElasticMetadataVectorCassandraTable",
"ElasticMetadataVectorCassandraTable",
]
Loading

0 comments on commit e585975

Please sign in to comment.