Skip to main content

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
  • pyxapiand

Installation

pip install xapian-store

Quick Start

from xstore import XStore, STORE_TYPE_AFFILIATE, get_store_schema

# The XStore class requires INDEX_TEMPLATE to be defined in your application
class MyStore(XStore):
    INDEX_TEMPLATE = "stores/{slug}"  # Define your index template

# Create a store instance
store = MyStore()

# Access the schema
schema = get_store_schema()

Store Types

The package supports the following store types:

  • STORE_TYPE_NONE - No specific type
  • STORE_TYPE_AFFILIATE - Affiliate store
  • STORE_TYPE_AFFINITY - Affinity store
  • STORE_TYPE_FRANCHISE - Franchise store
  • STORE_TYPE_SUPPLIER - Supplier store
  • STORE_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 are NOT included in this package and must be defined in your application:

  • INDEX_TEMPLATE in the XStore class
  • _schema._foreign field value in the schema
  • Any application-specific constants or identifiers

See the configuration examples below for how to properly set these values.

Configuration Example

from xstore import XStore, get_store_schema

# Define your store class with required configuration
class MyStore(XStore):
    INDEX_TEMPLATE = "stores/{slug}"

    # Override schema to add application-specific configuration
    @classmethod
    def get_schema(cls):
        schema = get_store_schema()
        schema['_schema']['_foreign'] = 'https://myapp.com/schemas/store'
        schema['_schema']['_meta']['description'] = 'My application store'
        return schema

# 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

Project Structure

xstore/
├── src/
│   └── xstore/
│       ├── __init__.py     # Public API exports
│       ├── models.py       # XStore model class
│       └── schemas.py      # Schema definitions
├── pyproject.toml          # Project configuration
└── README.md              # This file

License

MIT License - see LICENSE file for details.

Links

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Authors

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

xapian_store-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xapian_store-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file xapian_store-0.1.1.tar.gz.

File metadata

  • Download URL: xapian_store-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for xapian_store-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0bf4c2b1bf1713fdb21579a36e144e35e4740581680e683f3927d331c324012c
MD5 fa2011f00f8c5ca3683a346e2865052e
BLAKE2b-256 1d2315746087af28b6f259f2e59e74fd548361cfedfce01426482f8b55d72cac

See more details on using hashes here.

File details

Details for the file xapian_store-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: xapian_store-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for xapian_store-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e68e837e535a9814d85b8cbaa8628a0442f559f68cb3a33d31413cd092509115
MD5 6454a10da3a24e81f5972588bcea1375
BLAKE2b-256 e3cb56b55404fcb77c5b279c182fd7d96f4932a434d72d7298c1b941e87d11eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page