Python package that provides the XStore model class, built on top of xapian_model.base.BaseXapianModel
Project description
xapian-store
A Python package providing the XStore model class for managing store data using Xapian as the underlying storage engine.
Features
- Built on top of
xapian_model.base.BaseXapianModel - Comprehensive store schema with support for multiple store types
- Type-safe field definitions with validation
- Support for soft deletes and timestamps
- Configurable store attributes (slug, domain, name, owner, type, etc.)
- Visual customization fields (photo, header, color)
Requirements
- Python 3.12 or higher
- xapian-model >= 0.4.0
- pyxapiand >= 2.1.0
Installation
pip install xapian-store
Quick Start
from xstore import XStore, STORE_TYPE_AFFILIATE, get_store_schema
# XStore comes with a default INDEX_TEMPLATE and SCHEMA;
# override them in a subclass if your application requires it.
class MyStore(XStore):
INDEX_TEMPLATE = "my_stores"
# Create a store instance
store = MyStore()
# Access the schema directly
schema = get_store_schema(foreign_schema='.schema/store')
Store Types
The package supports the following store types:
STORE_TYPE_NONE- No specific typeSTORE_TYPE_AFFILIATE- Affiliate storeSTORE_TYPE_AFFINITY- Affinity storeSTORE_TYPE_FRANCHISE- Franchise storeSTORE_TYPE_SUPPLIER- Supplier storeSTORE_TYPE_MASHUP- Mashup store
Schema Configuration
The store schema includes the following main fields:
- Identification:
id,slug,domain,canonical_url - Metadata:
name,owner,supplier,store_type - Visual:
photo,header,color,base_color - Status:
is_published,hidden,is_deleted,is_root_affinity_store - Timestamps:
created_at,updated_at,deleted_at - Contact:
from_email,address
Security Note
For security reasons, the following values should be reviewed and overridden per application:
INDEX_TEMPLATE— defaults to'stores'; override in a subclass if neededforeign_schema— passed as a parameter toget_store_schema()
Configuration Example
from xstore import XStore, get_store_schema
# Override INDEX_TEMPLATE and SCHEMA for your application
class MyStore(XStore):
INDEX_TEMPLATE = "my_stores"
SCHEMA = get_store_schema(foreign_schema='.schema/my_store')
# Use your store
store = MyStore()
Development
Setup
The project uses direnv to automatically create and activate a virtual environment:
# With direnv installed, simply cd into the project
cd xstore
# Or manually create the environment
python3 -m venv .venv
source .venv/bin/activate
Running Tests
The integration tests require a running Xapiand server at localhost:8880. They skip gracefully when the server is unavailable.
# Install test dependencies
pip install -e ".[test]"
# Run integration tests (requires xapiand at localhost:8880)
pytest tests/ -v
# Tests skip automatically if the server is not running
All test indices are namespaced under the tests/ prefix so they don't interfere with production data and can be cleaned up manually.
Project Structure
xstore/
├── src/
│ └── xstore/
│ ├── __init__.py # Public API exports
│ ├── models.py # XStore model class
│ └── schemas.py # Schema definitions
├── tests/
│ ├── conftest.py # Shared fixtures and server check
│ └── test_integration.py # Integration test suite
├── pyproject.toml # Project configuration
└── README.md # This file
License
MIT License - see LICENSE file for details.
Links
- Homepage: https://github.com/dubalu/xstore
- Repository: https://github.com/dubalu/xstore
- Bug Reports: https://github.com/dubalu/xstore/issues
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Authors
- Dubalu info@dubalu.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xapian_store-0.2.4.tar.gz.
File metadata
- Download URL: xapian_store-0.2.4.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c10e87cfe79aa1018ffec474be5a522a82557012eb7b04895c7a94c0a5bbb84b
|
|
| MD5 |
3bdde292d0db396b2ff036eaab7006cf
|
|
| BLAKE2b-256 |
63679b439b909584a016f52579d5c40c966f660d39a58a2e2384a5b2dc3d8e77
|
File details
Details for the file xapian_store-0.2.4-py3-none-any.whl.
File metadata
- Download URL: xapian_store-0.2.4-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b30e9d56c3c9d5cd92e886860bdd09758a3bb55312ca62763273f976ee125a8d
|
|
| MD5 |
384952d57c0bcf7bed54193431aef4f9
|
|
| BLAKE2b-256 |
1257982f45a99a9038021b443e2de9dd3f4794f45f9a3eebc4e102d23574da42
|