Skip to content

Commit 09d3722

Browse files
authored
Bulk DOcs (#10)
1 parent 9984318 commit 09d3722

File tree

10 files changed

+110
-25
lines changed

10 files changed

+110
-25
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ Your PR description should include:
114114

115115
For detailed development instructions, see our [Developer Documentation](developerdocs/).
116116

117+
This is a monorepo containing two packages:
118+
- **async-cassandra** - The main async wrapper library (in `libs/async-cassandra/`)
119+
- **async-cassandra-bulk** - Bulk operations extension (in `libs/async-cassandra-bulk/`)
120+
117121
Here's how to set up `async-python-cassandra-client` for local development:
118122

119123
1. Fork the `async-python-cassandra-client` repo on GitHub.
@@ -127,6 +131,13 @@ Here's how to set up `async-python-cassandra-client` for local development:
127131
cd async-python-cassandra-client/
128132
python -m venv venv
129133
source venv/bin/activate # On Windows use `venv\Scripts\activate`
134+
135+
# Install the main library
136+
cd libs/async-cassandra
137+
pip install -e ".[dev,test]"
138+
139+
# Optionally install the bulk operations library
140+
cd ../async-cassandra-bulk
130141
pip install -e ".[dev,test]"
131142
```
132143

@@ -139,13 +150,16 @@ Here's how to set up `async-python-cassandra-client` for local development:
139150

140151
6. When you're done making changes, check that your changes pass the tests:
141152
```bash
153+
# Navigate to the library you're working on
154+
cd libs/async-cassandra # or libs/async-cassandra-bulk
155+
142156
# Run linting
143157
ruff check src tests
144158
black --check src tests
145159
isort --check-only src tests
146160
mypy src
147161

148-
# Run tests
162+
# Run tests (from the library directory)
149163
make test-unit # Unit tests only (no Cassandra needed)
150164
make test-integration # Integration tests (starts Cassandra automatically)
151165
make test # All tests except stress tests
@@ -177,6 +191,9 @@ Before you submit a pull request, check that it meets these guidelines:
177191
### Running Tests Locally
178192

179193
```bash
194+
# Navigate to the library you want to test
195+
cd libs/async-cassandra # or libs/async-cassandra-bulk
196+
180197
# Install test dependencies
181198
pip install -e ".[test]"
182199

@@ -190,14 +207,15 @@ make test-integration
190207
pytest tests/unit/test_session.py -v
191208

192209
# Run with coverage
193-
pytest --cov=src/async_cassandra --cov-report=html
210+
pytest --cov=async_cassandra --cov-report=html # or --cov=async_cassandra_bulk
194211
```
195212

196213
### Cassandra Management for Testing
197214

198215
Integration tests require a running Cassandra instance. The test infrastructure handles this automatically:
199216

200217
```bash
218+
# From the library directory (libs/async-cassandra or libs/async-cassandra-bulk)
201219
# Automatically handled by test commands:
202220
make test-integration # Starts Cassandra if needed
203221
make test # Starts Cassandra if needed
@@ -226,6 +244,7 @@ This project uses several tools to maintain code quality and consistency:
226244
Before submitting a PR, ensure your code passes all checks:
227245

228246
```bash
247+
# From the library directory (libs/async-cassandra or libs/async-cassandra-bulk)
229248
# Format code
230249
black src tests
231250
isort src tests

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@
99

1010
> 📢 **Early Release**: This is an early release of async-cassandra. While it has been tested extensively, you may encounter edge cases. We welcome your feedback and contributions! Please report any issues on our [GitHub Issues](https://github.com/axonops/async-python-cassandra-client/issues) page.
1111
12+
## 📦 Repository Structure
13+
14+
This is a monorepo containing two related Python packages:
15+
16+
- **[async-cassandra](libs/async-cassandra/)** - The main async wrapper for the Cassandra Python driver, enabling async/await operations with Cassandra
17+
- **[async-cassandra-bulk](libs/async-cassandra-bulk/)** - (🚧 Active Development) High-performance bulk operations extension for async-cassandra
18+
1219
## 📑 Table of Contents
1320

21+
- [📦 Repository Structure](#-repository-structure)
1422
- [✨ Overview](#-overview)
1523
- [🏗️ Why create this framework?](#️-why-create-this-framework)
1624
- [Understanding Async vs Sync](#understanding-async-vs-sync)
@@ -40,7 +48,7 @@
4048

4149
## ✨ Overview
4250

43-
A Python library that enables the Cassandra driver to work seamlessly with async frameworks like FastAPI, aiohttp, and Quart. It provides an async/await interface that prevents blocking your application's event loop while maintaining full compatibility with the DataStax Python driver.
51+
**async-cassandra** is a Python library that enables the Cassandra driver to work seamlessly with async frameworks like FastAPI, aiohttp, and Quart. It provides an async/await interface that prevents blocking your application's event loop while maintaining full compatibility with the DataStax Python driver.
4452

4553
When using the standard Cassandra driver in async applications, blocking operations can freeze your entire service. This wrapper solves that critical issue by bridging the gap between Cassandra's thread-based I/O and Python's async ecosystem, ensuring your web services remain responsive under load.
4654

@@ -248,14 +256,21 @@ We understand this requirement may be inconvenient for some users, but it allows
248256

249257
## 🔧 Installation
250258

259+
### async-cassandra (Main Library)
260+
251261
```bash
252262
# From PyPI
253263
pip install async-cassandra
254264

255-
# From source
265+
# From source (for development)
266+
cd libs/async-cassandra
256267
pip install -e .
257268
```
258269

270+
### async-cassandra-bulk (Coming Soon)
271+
272+
> 🚧 **In Active Development**: async-cassandra-bulk is currently under development and not yet available on PyPI. It will provide high-performance bulk operations for async-cassandra.
273+
259274
## 📚 Quick Start
260275

261276
```python
@@ -313,16 +328,21 @@ We welcome contributions! Please see:
313328
- [Metrics and Monitoring](docs/metrics-monitoring.md) - Track performance and health
314329

315330
### Examples
316-
- [FastAPI Integration](examples/fastapi_app/README.md) - Complete REST API example
317-
- [More Examples](examples/) - Additional usage patterns
331+
- [FastAPI Integration](libs/async-cassandra/examples/fastapi_app/README.md) - Complete REST API example
332+
- [More Examples](libs/async-cassandra/examples/) - Additional usage patterns
318333

319334
## 🎯 Running the Examples
320335

321-
The project includes comprehensive examples demonstrating various features and use cases. Each example can be run using the provided Makefile, which automatically handles Cassandra setup if needed.
336+
The async-cassandra library includes comprehensive examples demonstrating various features and use cases. Examples are located in the `libs/async-cassandra/examples/` directory.
322337

323-
### Available Examples
338+
### Running Examples
324339

325-
Run any example with: `make example-<name>`
340+
First, navigate to the async-cassandra directory:
341+
```bash
342+
cd libs/async-cassandra
343+
```
344+
345+
Then run any example with: `make example-<name>`
326346

327347
- **`make example-basic`** - Basic connection and query execution
328348
- **`make example-streaming`** - Memory-efficient streaming of large result sets with True Async Paging
@@ -339,6 +359,9 @@ Run any example with: `make example-<name>`
339359
If you have Cassandra running elsewhere:
340360

341361
```bash
362+
# From the libs/async-cassandra directory:
363+
cd libs/async-cassandra
364+
342365
# Single node
343366
CASSANDRA_CONTACT_POINTS=10.0.0.1 make example-streaming
344367

docs/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The DataStax driver's `execute_async()` returns a `ResponseFuture` that will be
9292

9393
### 2. The Bridge: AsyncResultHandler
9494

95-
The magic happens in `AsyncResultHandler` ([src/async_cassandra/result.py](../src/async_cassandra/result.py)):
95+
The magic happens in `AsyncResultHandler` ([src/async_cassandra/result.py](../libs/async-cassandra/src/async_cassandra/result.py)):
9696

9797
```python
9898
class AsyncResultHandler:
@@ -153,7 +153,7 @@ async def get_result(self, timeout: Optional[float] = None) -> "AsyncResultSet":
153153

154154
### 5. Driver Thread Pool Configuration
155155

156-
The driver's thread pool size is configurable ([src/async_cassandra/cluster.py](../src/async_cassandra/cluster.py)):
156+
The driver's thread pool size is configurable ([src/async_cassandra/cluster.py](../libs/async-cassandra/src/async_cassandra/cluster.py)):
157157

158158
```python
159159
def __init__(self, ..., executor_threads: int = 2, ...):

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,4 +505,4 @@ except ConfigurationError as e:
505505
- [Connection Pooling](connection-pooling.md) - Understanding connection behavior
506506
- [Streaming](streaming.md) - Handling large result sets
507507
- [Performance](performance.md) - Optimization tips
508-
- [FastAPI Example](../examples/fastapi_app/) - Full production example
508+
- [FastAPI Example](../libs/async-cassandra/examples/fastapi_app/) - Full production example

docs/thread-pool-configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ if __name__ == "__main__":
8888

8989
For more examples of thread pool configuration:
9090

91-
- **Unit Tests**: [`tests/unit/test_thread_pool_configuration.py`](../tests/unit/test_thread_pool_configuration.py) - Demonstrates configuration options and verifies behavior
92-
- **Integration Tests**: [`tests/integration/test_thread_pool_configuration.py`](../tests/integration/test_thread_pool_configuration.py) - Shows real-world usage patterns
93-
- **Example Script**: [`examples/thread_pool_configuration.py`](../examples/thread_pool_configuration.py) - Interactive examples comparing different thread pool sizes
91+
- **Unit Tests**: [`tests/unit/test_thread_pool_configuration.py`](../libs/async-cassandra/tests/unit/test_thread_pool_configuration.py) - Demonstrates configuration options and verifies behavior
92+
- **Integration Tests**: [`tests/integration/test_thread_pool_configuration.py`](../libs/async-cassandra/tests/integration/test_thread_pool_configuration.py) - Shows real-world usage patterns
93+
- **Example Script**: [`examples/thread_pool_configuration.py`](../libs/async-cassandra/examples/thread_pool_configuration.py) - Interactive examples comparing different thread pool sizes
9494

9595
## Official Documentation
9696

docs/why-async-wrapper.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ session = await cluster.connect()
113113
# Reuse session for all requests - DO NOT close after each use
114114
```
115115

116-
**Note**: While async-cassandra provides context manager support for convenience in scripts and tests, production applications should create clusters and sessions once at startup and reuse them throughout the application lifetime. See the [FastAPI example](../examples/fastapi_app/main.py) for the correct pattern.
116+
**Note**: While async-cassandra provides context manager support for convenience in scripts and tests, production applications should create clusters and sessions once at startup and reuse them throughout the application lifetime. See the [FastAPI example](../libs/async-cassandra/examples/fastapi_app/main.py) for the correct pattern.
117117

118118
## 4. Lack of Async-First API Design
119119

@@ -344,7 +344,7 @@ def _asyncio_future_from_response_future(response_future):
344344
- Clean async/await syntax
345345
- Natural error handling with try/except
346346
- Integration with async frameworks (FastAPI, aiohttp)
347-
- See our [FastAPI example](../examples/fastapi_app/README.md) for a complete implementation
347+
- See our [FastAPI example](../libs/async-cassandra/examples/fastapi_app/README.md) for a complete implementation
348348

349349
2. **Event Loop Compatibility**:
350350
- Prevents blocking the event loop with synchronous calls

libs/async-cassandra-bulk/README_PYPI.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# async-cassandra-bulk
1+
# async-cassandra-bulk (🚧 Active Development)
22

33
[![PyPI version](https://badge.fury.io/py/async-cassandra-bulk.svg)](https://badge.fury.io/py/async-cassandra-bulk)
44
[![Python versions](https://img.shields.io/pypi/pyversions/async-cassandra-bulk.svg)](https://pypi.org/project/async-cassandra-bulk/)
55
[![License](https://img.shields.io/pypi/l/async-cassandra-bulk.svg)](https://github.com/axonops/async-python-cassandra-client/blob/main/LICENSE)
66

7-
High-performance bulk operations for Apache Cassandra, built on [async-cassandra](https://pypi.org/project/async-cassandra/).
7+
High-performance bulk operations extension for Apache Cassandra, built on [async-cassandra](https://pypi.org/project/async-cassandra/).
88

9-
> 📢 **Early Development**: This package is in early development. Features are being actively added.
9+
> 🚧 **Active Development**: This package is currently under active development and not yet feature-complete. The API may change as we work towards a stable release. For production use, we recommend using [async-cassandra](https://pypi.org/project/async-cassandra/) directly.
1010
1111
## 🎯 Overview
1212

13-
async-cassandra-bulk provides high-performance data import/export capabilities for Apache Cassandra databases. It leverages token-aware parallel processing to achieve optimal throughput while maintaining memory efficiency.
13+
**async-cassandra-bulk** will provide high-performance data import/export capabilities for Apache Cassandra databases. Once complete, it will leverage token-aware parallel processing to achieve optimal throughput while maintaining memory efficiency.
1414

1515
## ✨ Key Features (Coming Soon)
1616

@@ -29,7 +29,20 @@ pip install async-cassandra-bulk
2929

3030
## 🚀 Quick Start
3131

32-
Coming soon! This package is under active development.
32+
```python
33+
import asyncio
34+
from async_cassandra_bulk import hello
35+
36+
async def main():
37+
# This is a placeholder function for testing
38+
message = await hello()
39+
print(message) # "Hello from async-cassandra-bulk!"
40+
41+
if __name__ == "__main__":
42+
asyncio.run(main())
43+
```
44+
45+
> **Note**: Full functionality is coming soon! This is currently a skeleton package in active development.
3346
3447
## 📖 Documentation
3548

libs/async-cassandra/README_PYPI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
> 📢 **Early Release**: This is an early release of async-cassandra. While it has been tested extensively, you may encounter edge cases. We welcome your feedback and contributions! Please report any issues on our [GitHub Issues](https://github.com/axonops/async-python-cassandra-client/issues) page.
88
9-
> 🚀 **Looking for bulk operations?** Check out [async-cassandra-bulk](https://pypi.org/project/async-cassandra-bulk/) for high-performance data import/export capabilities.
9+
> 🚀 **Looking for bulk operations?** [async-cassandra-bulk](https://pypi.org/project/async-cassandra-bulk/) is currently in active development and will provide high-performance data import/export capabilities.
1010
1111
## 🎯 Overview
1212

13-
A Python library that enables true async/await support for Cassandra database operations. This package wraps the official DataStax™ Cassandra driver to make it compatible with async frameworks like **FastAPI**, **aiohttp**, and **Quart**.
13+
**async-cassandra** is the core library that enables true async/await support for Cassandra database operations. This package wraps the official DataStax™ Cassandra driver to make it compatible with async frameworks like **FastAPI**, **aiohttp**, and **Quart**.
1414

1515
When using the standard Cassandra driver in async applications, blocking operations can freeze your entire service. This wrapper solves that critical issue by bridging Cassandra's thread-based operations with Python's async ecosystem.
1616

libs/async-cassandra/examples/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22

33
This directory contains working examples demonstrating various features and use cases of async-cassandra.
44

5+
## 📍 Important: Directory Context
6+
7+
All examples must be run from the `libs/async-cassandra` directory, not from this examples directory:
8+
9+
```bash
10+
# Navigate to the async-cassandra library directory first
11+
cd libs/async-cassandra
12+
13+
# Then run examples using make
14+
make example-streaming
15+
```
16+
517
## Quick Start
618

719
### Running Examples with Make
820

9-
The easiest way to run examples is using the provided Make targets:
21+
The easiest way to run examples is using the provided Make targets from the `libs/async-cassandra` directory:
1022

1123
```bash
24+
# From the libs/async-cassandra directory:
25+
cd libs/async-cassandra
26+
1227
# Run a specific example (automatically starts Cassandra if needed)
1328
make example-streaming
1429
make example-export-csv
@@ -30,6 +45,9 @@ CASSANDRA_CONTACT_POINTS=node1.example.com,node2.example.com make example-stream
3045
Some examples require additional dependencies:
3146

3247
```bash
48+
# From the libs/async-cassandra directory:
49+
cd libs/async-cassandra
50+
3351
# Install all example dependencies (including pyarrow for Parquet export)
3452
make install-examples
3553

@@ -77,6 +95,10 @@ Demonstrates streaming functionality for large result sets:
7795

7896
**Run:**
7997
```bash
98+
# From libs/async-cassandra directory:
99+
make example-streaming
100+
101+
# Or run directly (from this examples directory):
80102
python streaming_basic.py
81103
```
82104

@@ -91,6 +113,10 @@ Shows how to export large Cassandra tables to CSV:
91113

92114
**Run:**
93115
```bash
116+
# From libs/async-cassandra directory:
117+
make example-export-large-table
118+
119+
# Or run directly (from this examples directory):
94120
python export_large_table.py
95121
# Exports will be saved in examples/exampleoutput/ directory (default)
96122

libs/async-cassandra/examples/exampleoutput/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ All files in this directory (except .gitignore and README.md) are ignored by git
1212
You can override the output directory using the `EXAMPLE_OUTPUT_DIR` environment variable:
1313

1414
```bash
15+
# From the libs/async-cassandra directory:
16+
cd libs/async-cassandra
1517
EXAMPLE_OUTPUT_DIR=/tmp/my-output make example-export-csv
1618
```
1719

1820
## Cleaning Up
1921

2022
To remove all generated files:
2123
```bash
24+
# From the libs/async-cassandra directory:
25+
cd libs/async-cassandra
2226
rm -rf examples/exampleoutput/*
2327
# Or just remove specific file types
2428
rm -f examples/exampleoutput/*.csv

0 commit comments

Comments
 (0)