Skip to main content

eai-core-infra

Python package to manage core Pulumi infrastructure resources for ExtensibilityAI-provided deployments.

Install

From PyPI:

pip install eai-core-infra
# or
uv add eai-core-infra

2.0 is a breaking release (no deprecation shims). Pin eai-core-infra<2 until you migrate; see docs/MIGRATION-2.0.md.

Database pooler (PgBouncer)

Opt-in per app stack with <cloud>.db.pooler. Absent or enabled: false changes nothing. An app owns a pooler in its namespace:

cloud:
  db:
    flags: {max_connections: "100"}   # optional; enables the connection-budget check
    pooler:
      enabled: true
      replicas: 2                      # fixed; never autoscaled
      defaultPoolSize: 4               # pool for DATABASE_NAME
      pools: {api: 8, workers: 24}     # named pools: DATABASE_POOL_<NAME>=<db>__<name>
      clients:                         # other apps' DB users allowed through
        - {user: my-consumer, namespace: my-consumer, maxConnections: 6}

Or it is a client of another app's pooler:

cloud:
  db:
    pooler: {enabled: true, namespace: owner-app, pool: workers}
  • Server connections: replicas × (Σ pool sizes + reservePoolSize per pool + Σ client maxConnections). With db.flags.max_connections, parsing checks that this, plus directReserve and 3 superuser connections, fits.

  • Transaction mode (the default) doesn't support session state across transactions:

    • no session SET (use SET LOCAL);
    • no session advisory locks (use pg_advisory_xact_lock);
    • no LISTEN/NOTIFY and no WITH HOLD cursors.

    Protocol-level prepared statements work (maxPreparedStatements). Don't hold a transaction open across slow work.

  • Migrations and admin connect directly, through DATABASE_DIRECT_HOST and DATABASE_DIRECT_PORT.

The infra library that owns the stack (e.g. eai-web-app-infra) calls create_pgbouncer and writes the app-env keys.

Bucket options (GCP)

cloud.bucket (or each cloud.buckets.create[] entry) takes optional cors, autoclass and lifecycleRules on GCP (2.9.0+). Unset, the bucket renders exactly as before. AWS buckets reject these keys.

cloud:
  bucket:
    enabled: true
    retentionDays: 30                  # optional; bucket retention policy
    cors:                              # e.g. browser PUTs to signed URLs
      - origins: [https://app.example.com]
        methods: [GET, PUT, HEAD]      # case-insensitive
        responseHeaders: [Content-Type, ETag]
        maxAgeSeconds: 3600            # default
    autoclass:
      enabled: true                    # default; needs storageClass STANDARD (default)
      terminalStorageClass: ARCHIVE    # NEARLINE | ARCHIVE; unset = GCS default (NEARLINE)
    lifecycleRules:
      - action: {type: AbortIncompleteMultipartUpload}
        condition: {age: 7}
      - action: {type: Delete}
        condition: {matchesPrefixes: [tmp/], age: 1}
      - action: {type: Delete}
        condition: {withState: ARCHIVED, daysSinceNoncurrentTime: 90}
  • action.type is Delete, SetStorageClass (needs action.storageClass) or AbortIncompleteMultipartUpload.
  • condition takes age, matchesPrefixes, matchesSuffixes, matchesStorageClasses, withState (LIVE | ARCHIVED | ANY), numNewerVersions and daysSinceNoncurrentTime; set at least one.
  • With Autoclass enabled, SetStorageClass rules are rejected (Cloud Storage manages the classes).

Test

uv sync --extra dev
uv run pytest

The guardrail suites (layout, import rules, contracts, models) and the resource-graph snapshots run on eai_core_infra.testing, which other eai-*-infra packages use too (pip install "eai-core-infra[testing]"). Describe the package with a GuardrailSpec and call one assert_* per suite. RECORD_ALLOWLISTS=1 rewrites the ratchet allowlists and RECORD_SNAPSHOTS=1 rewrites snapshots; review every added line.

Pre-commit

Hooks mirror CI lint and tests (ruff check, pytest):

uv tool install pre-commit   # once
pre-commit install
pre-commit run --all-files   # optional manual run

License

Apache-2.0

Metadata

Release files for eai-core-infra 2.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eai-core-infra 2.10.0
File Size Uploaded Provenance Actions
eai_core_infra-2.10.0.tar.gz 758.1 kB With provenance Details for eai_core_infra-2.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eai-core-infra 2.10.0
File Interpreter ABI Platform Actions
eai_core_infra-2.10.0-py3-none-any.whl Python 3 none any Details for eai_core_infra-2.10.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / eai_core_infra-2.10.0.tar.gz

Download URL eai_core_infra-2.10.0.tar.gz
Size 758.1 kB
Tags Source
SHA-256 checksum
How to use checksums
69364ee8da8342d503f1aac94bf8d811f0cddb0d78f1803344b1e3fc96ba294c
BLAKE2b-256 checksum
How to use checksums
7edbaa417825230c0e99ea45f5d27b9187fb0ba10a1bff35cee92c75f919b6cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / eai_core_infra-2.10.0-py3-none-any.whl

Download URL eai_core_infra-2.10.0-py3-none-any.whl
Size 757.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdf5ec91854050300f0b22f0fdff7964aba9f9c044531b6d19409add40635bc2
BLAKE2b-256 checksum
How to use checksums
87bed3588d16d0e2d89d7d80f7b3e39fb517ae6063442051bdb219f9fa091e5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for eai-core-infra 2.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for eai_core_infra-2.10.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.10.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page