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). Withdb.flags.max_connections, parsing checks that this, plusdirectReserveand 3 superuser connections, fits. -
Transaction mode (the default) doesn't support session state across transactions:
- no session
SET(useSET LOCAL); - no session advisory locks (use
pg_advisory_xact_lock); - no
LISTEN/NOTIFYand noWITH HOLDcursors.
Protocol-level prepared statements work (
maxPreparedStatements). Don't hold a transaction open across slow work. - no session
-
Migrations and admin connect directly, through
DATABASE_DIRECT_HOSTandDATABASE_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.typeisDelete,SetStorageClass(needsaction.storageClass) orAbortIncompleteMultipartUpload.conditiontakesage,matchesPrefixes,matchesSuffixes,matchesStorageClasses,withState(LIVE | ARCHIVED | ANY),numNewerVersionsanddaysSinceNoncurrentTime; set at least one.- With Autoclass enabled,
SetStorageClassrules 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.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eai_core_infra-2.9.0.tar.gz | 756.7 kB | With provenance | Details for eai_core_infra-2.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eai_core_infra-2.9.0-py3-none-any.whl | Python 3 | none | any | Details for eai_core_infra-2.9.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / eai_core_infra-2.9.0.tar.gz
| Download URL | eai_core_infra-2.9.0.tar.gz |
|---|---|
| Size | 756.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21b3884f5cdba650e5df5d2d0931c74683b498cc0acdedb483ded85d91f6f311
|
|
BLAKE2b-256 checksum How to use checksums |
9dafb24f275df0c1446b87b4762e6b963e204d6dc349549d48011b773305aad7
|
| 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 Oct 30, 2026.
Transparency logRelease files / eai_core_infra-2.9.0-py3-none-any.whl
| Download URL | eai_core_infra-2.9.0-py3-none-any.whl |
|---|---|
| Size | 756.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f800b1b9ecd10a72a317c78e0511c094918f6a1139456e277c1f9a63e4871726
|
|
BLAKE2b-256 checksum How to use checksums |
7cef34c9fddeeb3181a8b94954195e9acd5b951baeb4118143f223ba39ec7463
|
| 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 Oct 30, 2026.
Transparency logSecurity for eai-core-infra 2.9.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for eai_core_infra-2.9.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 Oct 30, 2026.
Transparency logA 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.