Skip to main content

Typed Amazon raw-data provider services for Keble.

Project description

keble-amz

keble-amz 2.x is the framework-free Amazon raw-data provider package. The legacy 1.x monolith remains preserved on maintenance branch 1.0.28; current source no longer embeds Keepa, cost analysis, shuffle/LLM analysis, ScraperAPI, or bundled wheels.

Install the current public provider line with pip install "keble-amz>=2.0.0,<3". Its public dependency bounds require the released data-infra contract, keble-db>=1.9.0, and keble-keepa>=1.3.0.

Architecture

keble-data-infra-contract
          ↑
keble-amz: AmazonServices ──> keble-keepa
          │                       │
          └── RedisLeaseManager <-┘ Mongo/Redis cache

AmazonServices exports three typed operations through one provider manifest:

  • lookup_products(ProductLookupQuery) — exact batched ASIN lookup;
  • search_products(ProductSearchQuery) — Keepa title finder plus product load;
  • rank_products(ProductRankingQuery) — current official Amazon category bestseller board.

Provider methods return only keble-data-infra-contract values. Keepa DTOs, cache policy, and usage accounting remain owned by keble-keepa. Shared Money, AmazonMarketplace, hashing, and Redis owner-token leases are reused from Keble packages rather than redeclared.

The package exports no FastAPI app or router. keble-data-infra-api consumes the manifest and owns all paths, OpenAPI, error handlers, and runtime clients.

Cache and concurrency

Keepa remains the only normalized provider cache. Amazon wraps complete operation requests in RedisLeaseManager single-flight keys. Every contender re-enters the Keepa handler after acquiring ownership, so it rechecks Mongo and spends no upstream call after the first owner persists the result.

Redis lease acquisition and the cache-recheck-or-upstream critical section emit Sentry child spans when the API initializes telemetry. Span names contain only the stable Keepa operation and never ASINs, keywords, request JSON, responses, or credentials.

Lookup delegates to KeepaApiBatchLoader, preserving exact per-ASIN cache keys, caller order, duplicates, partial hits, negative hits, newest-write-wins repair, request batching, and usage accounting.

Verification

Python 3.13 and uv are required:

uv lock --check
uv run pytest -q \
  -m "not live and not slow and not eval and not local_stack and not db_stack and not container"
KEBLE_BACKEND_ENV_FILE=/path/to/keble.backend/.env \
RUN_INTEGRATION=1 RUN_REAL_DB=1 RUN_LOCAL_STACK=1 \
  uv run pytest -q tests/integration
KEBLE_BACKEND_ENV_FILE=/path/to/keble.backend/.env RUN_KEEPA_LIVE=1 \
  uv run pytest -q tests/live -m "live and keepa_live"
uv run npx --yes pyright .
uv build

Integration/live tests use unique Redis namespaces and Mongo collections and clean them after each run. Secrets resolve by explicit name through the shared backend-env test helper and are never copied into this repository.

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

keble_amz-2.0.0.tar.gz (76.6 kB view details)

Uploaded Source

Built Distribution

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

keble_amz-2.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file keble_amz-2.0.0.tar.gz.

File metadata

  • Download URL: keble_amz-2.0.0.tar.gz
  • Upload date:
  • Size: 76.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for keble_amz-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ff956ef422e3d23349bedf9f95ce9a47e5731caabd101d2fa312bebf10e7db4e
MD5 c76afc044000aa88c693464b527877e6
BLAKE2b-256 e95f6b8ebcb701ada456872d7ee5d7cdb190e7fc01cbbca14a7aabc67c1c1834

See more details on using hashes here.

File details

Details for the file keble_amz-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: keble_amz-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for keble_amz-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb70738ca17a32d7790a51cc1492cad7cc402b3fc0fb2d8fb264ea1d9ab958ab
MD5 cfb56abc6c068b9dd4142136592dd56f
BLAKE2b-256 17bd67c187e601ee8531805e4533b23aeec6c42ac8f987de86104c5464b7df72

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